38 replies [Last post]
coming's picture
Offline
Joined: 04/12/2008
Juice: 18
Was this information Helpful?

Hello,

I have just installed ubercart on my site, it's great. But when I try to test if it works, it shows a message below: "There are no products in your shopping cart". I try on the ubercart.org site with "Livetest", it show the same message. Would somebody can explaine me what is happen? Thanks for your help.

Wang

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: "There are no products in your shopping cart.,". Why?

That's what happens if you have cookies disabled in your browser.

<tr>.
coming's picture
Offline
Joined: 04/12/2008
Juice: 18
Re: Re: "There are no products in your shopping cart.,". Why?

Thanks TR. I understand now.

coming's picture
Offline
Joined: 04/12/2008
Juice: 18
Re: Re: "There are no products in your shopping cart.,". Why?

I have just checked my browser, the cookie is accepted. But my ubercart still shows the message :"There are no products in your shopping cart." when I checkout. I don't know why. Please help me to resolve the problem. Thanks.

Andy's picture
Offline
Administrator
Joined: 08/07/2007
Juice: 1076
Try a different browser.

Perhaps it is browser related. It is odd that it happens for you in both livetest and your own site. Try other Ubercart installations from the Live Sites list and see if you have the same issue. If so, then try it from a different browser on a different machine on a different network connection if possible. If it works on the different browser, it is probably a compatibility issue. Either way, please tell us what version of what browser you are using.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Try a different browser.

Drupal works just fine, it's only Ubercart? Are you logged in, or adding to cart as an anonymous user? Do you have anonymous checkout enabled? If you post the URL of the site you are setting up we can test it from here and see if it works for us.

<tr>.
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Try a different browser.

Maybe he's just really not adding any products to the cart. Sticking out tongue

Could it be a proxy issue or something else that keeps you from having a consistent session ID at the server?

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Try a different browser.

We just had a customer email us with having the same issue. Trying to get more information out of them.

--
Help directly fund development: Donate via PayPal!

NecroHill's picture
Offline
Joined: 08/12/2008
Juice: 107
Got a same problem

hi mate, have you resolved this issue?
because I've got the same. the odd thing is that its ok on localhost, but on the server its not.
Please advise...

RoloDMonkey@drupal.org's picture
Offline
Joined: 03/02/2009
Juice: 34
Re: Got a same problem

I have seen this when I was trying to hack my dev environment to use an SSL cert that was on a test machine.

Going directly through the dev domain name worked, but when I tried to tunnel from the test machine to the dev machine, the session cookie wouldn't stick.

I hope that helps someone.

justindodge's picture
Offline
Joined: 12/18/2008
Juice: 16
Re: Re: Got a same problem

I was having the same issue on my site, but was baffled for a bit because the problem seemed intermittent. Half the time I would go to checkout everything would be fine, the other half: "no products in your shopping cart".

Finally I solved the problem:
The secure pages module is was configured to use SSL for /cart and all it's sub pages, but the base URL didn't include a www, because that's how I had my SSL certificate setup. If users came from mydomain.com, added a product, and went to checkout, everything went fine. If they went to www.mydomain.com and did the same thing, the session cooking would get lost going from http://www.mydomain.com to https://mydomain.com

I was using the cart links module to add products to the cart, so my solution was to have the add link explicitly specify no 'www'. in the URL. This way, when they were redirected to the cart form, it went from http://mydomain.com/cart to https://mydomain.com/cart/checkout without a hiccup.

jefkin's picture
Offline
Joined: 06/23/2009
Juice: 22
sites/default/settings.php to the rescue

Another option, Justin,

edit your sites/default/settings.php

Around 150 lines down the file should be a section about Drupal's unique session cookies.

Uncomment the code that looks like this:

<?php
# $cookie_domain = 'example.com';
?>

and edit it to this:

<?php
$cookie_domain
= 'mydomain.com';
?>

This should solve all your woes regardless of which address is used to access your site.

Jeff

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
jefkin wrote: Uncomment the
jefkin wrote:

Uncomment the code that looks like this:

