1

I want to change Shipping Method title on checkout page as shown in below image-

enter image description here

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();
    }
}
  • Use Mage::helper('checkout/cart') instead of Mage::helper('checkout') on line where you are getting grand total – Jaimin Sutariya Feb 6 '17 at 9:43
  • If its still not working, use Mage::getModel('checkout/cart')->getQuote()->getGrandTotal() to get Grand total amount – Jaimin Sutariya Feb 6 '17 at 9:48
  • Still Not working. And if I try die('hello'); in construct method, it also does not work. – Shashank Feb 6 '17 at 9:51
  • Can you please confirm your module is installed and enabled from System > Configuration > Advanced – Jaimin Sutariya Feb 6 '17 at 10:03
  • Yes. It is enabled. confirmed – Shashank Feb 6 '17 at 10:11
2

First, you need to update for config.xml like below, Change

<blocks>
  <methods>
    <rewrite>
      <shipping_method>Emizentech_Restricteway_Checkout_Block_Onepage_Shipping_Method</shipping_method>
    </rewrite>
  </methods>
</blocks>

to

<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>

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.

class Emizentech_Restricteway_Block_Checkout_Onepage_Shipping_Method extends Mage_Checkout_Block_Onepage_Shipping_Method
{
    protected function _construct()
    {
        if(Mage::getModel('checkout/cart')->getQuote()->getGrandTotal() > 1100){
            $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'),
                 'is_show'   => $this->isShow()
            ));
            parent::_construct();
        }
    }
}

EDITS:
app\etc\modules\Emizentech_Restricteway.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Emizentech_Restricteway>
      <active>true</active>
      <codePool>local</codePool>
      <version>0.1.0</version>
    </Emizentech_Restricteway>
  </modules>
</config>

app\code\local\Emizentech\Restricteway\etc\config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Emizentech_Restricteway>
      <version>0.1.0</version>
    </Emizentech_Restricteway>
  </modules>
  <global>
    <helpers>
      <restricteway>
        <class>Emizentech_Restricteway_Helper</class>
      </restricteway>
    </helpers>
    <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>
  </global>
</config> 

app\code\local\Emizentech\Restricteway\Block\Checkout\Onepage\Shipping\Method.php

<?php
class Emizentech_Restricteway_Block_Checkout_Onepage_Shipping_Method extends Mage_Checkout_Block_Onepage_Shipping_Method
{
    protected function _construct()
    {
        $cartGrandTotal = Mage::getModel('checkout/cart')->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();
        }

    }
}

This code is working for me. Please check with your code.

  • By following above way, Shipping Method steps has been disappeared on checkout page. – Shashank Feb 6 '17 at 8:15
  • Updated code for Emizentech/Restricteway/Block/Checkout/Onepage/Shipping/Method.php, please check now. – Jaimin Sutariya Feb 6 '17 at 8:33
  • Shipping Method steps has been disappeared on checkout page. – Shashank Feb 6 '17 at 9:33
  • please post your updated code to question. – Jaimin Sutariya Feb 6 '17 at 9:34
  • please check edits – Shashank Feb 6 '17 at 9:38
2

Change In below file if your store is English

app/locale/en_US/Mage_Checkout.csv

Change

"Shipping Method","Shipping Method"

to

"Shipping Method","<Your Title>"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.