13 replies [Last post]
jason.williamson's picture
Offline
Joined: 01/15/2009
Juice: 12
Was this information Helpful?

HELP! Im pulling my hair out on this one!
I have just discovered the when people access my shop from Internet Explorer, that the products dont stay in the cart when you are redirected to the cart, in other words when they click "Add to Cart" and are redirected to the View Cart page you get a message saying cart is empty!

It works fine for me on Firefox3 so I can only assume this is a Internet Explorer problem (And due to me being on a mac i cant check it for myself!)

Not sure if related (but suspect it is) people also cant login to the website either. Due to this i thought it might have be a problem with them not having cookie enabled but they have told me they are definatly enabled!

PLEASE HELP! Im trying to get this site ready for launch and this isnt doing my head it!

THANK a million!

If it helps here is the site: http://c_nz.alpha.org/resources

benko's picture
Offline
Joined: 01/14/2009
Juice: 66
Re: Products disappear from cart when redirected to cart

This almost certainly sounds like a cookie issue. Im fairly new to Ubercart but if they cant add to cart or login that would be my guess.

Can you replicate the problem in Internet Explorer? If IE works for you but not someone else my guess would be a cookie issue.

Sorry I couldnt be more help Smiling

jason.williamson's picture
Offline
Joined: 01/15/2009
Juice: 12
Re: Re: Products disappear from cart when redirected to cart

Thanks for the reply, but as i stated although it sounds like a cookies thing ive been told by effected parties that they have cookie enabled. Unfortunately i have to take there word for it as im on a mac so cant view on IE

Thanks

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Products disappear from cart when redirected to cart

If you have access to a Win XP disk, you should install Sun's VirtualBox and setup a Windows virtual machine. I use it for testing on Windows w/ IE and Chrome, and it works like a charm! Even lets me play some PC games w/ reasonable performance.

ransomweaver's picture
Offline
Joined: 01/23/2009
Juice: 10
I also have cookie problems

Anonymous purchase on the site I'm working on now (UC 6 2 beta3, Drupal 6.9) is failing to get products to show in the cart. The product gets into uc_cart_products e.g. cart_id = 9835f184103891b7c028a2c0f6a9f97f
and FireBug shows the GET cart like so (200 OK)

Response Headers:
Date
Mon, 26 Jan 2009 20:05:44 GMT
Server
Apache/2.0.52 (CentOS)
X-Powered-By
PHP/5.2.6
Expires
Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified
Mon, 26 Jan 2009 20:05:44 GMT
Cache-Control
store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection
close
Transfer-Encoding
chunked
Content-Type
text/html; charset=utf-8

Request Headers:
Host
[mysite].com
User-Agent
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.0.5) Gecko/2008120121 Firefox/3.0.5 Ubiquity
/0.1.4 FirePHP/0.2.1
Accept
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language
en-us,en;q=0.5
Accept-Encoding
gzip,deflate
Accept-Charset
ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive
300
Connection
keep-alive
Referer
http://[mysite]/cart
Cookie
SESSb12e25856aeaf41360a01a0a2824f128=4of6gqbprbdpnoja9e8rg2ier5; SESS2bcc5d8a09fb7f669e75fae89c874023
=tg15a3klpjs4v01mv7uimtrs52; has_js=1

Seems like this ought to be a reference to the cart_id in uc_cart_products but its not?

I've not seen this work on any system or browser. Everything is working great with logged in user.

the cookie is definitely set as I checked that in FireFox privacy pane, matching the above.

ransomweaver's picture
Offline
Joined: 01/23/2009
Juice: 10
digging further...

Looking deeper I see that when the anonymous user adds to cart it makes two db entries:
1) table sessions receives the cookie for the domain in field sid and in field session gets something like this: uc_cart_id|s:32:"0e3f8173db57ebafe4ef7d76dc0823d0";
2) table uc_cart_products gets the product in field data and in the cart_id field a 32 digit string THAT IS DIFFERENT from uc_cart_id in (1).

deleting the cookie results in a new cookie and an new nonmatching cart_id in uc_cart_products.

Now I'm going to start digging for the code that creates the cart_id....

