0

I am not sure if this has been asked before but I could not get anything much relevant when I tried to search about it. I want to add a new custom link on the shopping cart page along with the other existing links Update Shopping Cart and the Continue Shopping links.

enter image description here

I am having a custom module and I understand that I would need to override the core template but not sure on how exactly this should be done. Which is the template file that is responsible for displaying the other links or buttons?

Can anyone please help?

1

In a default installation, that template is

app/design/frontend/base/default/template/checkout/cart.phtml

...
<?php if($this->getContinueShoppingUrl()): ?>
    <button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Continue Shopping')) ?>" class="button btn-continue" onclick="setLocation('<?php echo Mage::helper('core')->quoteEscape($this->getContinueShoppingUrl()) ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
<?php endif; ?>
<button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
<button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>
...

More info about overriding (or defining a new) a .phtml template in a module

https://stackoverflow.com/questions/13525853/how-to-override-phtml-file-in-custom-module-of-magento

In your case, your module custom layout should be something like this

<checkout_cart_index>
    <reference name="checkout.cart"">         
        <action method="setTemplate">
            <template>PATH_TO_YOUR_CUSTOM_TEMPLATE_HERE</template>
       </action>      
    </reference>
</checkout_cart_index>
  • How can I override it in my module? – manini Jan 5 '18 at 9:06
  • I update the answer with info about overriding templates in Magento... check it in a few minutes – Raul Sanchez Jan 5 '18 at 9:18

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.