There is a minor issue with osCommerce when using either 3rd party or ssl certificates assigned to a sub-domain which results in an error reading “Your Shopping Cart is empty!”. This happens when ENABLE_SSL is set to true in the configuration file. There has been some discussion on the osCommerce Forums regarding “Shopping cart empty when checkout is clicked“.
The error is most often seen after adding a product to your osCommerce Shopping Cart. The shopping cart will show the proper products, however, when navigating to checkout the screen returns “Your Shopping Cart is empty!”. This happens due to osCommerce storing the cookie on 2 separate domains. In most osCommerce configurations you’ll see people setting up their sites like so:
define(‘HTTP_SERVER’, ‘http://www.domain.com’);
define(‘HTTPS_SERVER’, ‘https://secure.domain.com’);
define(‘ENABLE_SSL’, true);
define(‘HTTP_COOKIE_DOMAIN’, ‘www.domain.com’);
define(‘HTTPS_COOKIE_DOMAIN’, ‘secure.domain.com’);
define(‘HTTP_COOKIE_PATH’, ‘www.domain.com’);
define(‘HTTPS_COOKIE_PATH’, ‘secure.domain.com’);
This configuration is incorrect in that osCommerce has a hard time distinguishing the cookies. What you need to do is store the cookies at the main domain without the sub. I had changed the configuration file to read:
define(‘HTTP_SERVER’, ‘http://www.domain.com’);
define(‘HTTPS_SERVER’, ‘https://secure.domain.com’);
define(‘ENABLE_SSL’, true);
define(‘HTTP_COOKIE_DOMAIN’, ‘domain.com’);
define(‘HTTPS_COOKIE_DOMAIN’, ‘domain.com’);
define(‘HTTP_COOKIE_PATH’, ‘/’);
define(‘HTTPS_COOKIE_PATH’, ‘/’);
By changing my osCommerce configuration file to set the cookie at the root domain, I have been able straigten out the SSL/HTTPS issue and allow the shopping cart to flow forward with the order.
I am using both Purchase Without Account and Advanced SEO for osCommerce through MagneticOne and everything is stable and processing orders.
2 Responses to “osCommerce with SSL Shopping Cart empty”
Jessica
this worked for me! Thank you for a solution after other people’s solution did not work.
Fred
Yes! After trying reconfiguring sessions, forcing cookies, hunting down globals and all the other stuff, this worked.