Magento 1.8/1.9 – Change Checkout URL in Top Menu

magento-1.8magento-1.9

In Magento ,add one step checkout extension.Its works fine but top menu Checkout link is redirect to mydomain/checkout/onepage.Actually what I need is Checkout link is redirect to mydomain/onestepcheckout

Thanks

Best Answer

I donot know which magento version you have using .

According to basic magento code this link has been coming from Mage_Checkout_Block_Links class addCheckoutLink function.

If you have rewrite this class then and modify code then it will works

Rewrite class at config.xml

  <global>
    <blocks>
      <magento57995>
        <class>Stackexchange_Magento57995_Block</class>
      </magento57995>
    <checkout>
        <rewrite>
            <links>Stackexchange_Magento57995_Block_Checkout_Links</links>
        </rewrite>
    </checkout>
    </blocks>
  </global>

Rewrite class code and edit function addCheckoutLink

<?php
class Stackexchange_Magento57995_Block_Checkout_Links extends Mage_Checkout_Block_Links
{

        public function addCheckoutLink()
    {
        if (!$this->helper('checkout')->canOnepageCheckout()) {
            return $this;
        }

        $parentBlock = $this->getParentBlock();
        if ($parentBlock && Mage::helper('core')->isModuleOutputEnabled('Mage_Checkout')) {
            $text = $this->__('Checkout');
            $parentBlock->addLink(
                $text, 'onestepcheckout', $text,
                true, array('_secure' => true), 60, null,
                'class="top-link-checkout"'
            );
        }
        return $this;
    }

}
Related Topic