I want to change Shipping Method title on checkout page as shown in below image-
I tried to do following below links, but dont know which block class to overwrite.
http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/
Here is what I tried-
<blocks>
<methods>
<rewrite>
<shipping_method>Emizentech_Restricteway_Checkout_Block_Onepage_Shipping_Method</shipping_method>
</rewrite>
</methods>
</blocks>
and created this file in my module–
Emizentech/Restricteway/Checkout/Block/Onepage/Shipping/Method.php
EDIT:-
I want to change 'Shipping Method' title to 'unloading Method' only when my quote grand total is greater than $1100.
Here is my updated files-
config.xml-
<config>
<modules>
<Emizentech_Restricteway>
<version>1.0</version>
</Emizentech_Restricteway>
</modules>
<global>
<blocks>
<restricteway>
<class>Emizentech_Restricteway_Block</class>
</restricteway>
<checkout>
<rewrite>
<onepage_shipping_method>Emizentech_Restricteway_Block_Checkout_Onepage_Shipping_Method
</onepage_shipping_method>
</rewrite>
</checkout>
</blocks>
<helpers>
<restricteway>
<class>Emizentech_Restricteway_Helper</class>
</restricteway>
</helpers>
</global>
</config>
Emizentech/Restricteway/Block/Checkout/Onepage/Shipping/Method.php-
class Emizentech_Restricteway_Block_Checkout_Onepage_Shipping_Method extends Mage_Checkout_Block_Onepage_Shipping_Method
{
protected function _construct()
{
$cartGrandTotal = Mage::helper('checkout')->getQuote()->getGrandTotal();
$conditionOrderAmount = Mage::getStoreConfig('setting/setorder/order_amount');
if($cartGrandTotal > $conditionOrderAmount)
{
$this->getCheckout()->setStepData('shipping_method', array(
'label' => Mage::helper('checkout')->__('Unloading Method'),
'is_show' => $this->isShow()
));
}
else
{
$this->getCheckout()->setStepData('shipping_method', array(
'label' => Mage::helper('checkout')->__('Shipping Method 456'),
'is_show' => $this->isShow()
));
parent::_construct();
}
}
/**
* Retrieve is allow and show block
*
* @return bool
*/
public function isShow()
{
return !$this->getQuote()->isVirtual();
}
}
Best Answer
First, you need to update for config.xml like below, Change
to
The block file Emizentech/Restricteway/Checkout/Block/Onepage/Shipping/Method.php you created is also wrong, You need to create Emizentech/Restricteway/Block/Checkout/Onepage/Shipping/Method.php file Now in your file, add below code.
EDITS:
app\etc\modules\Emizentech_Restricteway.xml
app\code\local\Emizentech\Restricteway\etc\config.xml
app\code\local\Emizentech\Restricteway\Block\Checkout\Onepage\Shipping\Method.php
This code is working for me. Please check with your code.