Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

cart is empty problem


Guest

Recommended Posts

Hi, I am having the cart is empty problem, I have checked that all stock values are above zero, and everything appears to be fine. It mosty happens when I click on the Buy Now button, but sometimes happens when I select an option on the product page, for example:

 

I will go into the t-shirt menu

See the list of products

Click buy now

Get to the individual product page

Select the size I want

Click on add to cart...

 

Then I get the message your cart is empty

 

 

Thankyou for ant help

Link to comment
Share on other sites

Is it possible to add your url please ?

Its a big stab in the dark to guess what could be wrong as we have no idea what add ons you have, if its a templated store, etc etc ...

Least by viewing it there might be more chance of knowing what is up.

Does this happen for other links too? Loss of a shopping cart is a symptom of your configure files beig incorrect for cookies settings.

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

Your shop is generating wrong URLs

 

eg. http://theshop.mosquitodesign.co.uk//product_info.php?products_id=38&osCsid=95f9a1d5a561e1e58b4cb7e961797541

 

there is a "&" in the URL.

 

You must look, where this & is generated in the URL and delete it. Then it should work.

 

btw At the beginning of your URL there are two slashes after the domainname. Shere shoul olny be one slash.

 

May be you have definded in confuguration.php define('HTTP_SERVER', 'http://theshop.mosquitodesign.co.uk/');

change it to: define('HTTP_SERVER', 'http://theshop.mosquitodesign.co.uk');

Link to comment
Share on other sites

I just looked at your site and it works fine for me, you might well have altered something by now though

You still have that double forward slash there though

http://theshop.mosquitodesign.co.uk//product_info.php?products_id=35

 

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Link to comment
Share on other sites

It works fine, when you choose direct a product from the category "clothings", but not when you choose the "buy now" button from the categorie t-shirts for the shirt "Bansky". There is still the problem i described above with the &.

 

So i played around a little bit with my test environment and was able to reproduce the error.

 

I think thats a bug in oscommerce when the browser dont accept cockies. I disabeled cookies in my browser and had the same error using the buy now button.

 

The problem is the function tep_href_link in the file catalog\includes\functions\html_output.php

 

if you disable cookies a parameter &osCsid=cjn0jbkkoee4ma3fl3u5m98v95 is appended to the url.

 

When you now click on the buy now button the application_top.php is using the following code:

 

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

 

So it redirects to the product_info.php an rewrites the parameter to &osCsid=cjn0jbkkoee4ma3fl3u5m98v95

 

In the product_info.php the link to the basket is also build with the funktion tep_href_link

 

<?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>

 

So the parameter &osCsid=cjn0jbkkoee4ma3fl3u5m98v95 will be rewritten in &amp;osCsid=cjn0jbkkoee4ma3fl3u5m98v95

 

So when you click on this button osCommerce wont find the session id and says "The cart is empty".

 

A dirty hack is to comment out the line $link = str_replace('&', '&', $link); at hte end of the function tep_href_link. So the add to basket button works fine. But i dont know if there now occure other problems, because this function is certainly used on much other places in the code.

 

Thats something for the developers, because its a bug. But i dont now, where to report a bug, becaus i am new in the community.

 

Can give me someone a hint.

 

regards

Link to comment
Share on other sites

The session ID is constantly changing and never disappears from the browser address bar.

 

Firefox tells me it's not making any cookies.

 

Probably bad cookie settings in the config file.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

what do i change that too?

 

this is what i have in the config.php

 

 

define('HTTP_SERVER', 'http://theshop.mosquitodesign.co.uk');

define('HTTPS_SERVER', 'http://theshop.mosquitodesign.co.uk');

define('ENABLE_SSL', false);

define('HTTP_COOKIE_DOMAIN', 'theshop.mosquitodesign.co.uk');

define('HTTPS_COOKIE_DOMAIN', 'theshop.mosquitodesign.co.uk');

define('HTTP_COOKIE_PATH', '/.//');

define('HTTPS_COOKIE_PATH', '/.//');

define('DIR_WS_HTTP_CATALOG', '/.//');

define('DIR_WS_HTTPS_CATALOG', '/.//');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_CATALOG', '/home/***/public_html/theshop/./');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

Link to comment
Share on other sites

I'd try this:

 

  define('HTTP_COOKIE_DOMAIN', 'www.theshop.mosquitodesign.co.uk');
 define('HTTPS_COOKIE_DOMAIN', 'www.theshop.mosquitodesign.co.uk');
 define('HTTP_COOKIE_PATH', '/');
 define('HTTPS_COOKIE_PATH', '/');

 

Or this if the above doesn't work:

 

  define('HTTP_COOKIE_DOMAIN', '.theshop.mosquitodesign.co.uk');
 define('HTTPS_COOKIE_DOMAIN', '.theshop.mosquitodesign.co.uk');
 define('HTTP_COOKIE_PATH', '/');
 define('HTTPS_COOKIE_PATH', '/');

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

define('HTTP_COOKIE_DOMAIN', '.theshop.mosquitodesign.co.uk');

define('HTTPS_COOKIE_DOMAIN', '.theshop.mosquitodesign.co.uk');

define('HTTP_COOKIE_PATH', '/');

define('HTTPS_COOKIE_PATH', '/');

 

the second example (pasted above) seems to have done the trick! thankyou so much

Link to comment
Share on other sites

These need changed:

 

  define('DIR_WS_HTTP_CATALOG', '/.//');
 define('DIR_WS_HTTPS_CATALOG', '/.//');

 

To this as well:

 

  define('DIR_WS_HTTP_CATALOG', '/');
 define('DIR_WS_HTTPS_CATALOG', '/');

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

The last change I suggested will fix the // in your URL's that Fimble was referring to.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

And now disable cookies in your browser and go:

 

Clothing-> T-SHIRTS-> Buy Now (Bansky) -> Add to cart

 

You will see that your cart is empty. So there is a bug in osCommerce 2.3.1. which should be reported. I this case the problem was solved by adjusting a bad configuration of cookies. But it is exists futhermore when a user disabled cookies.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...