X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Cart summary update problem - AJAX question?? (https://forum.x-cart.com/showthread.php?t=70462)

Northcore 11-09-2014 01:35 AM

Cart summary update problem - AJAX question??
 
I've been a bit of butcher and in myskin/common_files/customer/head.tpl I've deleted everything in the line1 div (don't need the tabs/speedbar) and written a little cart summary using $minicart_total_items and $minicart_total_cost which also displays messages based on the amount in the cart and $store_country (e.g. spend ё10 more for free UK shipping).

Everything works except if I add a product to the cart the information doesn't get updated because that area of the page is not being refreshed. If I move to another page it catches up and is correct. If I change the Your Country it refreshes fine - this is the behaviour I need when a product is added.

So how do I trigger a refresh of head.tpl or the .line1 div when an item is added to the cart?

FYI I'm using the add to cart popup module but the behaviour is the same if I disable it.

Any help would be great - the stores nearly finished but I don't know where to start on this.

totaltec 11-09-2014 05:13 AM

Re: Cart summary update problem - AJAX question??
 
If I remember correctly the ajax refresh happens based on a specific CSS class. You could either dig through the javascript and update the class name there, or wrap your minicart section in the appropriate class.

Northcore 11-09-2014 10:16 AM

Re: Cart summary update problem - AJAX question??
 
Thanks Mike. I did wonder if losing the structure of the tabs/speed bar was part of the issue. I'll try bringing the various divs back in tomorrow and see if I can get to the bottom of it.

Northcore 11-10-2014 01:22 AM

Re: Cart summary update problem - AJAX question??
 
Yes I couldn't have got it more wrong! Thanks for the pointer Mike. Just in case it helps anyone:

1) I left out the reference to skin/common_files/js/ajax.minicart.js

2) I think the div structure needs to include:

<div class="menu-minicart">
<div class="minicart">
your code
</div>
</div>

3) Finally I have moved my code into mincart_total.tpl which is important as when the refresh is called this is the file that's loaded in.


All times are GMT -8. The time now is 04:17 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.