I updated to the new UC 6.x-2.7 from 2.6 today and the ajax cart stops working correctly. When adding a product to the cart, the modal messages tell me that the product was added, but the cart on the page doesn't get updated until I refresh the page and then I can see that there are items in my cart. Also, clicking "remove product" on the ajax cart, won't remove the item.

This was all working before the upgrade of UC-core

Comments

same issue
change to jQuery 1.4.4 and ajax_cart works again.

The latest jquery version available for D6 is 1.3.2. Can't upgrade to 1.4.4 w/o either hacking core or hacking the jquery_update module: http://drupal.org/project/jquery_update

Shouldn't D6 modules run on whatever version of jquery is available to D6?

Title:Updating to Ubercart 6.x-2.7 Breaks Ajax CartUpdating to Ubercart 6.x-2.7 breaks Ajax Cart
Assigned:Unassigned» tunic
Priority:Critical» Major

I can't reproduce this bug with Ubercart 2.7. Can you provide more info? What's your UC Ajax Cart settings? What kind of products are adding? Products with attributes? Same products with different attributes? Just any kind of products?

It's confirmed that Ubercart 2.7 seems to break anonymous cart when cache is enabled.

Priority:Major» Critical

Raising to critical again.

Really Ubercart 2.7 breaks anonymous cart when cache is enabled !

And it seems that there is still no way to use cache with the core Ubercart cart (please tell me if you have found), so...

I decided not to show the cart in the menu anymore as it looks especially ugly when customers add many items, then the menu is too long...

And actually you can check many famous shops as Amazon: they do not show the cart content on every page !

Just my experience, but i really don't want to have to fight with these useless problems anymore.

subscribe

What Tunic Said...

subscribe

Status:Active» Needs review
StatusFileSize
new1.66 KB

It seems to be a cache handling issue. I've changed cache clearing mechanism to use same as Ubercart, see this issue: [#http://drupal.org/node/1059228]

I need testing on this patch, it works ok in my test installation. Could any of the reporters test it?

subscribe

Another possibility is to disable caching on both client and server:

