Author Topic: Cart empty after registration or logging in?  (Read 1859 times)

alexzien

  • Jr. Member
  • **
  • Posts: 88
Cart empty after registration or logging in?
« on: November 28, 2012, 11:32:11 am »
When a new customer enters the page and add a product to the cart and then goes to checkout he/she is told to login or register for a new account. When the customer choose to do any of these choices the cart becomes empty.
This only happen the first time the customer visits the webshop. When he/she comes back and do the same thing the cart saves the added products even after logging in or registering.

Anyone who know how to solve this? It's very important that a customer can add a product to the cart before he/she chooses to login or register for an account.

I have tried to change how Joomla handles cookies and the time for session handler.
Could it have something to do with this? http://forum.virtuemart.net/index.php?topic=82238.msg271150#msg271150. But it says that this don't apply to VirtueMart 2.0+ versions, which I have...

Joomla 2.5.6
VirtueMart 2.0.12f

alexzien

  • Jr. Member
  • **
  • Posts: 88
Re: Cart empty after registration or logging in?
« Reply #1 on: November 28, 2012, 11:59:01 am »
Solved it! The problem accured when customers entered the site without using www. Because when you add a product on the site without www. and then go to checkout the site redirects to www. and then the products dont get saved.

Therefor I had to add the following code to the .htaccess file:
Code: [Select]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

This redirects customers to the www. site even if they dont type in www in the address bar.