Ubercart "buy it now" button does not work 90% of the time all of the sudden.

I'm trying to give as much info as I can think as relevant, I'm not a drupal or ubercart expert by any stretch, but I've made do on my site, anibit.com for the past year.

When on a catalog view page, the "add to cart", (eg, using the "buy it now" form) does not not add anything to the user's cart 90% of the time. It seems to be inconsistent in that I can do the same action on the same page, and once in a while it works. The "add to cart" button on individual product pages work fine.

I had suspected cache issues, I use memcache, and page caching (block caching forced disable by drupal). I tried disabling and flushing all caches, and disabled memcache to no effect.

This issue affects logged in and anonymous users alike.

This was working for certain a month ago, and I'm slightly less confident it was working two weeks ago. No users reported the issue, I discovered it myself about 3 days ago. I generally keep up with module updates on a weekly basis, but I didn't keep a log of what specifically I have upgraded recently, but there was a minor drupal core update at least.

I realize the problem may not be with UC at all, but I'm at wit's end, not sure where else to look, or what to test. Given that the product page button works 100% and the catalog view version of it does not, it leads me to be suspicious though.

Thanks in advance!
--Jon

P.S. Please let me know if there is anything else I should add that might be helpful, or some technique for tracking this down.

Comments

anispider’s picture

I didn't post the full url for fer of being marked as spam, but you can see the behavior here: https://anibit.com/catalog/all-products?page=1

(I'm also having some moderate server performance issues at the moment too, but it's hardware related)

TR’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

It worked fine for me first time in, but as I tried to repeat the exercise it started failing every time.

This problem is most likely due to Views caching, which doesn't work with the Drupal Form API because when the unique form-id is cached, core Drupal form validation will fail. Add-to-cart buttons are just submit buttons for the form, and you have one form per row in your View. Turn off caching on the View and it should work. See #1777452: Add To Cart in Cached View doesn't update cart.

Your site has some major performance problems. With a small site and low load, there ought to be no performance issues at all, and no need for memcache or aggressive page caching or anything like that.

anispider’s picture

Thanks. I thought I had disabled views caching. (and later re-enabled when it didn't seem like it fixed it). I will double check that. Your analyses makes sense though.

re: the performance issues, that's been my demon lately. I'm pretty sure it's my host, and not anything I'm doing because when I complain to my service provider, it gets a lot better for a little while. The performance issues started creeping in a couple months ago. I also run a Docuwiki instance on the site, and that sees similar performance drops. It's on a shared host, and I'm going to be moving it to a different host soon. You are right, the performance is ridiculous.

anispider’s picture

Removing the cache on the catalog view itself fixed the issue. Thank you so much for the guidance.

Previously, I had disabled "administration/structure/views/settings/Advanced/Disable views data caching" which did not fix the problem.

anispider’s picture

Should I mark this closed(won't fix) ?

anispider’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
millionleaves’s picture

Adding a link to this issue.

https://www.drupal.org/node/723804

It looks like there are two scenarios where this Add to Cart bug can arise:

  • Views cacheing is enabled for the view
  • You are using Global Random to generate a random list of products each time the page loads.

The link points to a discussion which provides a workaround for the second scenario.