Hello,
I have the cart link in my header and would like for it to automatically display/update the number of items in the cart when someone adds a product. I am running Opencart 1.551 and you can see the header here:
zivacollection.com
Can someone help me with the code and file that I need to modify? Many thanks in advance!
the file you need to modify is:
catalog/view/theme/default/template/common/header.tpl
What you need to get in there is the cart module: put <?php echo $cart; ?> in the header. then just use the style.css and catalog/view/theme/default/template/module/cart.tpl files to make it look how you want it to.
not sure about your theme, so if it throws up an error then you will need to check the header.php controller too.
catalog/view/theme/default/template/common/header.tpl
What you need to get in there is the cart module: put <?php echo $cart; ?> in the header. then just use the style.css and catalog/view/theme/default/template/module/cart.tpl files to make it look how you want it to.
not sure about your theme, so if it throws up an error then you will need to check the header.php controller too.
Thanks for your response.When I add in the code into header.tpl it gives me the price and number of items(e.g. $20.00- 2 items) similar to what I removed from the header as I actually did away with the mini cart. I've included a picture of what I'm trying to describe. Thanks again!tora0515 wrote:the file you need to modify is:
catalog/view/theme/default/template/common/header.tpl
What you need to get in there is the cart module: put <?php echo $cart; ?> in the header. then just use the style.css and catalog/view/theme/default/template/module/cart.tpl files to make it look how you want it to.
not sure about your theme, so if it throws up an error then you will need to check the header.php controller too.
Yup, so take a look at the mini cart code and see how they are getting the (# of items) Or else, you could just style the mini cart to look like the link (ie get rid of the javascript and a bunch of text) Just depends if you like to erase code or write code.
tora0515 wrote:Yup, so take a look at the mini cart code and see how they are getting the (# of items) Or else, you could just style the mini cart to look like the link (ie get rid of the javascript and a bunch of text) Just depends if you like to erase code or write code.
Excellent, I have deleted code to get it to look like I want it to. One final question though. Is there a way for me to get rid of the popup link that shows whats in the cart when the mini cart info is clicked? I have it down to an empty window but when I try to totally erase the code from catalog/module/cart.tpl it gives my page a fatal error. BTW give me your paypal addy so I can send you a little token of appreciation (you totally saved me from having to spend money on this fix).
Edit catalog/view/javascript/common.js
Find and delete the code or rename id '#cart':
Or:
Edit catalog/view/theme/YOUR_THEME/template/module/cart.tpl
Remove <a> and </a> from
Find and delete the code or rename id '#cart':
Code: Select all
/* Ajax Cart */
$('#cart > .heading a').live('click', function() {
$('#cart').addClass('active');
$('#cart').load('index.php?route=module/cart #cart > *');
$('#cart').live('mouseleave', function() {
$(this).removeClass('active');
});
});
Or:
Edit catalog/view/theme/YOUR_THEME/template/module/cart.tpl
Remove <a> and </a> from
Code: Select all
<a><span id="cart-total"><?php echo $text_items; ?></span></a>
Who is online
Users browsing this forum: No registered users and 313 guests