Abilnet's picture
Offline
Uber DonorBug Finder
Joined: 12/28/2007
Juice: 718
Re: digging further...

Just fishing... but during the check out, does the domain change to an other and that's why cookies are not recognized? (I mean "http://" to "http://www" or "https://" or something...)

ransomweaver's picture
Offline
Joined: 01/23/2009
Juice: 10
nothing in cart - anonymous

No, no domain change. I think the implication of my last post is that for me this is NOT a cookie problem, since I've correlated the cookie in the browser and what is saved in Drupal table sessions. This may not be the case for the original poster. For me I have to figure out why the uc_cart_id in the sessions data doesn't match the cart_id in table uc_cart_products. Am I right to assume it should just be comparing those strings? one is type longtext and the other text. one isn't encrypted/hashed or something? maybe I should repost this problem as its own topic?

ransomweaver's picture
Offline
Joined: 01/23/2009
Juice: 10
Session variables?

I wonder if my php SESSION handling is not right. after trying to add to an anonymous cart I try drupalforfirebug php execute print serialize($_SESSION) and I get a:0:{}. So $_SESSION['uc_cart_id'] is not set when tested here:

function uc_cart_get_id() {
global $user;

if ($user->uid) {
return $user->uid;
}
elseif (!isset($_SESSION['uc_cart_id'])) {
$_SESSION['uc_cart_id'] = md5(uniqid(rand(), TRUE));
$_SESSION['newcartid'] = $_SESSION['uc_cart_id']; // my own test in case this is unset elsewhere
}

httpd.conf for this directory is set AllowOverride All and it has a standard drupal .htaccess

Here is my phpconfig() from inside the drupal dir (just the session stuff)

Session Support enabled
Registered save handlers files user sqlite
Registered serializer handlers php php_binary wddx

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /var/lib/php/session /var/lib/php/session
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0

Also, I can make my own session vars in the drupalforfirebug php execute console, and trace them back out with serialize, but when I navigate to another page they are gone...

ransomweaver's picture
Offline
Joined: 01/23/2009
Juice: 10
Resolved!

For some reason I had no user 0 in my drupal users table. after adding this and clearing cache table things started working for the anonymous shopping. In the absence of user 0 I think UC didn't think it was logged out. for sure uc_cart_get_ID was failing to set $_SESSION'uc_cart_id']

I <3 Drupalforfirebug

valtx's picture
Offline
Joined: 03/18/2010
Juice: 18
I've seen this

Just fishing... but during the check out, does the domain change to an other and that's why cookies are not recognized? (I mean "http://" to "http://www" or "https://" or something...)

I've been trying to solve this same (or similar) problem, which happens to only a few users, and I have seen this.

I had a user add an item to the cart, then go to checkout, but get the "there are no items in your cart."

After talking to this user, I found that when she was clicking checkout, it was redirecting her from "https://www.mydomain.com" to "https://mydomain.com."

I have been unable to replicate this error, but it seems to be happening with maybe 5% or less of our shoppers.

Can anyone tell me steps I should take/things I should check to find out what's causing this?

(I'm not experienced with digging into the database, but I see a UID of 0 in my database. It has no name - that's the way it should appear as I understand a response further down, right?)

francismak's picture
Offline
Joined: 07/12/2009
Juice: 2
Re: Products disappear from cart when redirected to cart

For those who wonder why their UID 0 disappeared, maybe you have the same case like me:

1. develop site in testing server
2. export and import the SQL in the production serer
3. in such case, the UID 0 will changed to another value due to MySQL AUTO_INCREMENT

FYI:
http://drupal.org/node/243423#comment-1802156

kitchen_man's picture
Offline
Joined: 10/12/2009
Juice: 2
Did this ever get resolved?

I just ran into the exact same issue with items being added to the cart, not actually being added (only in IE). Thinking that I could maybe have the same missing user 0, I went into my db and checked and it was there. I also did build this site from a new install. You can take a look at http://www.mandilee.com

thanks

-Dan

jasonabc's picture
Offline
Uber Donor
Joined: 05/05/2008
Juice: 573
Re: Did this ever get resolved?