logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to forums.ablecommerce.com. Please use your AbleCommerce username and password to Login. Forums Registration.

Notification

Icon
Error

Options
Go to last post Go to first unread
judy at Web2Market  
#1 Posted : Tuesday, February 23, 2021 11:00:52 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 121

Thanks: 4 times
Was thanked: 2 time(s) in 2 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

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. Forums Registration.

shaharyartiwana25816656  
#2 Posted : Wednesday, February 24, 2021 3:09:38 AM(UTC)
shaharyartiwana25816656

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 215

Thanks: 1 times
Was thanked: 33 time(s) in 33 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?
judy at Web2Market  
#3 Posted : Wednesday, February 24, 2021 5:38:07 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 121

Thanks: 4 times
Was thanked: 2 time(s) in 2 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.
judy at Web2Market  
#4 Posted : Wednesday, February 24, 2021 7:38:19 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 121

Thanks: 4 times
Was thanked: 2 time(s) in 2 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

judy at Web2Market  
#5 Posted : Thursday, February 25, 2021 7:21:11 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 121

Thanks: 4 times
Was thanked: 2 time(s) in 2 post(s)
It turns out that part of the problem was that someone had put caching on a header menu.
Users browsing this topic
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.