Hi,

The setting for: uc_ajax_cart are attached.

Up until now when adding products to the ajax cart, they were added for both guests and registered users. now only registered users can add. I checked my permissions and everything and could not figure out the problem.

Did I miss something?
Thanks,
Vanessa

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tunic’s picture

Category: bug » feature

I can't reproduce the bug with your posted settings, but you missed the last lines, 'Ajaxified products'. It should be 'Ajaxify all Ubercart products'. Do you have that setting this way?

And... whehn you say that "now only registered users can add" what it means? Do you see an error message when an unregistered user try to ad? They just can't see add to cart buttons? You push the button and nothing happens?

Also, are you using a custom theme? if yes, please try with Garland theme to check if a theme-related problem.

As I can't reproduce I change it to support request.

VanessaM’s picture

Category: feature » support

- The 'Ajaxify all Ubercart products' option is checked
- The 'add to cart' button does appear but when clicking it, a message appears noting that the product has been added but nothing displays in the shopping cart. There are no error messages. Only when I log in as an authenticated user and click the button, the products do get added immediately.

I switched to the Garland theme and there was no change in behavior.

I suspected that the problem was cache as products I added yesterday suddenly appeared this morning. After changing some of the Boost settings I got it working again.

This can be closed.

Thanks!

tunic’s picture

Can you post your Boost settigns that makes Uc Ajax Cart to work with Boost? So other people can have these modules work together... or did you just remove these paths from boost caching?

uc_ajax_cart
uc_ajax_cart/*
VanessaM’s picture

Attached.
I set the: "Boost - Static page cache:" to disabled

tunic’s picture

Status: Active » Fixed

Thanks for te info.

com_net’s picture

Status: Fixed » Active

"I set the: "Boost - Static page cache:" to disabled" -- this means that You completely switched off the Boost module.
Anyone else managed to get to work Boost+Ajax Cart?
---
I see very strange bug: when guest adds something to his cart - ajax cart refreshes, shows correct content... and then refreshes another time - with returning to old cart content. On /cart page - everything is ok, new cart content represented.
Example: http://www.legrand1.budka.ru/

Erik Seifert’s picture

Good old Browser cache ;- (

Please try this on.

Go to uc_ajax_cart.module.

Add this line in Line 112

    case 'show':
      uc_ajax_cart_show_cart();
    break;
    case 'show':
      header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
      header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
      uc_ajax_cart_show_cart();
    break;

Please give feedback if this works. Thanx.

com_net’s picture

All my tests were carried out with disabled caching on the client side. Nevertheless, I followed your advice: as expected - nothing has changed. For a split second after the page load you can see correct cart contents, and then it replaces with the wrong, which statically cached on server. You can see this effect following the link http://www.legrand1.budka.ru/catalog/legrand-valena

Erik Seifert’s picture

Hmpfff,

@tunic

How about making adding a parameter to our cart urls.

Like

uc_ajax_cart/show-cart-view/?t=111113123
Erik Seifert’s picture

Now you got a js error

Fehler: uncaught exception: Syntax error, unrecognized expression: [@title]
tunic’s picture

I thought that removing UC Ajax Cart paths from boost caching was enought:

uc_ajax_cart
uc_ajax_cart/*

I'm not used to Boost, but I UC Ajax Cart paths are excluded Boost shouldn't handle these request, so right data should be retrieved ok by Ajax calls. May be we have two issues at same time?

@erikseifert It would be easy to add that parameter, for example, take ajaxCartUpdateBlockCart function in uc_ajax_cart.js and substitute this line:

Drupal.uc_ajax_cart.update_container.load(Drupal.settings.uc_ajax_cart.SHOW_CALLBACK, '', ajaxCartInitCartBlock);

By this:

Drupal.uc_ajax_cart.update_container.load(Drupal.settings.uc_ajax_cart.SHOW_CALLBACK + '?nc=' + Math.floor(Math.random()*1000000001), '', ajaxCartInitCartBlock);

(Just add Math.floor(Math.random()*1000000001) to the call).

I guess that parameter should be added to every path called by UC Ajax Cart, but I'm not confortable with that solution. I think there's is something more we can do.

It may be related to this bug?
#679422: hook_exit() causes Ubercart "Add to Cart" to fail

ehudash’s picture

I have the same issue.
Using Boost and Ajax Cart 6.x-2.0-rc3.
Boost - Static page cache: ENABLED
Statically cache specific pages except:

cart*
checkout*
Erik Seifert’s picture

please add this url's to boost:

uc_ajax_cart
uc_ajax_cart/*
armyofda12mnkeys’s picture

uc_ajax_cart
uc_ajax_cart/*
for BOOST exclude settings seemed to work for me

tunic’s picture

Status: Active » Fixed

Ok, so finally:

- set 'Statically cache specific pages' Boost option to 'Cache every page except the listed pages' and set pages to:

uc_ajax_cart
uc_ajax_cart/*
VanessaM’s picture

excellent! thanks a lot. It is working fine for me now.

Status: Fixed » Closed (fixed)

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

MakeOnlineShop’s picture

I have the same problem of products not added to card even when I'm not using boost, any idea ?

Thanks for help.

halloffame’s picture

+1 #18.. Having the same problem but not using Boost Module

@make-online-shop How did you go about doing this?

MakeOnlineShop’s picture

I'm not using it anymore... not worth the pain, customers are good enough to click on cart to see the cart page !

globaltask’s picture

In case someone is till facing the issue and it's not fixed by changing Boost values or disabling it, the reason could be the anonymous user is missing in the users table.
In order Ubercart to work for anonymous users, the users table should have a user with ID: 0 and name: Anonymous.

Hope it helps!

adams780’s picture

Issue summary: View changes

I have the same issue, and don't use the Boost module. When you say the reason could be that anonymous user is missing in the users table, do you mean the users table in my site's drupal SQL database? I just checked the database, an sure enough there is not a user with the name Anonymous and/or an ID of 0.
Can/should I add that user through the drupal interface (if so, how)? Or do I have to add that user directly through the database (through phpMyAdmin)?

drupalinthailand’s picture

Anonymous do not have any name, the line is empty, they are not called anonymous, on drupal 6 at least.

You can create in in mysql:

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

I tried, it works.

More_well’s picture

Here is my solution:

Go to DB and check if have a row in users ->

1. SELECT * FROM `users`

2. Check do you have user with id = 0 ( uid column ) ;

If doesn't have it

-> put this sql ->

INSERT INTO `users` (`uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `created`, `access`, `login`, `status`, `timezone`, `language`, `picture`, `init`, `data`) 
VALUES ('0', '', '', '', 0, 0, 0, '', '', 0, 0, 0, 0, NULL, '', '', '', NULL);

and click Go