diff -urbNP uc_ajax_cart.orig/uc_ajax_cart.module uc_ajax_cart/uc_ajax_cart.module
--- uc_ajax_cart.orig/uc_ajax_cart.module       2011-08-04 00:01:30.000000000 +0400
+++ uc_ajax_cart/uc_ajax_cart.module    2011-11-07 13:32:27.430684980 +0400
@@ -88,6 +88,10 @@
}
function uc_ajax_cart_callback($op, $nid = NULL, $data = NULL) {
+  global $conf;
+  $conf['cache'] = FALSE;
+  header('Cache-Control: private, no-cache, no-store, must-revalidate, max-age=0');
+  header('Pragma: no-cache');
   $cacheEnabled = variable_get('cache', 0);
   if ($cacheEnabled > 0 && !$user->uid) {

Additionally, to prevent the client side caching, it's better to use unique URLs (with timestamps) for AJAX GET requests.

Assigned:tunic» Unassigned

#10 and #12 work.
It does not work update the number of pieces of position on the cart page.

Subcribe.

#12 maximpodorov it sounds good, I'll add that lines. Have tried my patch? did it worked for you?

#13 I don't undestand you, can you explain it? position? Yuu mean that item number is not updated? It works ok on my test site...

i'm using cacheexclude module as a workaround solution.
just put "uc_ajax_cart/show" in exclusion.

#14 Sorry my bad english (i use google translate).
I am testing site http://indinotes.com
On the cart page not always update count of product in row.
(ie. i change count of product from "5" to "3" items and count changing not always)

#10 and #12 work identically with this problem.

#16 Are you using Ubercart 2.7 and Uc Ajax Cart 2.0? Are you using another modules related to caching, secure pages or something like this?

I'm unable to reproduce this bug when #10 patch is applied. Please post your Uc Ajax settings to try to reproduce it.

StatusFileSize
new5.15 KB
new37.73 KB

Ajax Driven Cart 6.x-2.0, Ubercart 6.x-2.7.
All cache is on (Minimum cache lifetime - 1 hour, Caching mode - Normal).

Tunic's patch in #12 works when caching is set to normal and updating from within the ajax cart is disabled and ajaxifying the main cart is disabled as well.

patch in #12 works for me.
subcribe.

I was also having this issue after discovering the module today, #10 solved it. Didn't apply #12 since tunic was going to roll that in with his other updates, it seems?

I don't have clear best solution; is not a solution for juliv, rhmtts says #10 works just with certain configuration, #20 says #12 patch is good.. I'm a little bit confused. I'm under a heavy work load so I couldn't test to figure it out.

I hope I can test soon. Meanwhile you can use the patch have your site working. Sorry for being so late.

#10 worked for me as well.

I was experiencing the problem only for anonymous users, ajax cart block was just simply not updating when items were added to cart however if you navigated to the cart page the items were there. My ajax cart settings have 'ajax support for anonymous users' enabled as well as 'Ajaxify cart page' enabled. I applied #10 patch and the ajax cart block is now so far working as it should.

I would like to confirm that this patch indeed works, as the current August 25, 2011 D6 release was still not letting me see my cart if I was an annonymous user.

Any chance that this patch can be released for the next D6 version of Ubercart Ajax Cart

StatusFileSize
new951 bytes

I found my problem.
JQuery function commented out "Trigger submit button when cart qty form input elements are changed.".

    // Trigger submit button when cart qty form input elements are changed.
    /*
    jQuery('#uc-cart-view-form .qty input', context).not('.ajax-cart-processed').bind('change', function (e) {
      triggerCartSubmit();
      return false;
    })
    .addClass('ajax-cart-processed');
    */

Now I have everything working correctly: ajax page & block.
Work with any path (#10 or #12).

StatusFileSize
new1.07 KB

Small update function in previous comment and save original work of js-script.

Status:Needs review» Fixed

Committed #10 and #12 to dev.

#26 (Juliv) your patch changes event trigger from change to blur, and calls ajaxCartSubmit directly. Trigger change means that if you focus quantity field but make no changes update will be triggered alhough is not needed because there're no changes. I need an explanation that convinces me to make this change.

Also, with your patch the popup message is lost (but not the title).

Please open a new bug report and describe your problem because it seems not be related with caching.

Well done, when is next stable release? I'm using dev release right now.

#28 I'd like some feedback from dev version prior to release a stable release. Have you tried the recent dev? did it worked for you?

Instead of using patches, #15 works like a charm !!

My problem was that upgrading to Ubercart 6.x-2.7 once again broke this module: anonymous user just kept seeing 'loading cart'.

The module in #15 solved that in a second without messing with patches.

Seems Ubercart always seems to mess up the cache problem ....

I used the latest dev version but anonymous ajax cart still not working... When you add a product to the cart it doesn't add it to the ajax block or to the actual cart.

This is why I quit using this module.

Many famous shops don't have an Ajax cart, so why would we need one that is source of problems...

#29 and #31 worked for me, but I just realized it's not working for anonymous users. Not stable yet.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Closed (fixed)» Needs review

Per the report in #33 by sourcesoft, I'm marking this as "needs review" just so it doesn't slip off the active issues queue. I'll try to review it myself soon and see if it's not working for anonymous users or not. In the meantime, perhaps others could confirm or refute sourcesoft's findings...

Status:Needs review» Active

Reverting this back to active.

Updated very latest dev version (2012-Mar-26) and configured UC Ajax Cart as defined in "Using UC Ajax Cart just to get anonymous cart block with cache". Able to confirm that UC Ajax Cart works as expected with anonymous users when only Drupal's block caching is enabled. But does not work if/when page caching is enabled.

Similar problem here, 6.x dev release 2012-Mar-26.

Anonym users can add to cart and products show up in cart block and cart page. When you go to checkout the product are gone. NUT, it only happens first time, if I try to add another product it works. Can be reproduced over again by clearing browser cache and cookies. Can be tested now at www.tastespot.com .

Think I maybe have found the problem, but not got time to look for a solution yet... my checkout page is a secure page, rest of site is not secure. Looks like the cookie holding the cart items does not work first time you go to the secure page.

Reading all the new issue reports had me worried so I went back and did some testing on my site as an anonymous user and everything checked out ok for me. Ajax cart has been working great since I applied patch from #10. My configuration options are as mention in #23. I have not changed to dev version but am still using ver 2.0 with applied patch. It may also be important to note that I am using the secure pages module and have only the cart page with SSL.

The only issue that I did run into was with changing the quantity of an item on the cart page. I only noticed this issue when shipping quotes cart pane is also enabled. When updating the qty it would refresh page and shipping quote pane would disappear.. after that changes would work as expected. As I am using this module more for the block features I just disabled the ajaxify cart page feature.

Note though that I do not believe this issue is the same as described in this bug report as it only presented when the shipping quotes pane was present. It may be that if you're still experiencing this issue after applying the #10 patch that you may have another module enabled that is also altering cache handling? Try posting any modules you have enable that might be affecting this and maybe we can find a pattern.

Other than that try out the add to cart on our site to confirm that this module is in fact working with the configuration described. Url to our sites store is www.veilep.com/theme-store - if you notice any issues from your environment please reply and let me know.

Assigned:Unassigned» stewart.adam

Just to keep everyone in the loop, uc_ajax_cart recently switched maintainers and although we are still seeking new co-maintainers, I will be looking into testing critical bugs (such as this one) as soon as I can. Thank you for being patient and helping test uc_ajax_cart! It is very much appreciated.

hi

i use

Ubercart 6.x-2.9 and
Ubercart AJAX Cart 6.x-2.0+11-dev (2012-Apr-10)

with caching set to normal and ajax cart works for anonymous users.

thanks for this great module.

Status:Active» Reviewed & tested by the community

Agreed. Just to be sure, I tried upgrading to just Ubercart 6.x-2.9. As previously reported, it wasn't working.

With the latest dev version of uc_ajax_cart, it once again worked.

Would be great to see this pushed to a full release as this is naturally a pretty critical issue.

Thanks for marking this as tested, my local tests confirm it does work with 2.9 as well. I am working on a few other major bug fixes / module clean-up and plan on releasing shortly.

Hi,

I've been experiencing the same issue and so I've just updated to:

Ubercart 6.x-2.9
Ubercart AJAX Cart 6.x-2.x-dev

but the issue is still occurring. Irregular behavior when updating quantities in the cart (basically quantities are just not updating at times)

I have tried using the cacheexclude module, excluding "uc_ajax_cart/show" but still having the same problem.

There are so many different solutions above... does anyone have a final fully tested solution or a configuration?

Many thanks for your help.

Can anyone help on my comment above please? Really need to get this issue sorted.

thanks!

Just to make sure, you're using the latest dev from May 31? Also, what procedure are you using to test if the quantities update correctly? I recently committed a few patches to fix updating the product quantities on the cart page that was not related to caching. After adding items to the cart, does the cart block update immediately? On the next page load, does it retain the new/updated quantities?

I had this issue with Ubercart 6.x-2.9 and Ubercart AJAX Cart 6.x-2.0-rc4 (same as 6.x-2.0 according to the notes)
Upgrading to Ubercart AJAX Cart 6.x-2.x-dev fixed the problem.
New items are added immediately. Quantities are updated immediately too. No need for any page refreshes. Good work!
You can see it in action here http://bargainboatbits.co.nz/ (production site so beware).
Thanks

I can confirm that this now works perfectly when using:

ubercart 6.x-2.6, and
UC AJAX cart 6.x-2.0

See it in action at http://buddabag.es/

Many thanks for your help!

ryaner - have you used the 6.x-2.1 version yet and is this branch working for you? Also out of curiosity, with the problem you were experiencing on the cart page, did you also happen to have the shipping quotes block enabled at the time?

Version:6.x-2.0» 6.x-2.1
Status:Reviewed & tested by the community» Fixed

This was fixed and committed in the 2.1 release:

http://drupal.org/node/1619586

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.