3

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

2
  • which verions you have use?
    – Amit Bera
    Commented Feb 20, 2015 at 5:53
  • Magento 1.9.1 version Commented Feb 20, 2015 at 7:27

2 Answers 2

2

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

}
4
  • Thank You sir,Good Effort.I use that code nothing will happen. Commented Feb 20, 2015 at 6:47
  • Bala, I have check the it was working.. May be you not create extension
    – Amit Bera
    Commented Feb 20, 2015 at 6:52
  • Thanks,another extension overwrite Mage_Checkout_Block_Links.So I find my problem Commented Feb 20, 2015 at 7:00
  • I also add my answer for my question Commented Feb 20, 2015 at 7:40
3

Lotusbreath one step checkout extension is used
My code is

public function addCheckoutLink()
{

    if (!Mage::getStoreConfig('lotusbreath_onestepcheckout/general/enabled')) {
        return parent::addCheckoutLink();
    }

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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