<?php
# $cookie_domain = 'example.com';
?>

Jeff, NICE TIP!! Fixed a bunch of my log-in problems I've been (ignoring) for a loong time Smiling

Thanks
Mike

twooten's picture
Offline
Joined: 05/19/2008
Juice: 25
Re: sites/default/settings.php to the rescue

I've been tracking this bug forever and finally stumbled across this post. I'm using Secure Pages in my clients site and have been getting reports of this happening periodically for the past few weeks, "no products in cart".

I could never reproduce it until this morning and finally realized that Secure Pages was the problem. Actually it's not a "problem" because it does exactly what it is supposed to do.

Anyway, just wanted to offer another solution to this other than the settings.php one. I used rewrite rules in my .htaccess file to force everything to go to the www instead of the non-www URL.

Use the following.

  RewriteCond %{HTTP_HOST} ^YOUR-SITE\.com$ [NC]
  RewriteRule ^(.*)$ http://www.YOUR-SITE.com/$1 [L,R=301]

Hope this helps someone.

Tim

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Re: sites/default/settings.php to the rescue

Yah you have to do that other wise when the url changes from www.yoursite.com to https://yoursite.com it'll empty your cart.

NecroHill's picture
Offline
Joined: 08/12/2008
Juice: 107
Re: "There are no products in your shopping cart.,". Why?

Make sure that you have user with uid = 0
I just figured out why I had this issue, but have no idea why user with uid 0 just disappeared from my DB Smiling

gscerb's picture
Offline
Joined: 05/06/2008
Juice: 29
solved

user with userid = 0 solved the problem for me.

http://www.ubercart.org/forum/support/8535/products_disappear_cart_when_...

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1057
gscerb wrote: user with
gscerb wrote:

user with userid = 0 solved the problem for me.

http://www.ubercart.org/forum/support/8535/products_disappear_cart_when_redirected_cart

Can someone reply back with the exact database query to run to insert user 0 into a Drupal database? I am just nervous when it comes to user data.

Thanks
Mike

jrchew's picture
Offline
Joined: 07/27/2009
Juice: 14
worked for me

Added uid 0 to the DB. Lifesaver! Wonder why uid 0 was missing?

Thanks NecroHill!

deepakg83's picture
Offline
Joined: 07/24/2009
Juice: 187
Re: worked for me

uid 0 is required for anonymous users, as all the anonymous users have a UID 0 . in case UID 0 is not present , add it using insert query.

Deepak Gupta

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: worked for me

I saw that happen once, long ago during one of my first Drupal installs. I think it had to do with trying to re-import the database or something - for some reason it didn't like inserting NULL values (or possibly values of 0 due to some weird MySQL condition). It's not entirely uncommon.

--
Help directly fund development: Donate via PayPal!

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: worked for me

There's a setting for MySQL to use the autoincrement value when you insert a 0 into a column. I'm not sure if it's a good idea or not for normal Drupal use, but it certainly causes problems when importing the users table.

jefkin's picture
Offline
Joined: 06/23/2009
Juice: 22
MySQL dump

Regards user imports and the 0 uid, use MySQL dump to create a sql file for your DB, then feed that file into your new db.

I've known about that (0) => next autoincrement issue for a while, but when doing a full dump and restore, all that juice is turned off.

this is the ssh command line I use:

mysqldump --add-drop-table --allow-keywords --quote-names -v -hhost -uuser -ppass database > dump-08-11-2009.sql

Obviously replace host, user, pass and database with your details. To install in a new database use:

mysql  -v -hhost -uuser -ppass database < dump-08-11-2008.sql

Never failed for me.

Good luck

simg's picture
Offline
Joined: 10/16/2009
Juice: 13
Same problem, but fixed

Hi Guys, I've had the same problem with the empty shopping cart for anonymous users.

A quick check of the users table revealed that my anonymous user had a uid of 3. Changed it to 0 and the shopping cart worked fine.

Ubercart is an *awesome* bit of software - many thanks to the developers Smiling

qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
UID 0

I'm having this same problem of intermittent drops of items in cart on checkout for anon users. Not sure it's SSL related as mentioned above, but am looking at at UID 0.

