Jump to content

Basket won't update without "Refresh Basket"


lifegrains

Recommended Posts

Whenever you click on Add to Basket, the basket doesn't add that item unless you manually do a browser refresh, or click the Refresh Basket button.  You can add 3 or 4 items, and none of them will show up, then when you click Refresh Basket, they are all there.  So Cubecart knows they are supposed to be there, but it isn't updating the Basket page to reflect it. This happens both on the main basket page, and also on the mini-cart in the navigation bar. 

 I had done some customization of the scripts, and thought that might be the problem, but then I totally overwrote everything and went back to the stock scripts when I upgraded to 6.2.1, but the problem still persists.  I've tried different browsers (Opera, Firefox, Explorer) with the same results, so I don't think it is a browser issue.

Does anyone have any suggestions on what could be causing this?

Link to comment
Share on other sites

Do you have any security application on your computer? We have seen some instances where an "Internet Security" (a component of a complete anti-virus package) is interfering with cookies.

Loss of cookies cause a loss of session. Experiencing a (temporary) loss of shopping cart contents can be verified if you also find yourself logged out unexpectedly.

You might also want to verify with your hosting provider if they are having you use an overly aggressive page caching appliance.

Link to comment
Share on other sites

This is happens with any system (my pc, my linux pc, my friend's pc, even my phone!), so I don't think it is a device-configuation issue.  Also, it doesn't seem like I am losing my session, because when I refresh, everything is there.  It just won't show up until I do the refresh.   If you would like to see it in action, go to www.lifegrains.com.

I do sometimes get an error from the browser that there have been too many redirects when I try to add the first item.  Then I refresh and the item is there.

Thanks for your help!

Link to comment
Share on other sites

I do see several bounces:
www.lifegrains.com bounces to www.lifegrains.com/
www.lifegrains.com/ bounces to www.lifegrains.com/cubecart
www.lifegrains.com/cubecart bounces to www.lifegrains.com/cubecart/

That's not too bad, but I suggest that you forego bouncing to the sub-directory and just use the full path.

Also, I see CubeCart is being directly told (somewhere) that it is located at IP-Address/~lifegrai. Please check /includes/global.inc.php for statements that give hard-coded values for the web address - these statements should not be used if you have a valid domain name.

Switching between a valid domain name and the IP/squiggle format invalidates the cookie. The cookie has "cookie-path" and 'cookie-domain" attributes that will not match from page to page, thus causing mayhem.

Check .htaccess if there is a Rewrite Base directive that needs updating.

Link to comment
Share on other sites

OK, so I think I cleaned up my redirect issues a fair bit.   One of the main culprits was the SSL section of the settings in Cubecart.  It had the ~lifegrai and the IP address entries.  I removed those and put in the URL. 

However, it still does not update the basket when I add an item....(!)  😢

Also, if my cookie is being destroyed, why would it "remember" the items, but not update the page until I click update?

Thanks for being helpful!

Link to comment
Share on other sites

There might be that overly aggressive page cache system employed by your hosting provider.

I clicked on a Add to Basket, I see the ajax request (supposed to happen), and I see that you have CubeCart configured to take the customer to the View Basket page.

There is the item is in the basket.

However, clicking on the store logo (takes me to the store's homepage) shows a page with an empty shopping basket. Asking for another homepage shows the correct shopping basket.

Please verify if your hosting provider is or is not using any kind of PHP code cache or web page cache.

 

Link to comment
Share on other sites

  • 1 year later...

I am getting this same problem, even when I run CubeCart locally and can control my own php.ini settings. I found that the issue lies in the CubeCart caching, and more specifically, the caching of the menu. I found by deleting just the html.<theme>.menu.<lang>.cache file, the basket will update. I am currently looking at where I can stop that caching, but I have been able to find where to stop it from using that cache in the gui.class.php file in the _displayNavigation() function. By changing the condition:

if (($content = $GLOBALS['cache']->read($cache_id, $serialize)) == false)

You can force it to never use the cache and the basket will be correct when you reload or go to another page. I am still trying to figure out how to update the basket without a page load or transition, as I do not transition to the cart when a user adds an item.

Link to comment
Share on other sites

This observed behavior is not normal for CubeCart. On the other hand, we would like to know the exact version of CubeCart you are using so we can determine if there are/were issues with certain cache methods and if/how the server environment may be affecting CubeCart's performance.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...