AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Header basket count not updating at times
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
We have added code to the _StoreHeaderNavigation so that the count of items in the basket displays. The _StoreHeaderNavigation is part of a new widget board for the header instead of using AC header because client wanted a custom megamenu and other things in the header. Part of the code was already there- var basketItemsCount = BasketHelper.GetBasketItemsCount();
We just added code later on to display the count <li><a href="@Url.Content("~/Checkout/Basket")"> <i class="fa fa-shopping-cart"></i> @GetResourceString("retail.storemenu.cart") @if (basketItemsCount > 0) { <text>(@(basketItemsCount))</text>} </a></li>
Sometimes this updates, sometimes it doesn't. If I add to the cart from the category page, it updates. If I add from the product page, it doesn't update and if I do refresh page in the browser using right mouse button, it doesn't update. On the product page, there is a tab that shows upsell products and if I click add to cart there (on the button that works, see other post), the header count updates. Why would this be and is there a solution? Thanks
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
I have added your code in the StoreHeaderNavigation view file. It is working in the default widget/board configuration for me in each scenario.
You have your customized header and I think if this is happening consistently then it is probably because of the customized header.
If you can share details so that I can try to replicate your scenario?
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
The header is quite customized. Let me take portions of it off at a time and troubleshoot that way first. Thanks for your help.
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
I've taken everything out of the header except the storeheadernavigation in this post and the basket count doesn't update. If I add in the store menu light, the basket count in that does update. Is there a javascript secret or something to this? Thanks Edited by user Wednesday, February 24, 2021 7:44:22 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
It turns out that part of the problem was that someone had put caching on a header menu.
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Header basket count not updating at times
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close