I'm not an expert at all this. But I look at the UID 0 in the database and there is no name associated with it. It's blank. Is that what it's supposed to be? Is it supposed to say "anonymous" or "anon" or "anonymous user" is it supposed to be blank.

Quint

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
No, that's correct. You

No, that's correct.

You might also look at my issue here: http://drupal.org/node/679422

--
Help directly fund development: Donate via PayPal!

storm's picture
Offline
Joined: 05/06/2009
Juice: 11
Just thought I would share my stupidity :-)

Take a look at the code I "lifted" (to make the quantity field in the cart "read only") without paying enough attention (this goes in hook_form_alter):

<?php
case 'uc_cart_view_form':            
  foreach (
$form['items'] as $k => $item) {
    if (
is_array($item) && isset($item['qty'])) {
     
//$form['items'][$k]['qty']['#attributes']['disabled'] = "disabled";
     
$form['items'][$k]['qty']['#attributes']['readonly'] = "readonly";
    }
  }
  break;
?>

If you stole the same piece of code as me, you will notice setting the disabled attribute is a bad idea. Moral: If you want to be able to checkout, use readonly (or maybe someone here has an even better suggestion).

esbon's picture
Offline
Joined: 09/28/2010
Juice: 12
#23

Would you please let me know where that code is?

Tristan_a1's picture
Offline
Joined: 07/01/2010
Juice: 19
Re: "There are no products in your shopping cart.,". Why?

I am also having this problem with anonymous users getting "There are no products in your shopping cart.".

Where do i find the file i need to edit the user id and change it to 0?

simg's picture
Offline
Joined: 10/16/2009
Juice: 13
Re: Re: "There are no products in your shopping cart.,". Why?

It's not a file you need to edit, it's a "row" in the users table in the database ...

markinAz's picture
Offline
Joined: 11/24/2010
Juice: 6
Same problem fixed for me

I just wanted to say the problem was fixed for me when changing the UID of the default user to 0 (it was 3). And I really wanted to say THANKS to the guys developing this module and that I will donate via PayPal once I make some money on the store I'm setting up! Eye-wink

krauseinafrica's picture
Online
Joined: 05/19/2012
Juice: 15
Tried the UID thing

I have read a bunch of forums on how to correct my inability to add items to my cart... check out: http://ripleystuff.com/vt/monogram/products

You can then select one of the hats... choose add to cart and it shows up with the no items in your cart!

I have looked into the UID=0 but that looks fine. I have unchecked my boost module I installed. If I am logged in as an administrator then it works fine. I also have anonymous users can checkout checked too!

My client is not very happy with me so any assistance would be much appreciated!

Thanks,

Robert

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Tried the UID thing

Have you cleared your cache after disabling the boost module? I had this issue on a new install but that was years ago with UC1. Which UC version are you using? Secure Pages modules installed? Any error messages in Drupal or in Apache logs?

krauseinafrica's picture
Online
Joined: 05/19/2012
Juice: 15
Re: Tried the UID thing

I have cleared my cache...

I have not, however, not installed Secure Pages because I process payments through Paypal. Ubercart 6.x-2.7

I checked my logs but did not see any errors. I have attached one of my error logs though just to make sure I have not overlooked something.

AttachmentSize
apachelog.txt 47.67 KB
end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Re: Tried the UID thing

do you have anything in the drupal logs? admin/reports/dblog

krauseinafrica's picture
Online
Joined: 05/19/2012
Juice: 15
Re: Re: Re: Tried the UID thing

Thank you end user for your persistence. I have attached the most recent page of errors in my drupal log.

AttachmentSize
Drupal Log.pdf 136.54 KB
end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Re: Re: Re: Tried the UID thing

Actually before we get too deep into it. Can you change the theme to a theme that comes stock with Drupal like Garland or Bluemarine and try out the cart with that theme...

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Re: Re: Re: Tried the UID thing

....

end user's picture
Offline
Joined: 01/11/2008
Juice: 1198
Re: Re: Re: Re: Tried the UID thing

...