TransWikia.com

Magento 1.9.2.4 Add Cart To Header

Magento Asked by KS6814 on February 5, 2021

I need to add a cart to the header. I am creating my own custom theme which feeds of the RWD theme. I need a cart that shows total items and value.

2 Answers

I added the following code to the custom-theme/default/layout/local.xml file.

<reference name="header">
<block type="checkout/cart_sidebar" name="cart_sidebar" as="top-cart" template="checkout/cart/sidebar.phtml"/>
</reference>

I then added the following code to the custom-theme/default/page/html/header.phtml where I wanted the cart to show.

<?php echo $this->getChildHtml('top-cart'); ?>

I then customised the style and layout of the following page.

custom-theme/default/template/checkout/cart/sidebar.phtml

Answered by KS6814 on February 5, 2021

I think it will be much faster and secure to use ready made solution like this one.

Answered by Neklo.com on February 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP