Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest ColeFlournoy

Add to Basket --> Cart Empty - SOLUTION

Recommended Posts

Guest Lynne Veness

I've been getting feedback from customers, on occasion, since we launched 4 months ago (CC3.14) that they cannot order my Label products because their typed information won't go into the shopping basket.

I was first alerted when an angry and frustrated customer telephoned me. It doesn't happen all the time. And the only way I have been able to replicate it, is by going to our local library computer where I guess they do have high security settings.

Every so often I get an email (thru Contact Us) and am told that the product won't go into the Basket and the customer gets an 'Empty Basket' error message. I actually put our phone number and email link on the error message page to try and prevent losing these customers, but I don't know how many I am losing. I originally had some info on that page, advising them to lower their security setttings but it still didn't work for them. (Only makes them more frustrated.)

Fortunately these customers had bothered to email me and tell me, and I then processed an order for them manually. But there must be a number of customers who don't bother to email an order after getting frustrated, if the website won't take the order - and I lose them.

Yes, I too want to see a fix for this issue asap. Thanks.

Here's my website - if the CubeCart techs would like to try it.

http://www.sportidlabels.com.au

Share this post


Link to post
Share on other sites

Guest

I just tested your cart (www.sportidlabels.com.au) and added a couple items to the cart with no problem. I tried it a second time with cookies turned off and I got cart empty. Maybe some people have cookies turned off on their computers?

Share this post


Link to post
Share on other sites
Guest Lynne Veness

Thanks jbeyler for testing it. If the Empty Basket problem is caused by cookies, do you think there's anything I can do at my end with my site to lighten up the cookie issue so it works for those who customers who currently are affected? (the customers who tried to reduce their own security levels still couldn't order)

Share this post


Link to post
Share on other sites
Guest JacTev

Hello,

I am testing my CC 3.0.15 store ; and I stumbled over this "Your Cart is empty" problem. After trying a few times to reload the page, empty the basket, I then clicked on a link on the left labelled "edit invoice address". I did not recall that link being there otherwise.

When I clicked and the form came, I noticed that the TITLE was empty. So I typed in "Mr". In one of the address box I had "L'/Eglantines". The slash is wrong (in french), so I took that away. I updated my file. And miracle, all came well again.

I wonder if it was that TITLE box that wasn't filled.

Just my experience which might help somebody else. :huh:

Good Luck.

Share this post


Link to post
Share on other sites
Guest JacTev

Hello,

I am testing my CC 3.0.15 store ; and I stumbled over this "Your Cart is empty" problem. After trying a few times to reload the page, empty the basket, I then clicked on a link on the left labelled "edit invoice address". I did not recall that link being there otherwise.

When I clicked and the form came, I noticed that the TITLE was empty. So I typed in "Mr". In one of the address box I had "L'/Eglantines". The slash is wrong (in french), so I took that away. I updated my file. And miracle, all came well again.

I wonder if it was that TITLE box that wasn't filled.

Just my experience which might help somebody else. :huh:

Good Luck.

Tried to reproduce the error, but to no avail. Don't know why.

Thus the problem might not really be related to this unfilled box on the address form.

Oh BTW the "edit invoice address" link is in fact always there after a customer has filled the form the first time (I made a false assumption at first).

Share this post


Link to post
Share on other sites
Guest

I also will occasionally run into this same problem, but only with Firefox or Opera. Never seen the problem in IE. I would assume that it has to do with the fact of my customers are loading up the cart in a non-ssl environment ... Then switching to the cart, which is now an SSL enabled environment, the items added to the cart are not showing (i.e. Empty Cart).

For the ones that never tested their own online store in another web browser other than Internet Explorer, I would HIGHLY suggest you do so.

Share this post


Link to post
Share on other sites
Guest estelle

Note: Please don't quote this whole post when replying. There's no need for lots of massively long posts!

I have seen this session issue in a surprising number of stores, either caused by:

A. Having the SEO mod, or

B. Entering the store via http://www.domain.com and at some point in time being redirected to http://domain.com (without the www). Switching from HTTP to HTTPS doesn't appear to cause any problems, except in the case where the customer enters via http://www.domain.com and is redirected to https://domain.com (without the www).

Note: These problems may occur in particular browsers only - problems definitely occur in Firefox, and sometimes in IE (perhaps to a limited degree). I have not performed testing with Opera.

Possible solutions...

A. This problem occurs when a customer first visits your store via a category, product or site document page. The problem is occurring because cookies are being given a path such as "/category-name/product-name/". Then when a customer is later views a different category or the view basket page, the session cookie is no longer found, hence the basket appears empty.

Firstly, ensure your $glob['rootRel'] setting within includes/global.inc.php starts and ends with a slash. Be *very* careful to make backups should you wish to make any changes to this configuration file.

Possible code fix is shown below. I have only performed limited testing so this fix may certainly need some more work.

EDIT in includes/sessionStart.inc.php

FIND this line:

http://www.domain.com or http://www.domain.com/etc... The problem is occurring because cookies are being given a domain of "www.domain.com". If a customer is later redirected to http://domain.com or https://domain.com, the session cookie is no longer found, hence the basket appears empty. If you wish to test if this problem is occurring on your store, clear all browser cookies or just clear the browser cookies for your store URL. Go to your store URL *with* the "www". Add an item to your cart. Then go to your store URL *without* the "www" and see if the shopping cart side box shows an empty basket. I can say for sure that this issue occurs on some stores when using Firefox, but the issue may not occur when using IE or Opera. Therefore it would be worth testing with *all* browsers. For any techos.... a possible fix would be to make a code change such that cookies are given a domain of ".domain.com" (with the dot at the start). This would completely fix the issue, but I believe it would not work if there were multiple cubecart stores in different subdomains but with the same relative path, e.g. stores at both www.domain.com and at bla.domain.com .... or stores at both www.domain.com/subdir and bla.domain.com/subdir A simpler alternative fix is to make sure customers always use the URL either with or without "www", but not both. So setup your store URL and HTTPS URL both with the "www", and use the same URL everywhere. Or setup your store URL and HTTPS URL both without the "www", and use this same URL everywhere. Your store URL is the $glob['storeURL'] setting in includes/global.inc.php - be *very* careful to make backups before making changes to this file. Also, ensure your $glob['storeURL'] setting does *not* end with a trailing slash. Your HTTPS URL is within Admin General Settings. (This may not be a perfect fix, but it should resolve the vast majority of problems) Furthermore, if you wanted to give your customer more assistance should they run into the empty cart issue, you could adjust the "Your shopping basket is empty" language string. Backup your lang.inc.php file before you make any changes! First fine this line:

$sessionDomain = substr($GLOBALS['rootRel'],0, strlen($GLOBALS['rootRel'])-1);



REPLACE with this:


// START FIX BY ESTELLE: SESSION ISSUE - CART APPEARS EMPTY

//$sessionDomain = substr($GLOBALS['rootRel'],0, strlen($GLOBALS['rootRel'])-1);

$sessionDomain = $glob['rootRel'];   // this is actually the cookie "path"

// END FIX BY ESTELLE: SESSION ISSUE - CART APPEARS EMPTY





B. This problem should only occur when customers first enter your store via 
$lang['front']['confirmed'] = array(



Then go UPWARDS a few lines to find this line:


'cart_empty' => "Your shopping basket is empty.",



Change it carefully ensuring you escape any quotes.  E.g.:


'cart_empty' => "Your shopping basket is empty. Please <a href=\"index.php?act=viewDoc&docId=2\">Contact Us</a> if you run into any technical issues or need any assistance.",

Estelle.

Share this post


Link to post
Share on other sites
Guest

EDIT in includes/sessionStart.inc.php

FIND this line:

$sessionDomain = substr($GLOBALS['rootRel'],0, strlen($GLOBALS['rootRel'])-1);



REPLACE with this:


// START FIX BY ESTELLE: SESSION ISSUE - CART APPEARS EMPTY

//$sessionDomain = substr($GLOBALS['rootRel'],0, strlen($GLOBALS['rootRel'])-1);

$sessionDomain = $glob['rootRel'];   // this is actually the cookie "path"

// END FIX BY ESTELLE: SESSION ISSUE - CART APPEARS EMPTY

I tried this code change but it did not work. :)

I am using the SEO Mod and the latest CC versions (3.0.16).

To make this error happen:

1st - I'll load up FireFox and goto my store at 'jammaboards.com/store' (without the www).

2nd - Click any Buy It now item, then click on the shopping cart basket.

3rd - URL changes from jammaboards.com/store (without the www) to https://www.jammaboards.com/store and the cart is not shown as empty.

However I just noticed that if I first enter my store in FireFox by going to 'www.jammaboards.com/store' ... Then after I add some products and go into the cart ... They are all there :(

So ... If I go into my store by typing in 'jammaboards.com/store' ....Until I actual click onto anything that will bring the cart into an https mode, the browser URL will never add in the www! So if I'm surfing through my site in the non-www mode and entering a ton of items into the shopping cart ...then 30 minutes later I click on 'Checkout/Shopping Cart' ... It will now completely loose all those items and I'll have a pissed customer.

So, as soon as a customer enters my site via the non-www URL method ... Would it be possible for CubeCart to detect the lack of www and automatically switch to from jammaboards.com to www.jammaboards.com? This way, I think it will cure the problem. :lol:

-Tim

Share this post


Link to post
Share on other sites

I came to the forums looking for help with this same problem and what do you know... this thread is at the top!

I have been struggling with this problem for some time now. Click add to cart and shopping cart updates with 0.00 and no items added...

I have my store on a subfolder and originally had a flash intro page which I have since removed as the links in the flash were defiantely causing the problem, I have put the flash up on a temporary page on a diferent domain now for testing, if you go here

http://artistrywebdesign.com.au/bowls/

and click on any of the links in the flash area, adding an item to cart will not work at all...

But thats ok, Ive removed it from the front page and have edited the htaccess file to redirect to the subfolder that the cart is in. I can live with this as a temporary fix.

But Im still getting complaints from this client that customers arent able to add items to their cart, and they do have cookies enabled.. Ive been over the entire site several times and quite fed up really, I do have a lot of mods and my next step is to do a new install and just add the skin only. This has taken, and will take, many hours of extra work...

I understand the devs cant support mods made to the cart but the main reason I use CC is because I can mod it...

Just to add, are there 2 versions of this problem? One where adding to cart works but at checkout cart is empty, and the other where you cant actually add items to the cart?

Share this post


Link to post
Share on other sites

Well one of my problems was links from search engines made the add to cart system not work, doing the following fixed this problem, so as the original post mentioned if theres any problem with this method can someone let us know.

Here's what I did to correct the problem:

in sessionStart.inc.php:

@ini_set("session.cookie_path",$sessionDomain);

Replace $sessionDomain with your cubecart directory ("/" or "/shop" etc). Mine looks like this now:

@ini_set("session.cookie_path","/shop");

Or if your cart is at the index of your site then:

@ini_set("session.cookie_path","/");

in session.inc.php:

// set cookie to extend expire time meaning if the visitor visits regularly they stay logged in

setcookie("ccUser", base64_encode($sessId),time()+$config['sqlSessionExpiry'], $sessionDomain);

Again, replace $sessionDomain with the same "/" or "/shop" whatever directory your cubecart is in.

Delete your browser cookies and test your cart again.

Share this post


Link to post
Share on other sites
Guest estelle

@Al - This problem can arise even when no mods are installed. If a store is configured with URL http://www.domain.com/store and then the SSL URL is set to https://domain.com/store or https://secure.domain.com/store - the session cookie may not be found when the customer is redirected to the secure area. Or with the CC demo... if I clear my cookies for cubecart.com, then if I typed in a URL of http://cubecart.com/site/demo/cc3/ - i can add items to my cart but my basket will appear empty upon checkout.

@Chargin - There is only one tiny issue with what you have done - I have read in several places that when setting a PHP cookie the path should have a trailing slash, so it should instead be @ini_set("session.cookie_path","/shop/");

What I wrote in software will actually result in the exact same thing as what you have (with trailing slash of course). The solutions are the same but I think what I wrote is more ideal since the path isn't hardcoded (its pulled from the global.inc.php config file) and it involves a change in only place in one file rather than in 2 files.

@TimHensel - Thanks for pointing that out. I thought that going from http://www.domain.com to http://domain.com was fine, but I can see from your store that it doesn't work.

---> So, my thoughts are now that we can setup .htaccess so that any requests for http://domain.com are redirected to http://www.domain.com (or vice versa depending on store configuration). Has anyone already come up with the .htaccess changes for this? Does anyone know if there are reasons not to do this? (It may be a good solution for SEO reasons... can anyone confirm if Google sees http://www.domain.com and http://domain.com as two separate web sites that repeat the exact same information?)

---> Or alternatively it would be possible to customize sessionStart.inc.php further so that the session cookies are active across all subdomains (by setting the cookie domain to .domain.com instead of www.domain.com or domain.com). However for any domains that have multiple CC stores, this code change could cause issues.

Just to add, are there 2 versions of this problem? One where adding to cart works but at checkout cart is empty, and the other where you cant actually add items to the cart?

Perhaps, but the point of this thread is to come up with a solution for the problem where products can be added to the cart successfully, but then the cart appears empty upon checkout.

Share this post


Link to post
Share on other sites

Just to add, are there 2 versions of this problem? One where adding to cart works but at checkout cart is empty, and the other where you cant actually add items to the cart?

Perhaps, but the point of this thread is to come up with a solution for the problem where products can be added to the cart successfully, but then the cart appears empty upon checkout.

Ahhh, so is there another thread about not being able to add items to the cart?

Just to explain, the fix I mentioned above helped the store I was working on with the problem of not being able to "add to cart"...

Share this post


Link to post
Share on other sites

Cubecart 3.0.16

www.fire-extinguishers-direct.com

Unmodified code for session cookies or shopping cart

Problem: items cannot be added to the shopping cart

Browsers: IE6 and IE7 with the privacy set to Medium.

In both cases works ok when privacy set to low.

Share this post


Link to post
Share on other sites

Ive got nothing new to add, just to say Im at my wits end with this problem...

Ive got a client whos getting quite annoyed with loosing orders to his cart not working. I really dont know what to do next, fresh install with no mods perhaps, but that really gimps the cart....

Share this post


Link to post
Share on other sites
Guest

Try this in your .htaccess file:

Options +FollowSymLinks 

RewriteEngine on 

RewriteCond %{HTTP_HOST} ^yoursite.com [NC] 

RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]

Now for me it is not working... I do not know why but it may have something to do with the SEO MOD. It seems like when i have this redirect in place, the store gets stuck in a loop and never loads in. :)

My main URL is jammaboards.com and my store is located at jammaboards.com/store ... So I'm also not sure if having my store in a sub directory is causing the redirect not to work correctly.

-Tim

Share this post


Link to post
Share on other sites
Guest estelle

Chargin, I've talked to Al about it.

He disagrees with the code changes I wrote (although personally i'm pretty sure there is something wrong with the standard code, because for me $GLOBALS['rootRel'] is not set, however perhaps its caused by a web server setting on my local machine..... dunno)

Al agrees that a change to .htaccess to redirect customers from a non "www" URL to a "www" URL (or perhaps vice versa depending on the store) is correct. (Although only a partial solution IMO)

I don't have time to look up what changes are required to .htaccess, so I'm going to wait for someone else to offer something up.... anyone...?

Share this post


Link to post
Share on other sites

I do have a subfolder for the cart, seems to be a common thing when theres problems, heres my htaccess just out of interest...

redirect 301 /index.html http://www.lawnbowlsshop.com.au/cart/index.php

# <rf> search engine friendly mod

# 1) only used if you selected 'Apache directory lookback and ForceType supported' as your server configuration

<Files shop>

ForceType application/x-httpd-php

</Files>

# end 1)

# 2) only used if you selected 'Apache RewriteRule supported' as your server configuration

RewriteEngine On

RewriteCond %{QUERY_STRING} (.+)

RewriteRule cat_(.*).html index.php?act=viewCat&catId=$1&%1 [L]

RewriteRule cat_(.*).html index.php?act=viewCat&catId=$1 [L]

RewriteCond %{QUERY_STRING} (.+)

RewriteRule prod_(.*).html index.php?act=viewProd&productId=$1&%1 [L]

RewriteRule prod_(.*).html index.php?act=viewProd&productId=$1 [L]

RewriteCond %{QUERY_STRING} (.+)

RewriteRule info_(.*).html index.php?act=viewDoc&docId=$1&%1 [L]

RewriteRule info_(.*).html index.php?act=viewDoc&docId=$1 [L]

RewriteCond %{QUERY_STRING} (.+)

RewriteRule tell_(.*).html index.php?act=taf&productId=$1&%1 [L]

RewriteRule tell_(.*).html index.php?act=taf&productId=$1 [L]

# end 2)

# <rf> end mod

Share this post


Link to post
Share on other sites
Guest

I tried another version of the redirect in the root .htaccess file:

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.jammaboards\.com [NC]

RewriteRule ^(.*) http://www.jammaboards.com/$1 [L,R=301]

</IfModule>

It works if I just enter jammaboards.com, then it will redirect to www.jammaboards.com ...but unfortunately if I enter jammaboards.com/store (location of my cubecart 3.0.16) then it just stays at jammaboards.com/store ... :)

Share this post


Link to post
Share on other sites

Just found this in relation to adding to cart working but checkout showing an empty cart, looks easy enough, any problems occur when you empty the sessions table??

"I don't know if it will help anyone else, but I went into PHPMyAdmin and deleted all sessions stored in the CubeCart_sessions table, then was able to do it...maybe the sessions were causing the problem?"

Thread:

http://www.cubecart.com/site/forums/index....c=25031&hl=

Share this post


Link to post
Share on other sites
Guest CarFonics

Oddly enough, my issue is slightly different. If an item is added to the cart and you go to view basket it is there allowing you to completely checkout, however the language above the item says "Your cart is currently empty," even though the items are present. This happens regardless of using the www.domain.com or /domain.com, though my config.inc.php file is set to use the www. Is anyone else having this issue or does someone know a "fix" for this?

Thanks,

Shane.

Share this post


Link to post
Share on other sites
Guest estelle

Just found this in relation to adding to cart working but checkout showing an empty cart, looks easy enough, any problems occur when you empty the sessions table??

I would not recommend emptying your sessions table. This would mean that all customers would have their baskets emptied.

Share this post


Link to post
Share on other sites
Guest sneakysnier

No doubt this has been raised at some point but.....

My .com site works 100% normally but..... if i redirect to my .com site from the .co.uk site i can't add any items to my basket.

Apparently the redirect is 'masked' (always keeping the .co.uk in the address bar)...no doubt causing the issues...

I don't NEED to use the .co.uk redirect but thought i'd post this just in case it may help the technical guru's in any way?

Cheers

Ian

Share this post


Link to post
Share on other sites
Guest offthehook

I'd like to add a note of concern over this issue. It is happening to one of my stores and my customer has complained. I have raised a support ticket on this issue, however for information here are my store details.

The store is running on a secure server for the cart pages and I have two mods installed which affect the cart, quick checkout and express checkout. It is not running the search engine friendly mod and the store is in the root folder. The server is Apache.

I have experience the issue myself on Firefox 2, using a mac with no firewall software running. I have not yet managed to recreate the problem on a PC with Explorer or Firefox even after changing internet settings in the Internet Options box or in Zonealarm.

I fear this is a serious issue for continued CC support, at least with v3, if the issue is not to be addressed officially because I wonder how many stores this is happening to and customers have not complained, or if they have store owners have not really thought that it is a major issue. But 4 orders lost yesterday is a major problem for my client and could be a major problem for me if it happens again.

I'm hopeful that the CC community will be able to find a solution, but if not I will certainly be looking at other shopping carts (including CC4).

Share this post


Link to post
Share on other sites
Guest craiga

Chargin, I've talked to Al about it.

He disagrees with the code changes I wrote (although personally i'm pretty sure there is something wrong with the standard code, because for me $GLOBALS['rootRel'] is not set, however perhaps its caused by a web server setting on my local machine..... dunno)

You are right.. $GLOBALS['rootRel'] at this point in the code is not set. rootRel is added to the array glob not globals. I don't see any code which copies the glob variables to globals, so how can the subst line be correct?

I added a piece of code to log access to any viewDoc with the ip and session. I had several people access the site and have no trouble but one where the session id changed each time they clicked on a link suggesting the cookie wasn't found/set or whatever, this person could not add anything to the cart. I wasn't able to find out much except from the log they are using Mozilla/4.0-IE6.0-WinNT5.0 - but that doesn't say much either.

Craig.

Share this post


Link to post
Share on other sites
Guest craiga

Chargin, I've talked to Al about it.

He disagrees with the code changes I wrote (although personally i'm pretty sure there is something wrong with the standard code, because for me $GLOBALS['rootRel'] is not set, however perhaps its caused by a web server setting on my local machine..... dunno)

You are right.. $GLOBALS['rootRel'] at this point in the code is not set. rootRel is added to the array glob not globals. I don't see any code which copies the glob variables to globals, so how can the subst line be correct?

Ok my mistake, I see it now in sslSwitch.inc.php. So the problem here is that sslSwitch.php is included after sessionStart.inc.php explaining why $GLOBALS['rootRel'] is not set. Should it be the other way around?

Craig.

Share this post


Link to post
Share on other sites

×
×
  • Create New...