2

I need to change the url that the checkout link in top links is pointing to. At the moment it point to /checkout but i need it to point to /checkout/onepage.

normally the redirect it automatic but i have an extension with conflict with this auto redirect so i just want to change the top link so there is no re direct.

I found this

    <reference name="top.links">
        <block type="checkout/links" name="checkout_cart_link">
            <action method="addCartLink"></action>
        </block>
    </reference>

but i dont know how to change the url on the link

4

You need to rewrite the block Mage_Checkout_Block_Links. Here is a tutorial on how to do that,
and you need to change the method addCheckoutLink and make it look like this:

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, 'checkout/onepage', $text,
            true, array('_secure' => true), 60, null,
            'class="top-link-checkout"'
        );
    }
    return $this;
}

the only difference is that this line $text, 'checkout', $text, becomes $text, 'checkout/onepage', $text,

3

Path:-app/code/core/Mage/Checkout/Block/Links.php

copy the file to your Local folder otherwise overwrite the block file. and change the url in addLink() function.

here I change the url based on theme name.

public function addCheckoutLink()
{

    if (!$this->helper('onestepcheckout')->isRewriteCheckoutLinksEnabled()){
        return parent::addCheckoutLink();
    }

    if (!$this->helper('checkout')->canOnepageCheckout()) {
        return $this;
    }
    if ($parentBlock = $this->getParentBlock()) {
        $text = $this->__('Checkout');
         $theme_name =  Mage::getSingleton('core/design_package')->getTheme('frontend');
         if($theme_name=='Your-Theme-Name'){
             $parentBlock->addLink($text, 'checkout/onepage', $text, true, array('_secure'=>true), 60, null, 'class="top-link-onestepcheckout"');
         }else {
            $parentBlock->addLink($text, 'onestepcheckout', $text, true, array('_secure'=>true), 60, null, 'class="top-link-onestepcheckout"');
         }
    }
    return $this;
}

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.