Add to cart doesn't work on different domain name

Please post your issues and questions about One Page Checkout for Virtuemart 2 to this forum.

Add to cart doesn't work on different domain name

Postby Candy.Yang » Mon Nov 10, 2014 6:00 am

Hi,

I've update OPC form 2.0.230.240214 to 2.0.266.271014, then there's a problem.

In our website main domain, everything works fine.
However, we have other domain - which has (set the subdomain) point to the identical same hosing server home directory with the main domain, "add to cart" doesn't properly functional.
(With no problems before updating to OPC 2.0.266.)
Example:
http://www.maindomain.com --> cart works fine.
http://store.otherdoamin.com --> cart doesn't work.


Below is what happen exactly:
1. Browse our website in Chrome private mode window.
2. Click "add to cart" button.
3. The pop up window shows this product was added to my cart.
4. Click "show cart", and the cart is empty.


Why would we want to test it in Chrome private mode?
Because some of our customers having this trouble when they try to buy our products (normal browsing method).
And we found that this problem will definitely appear when every testing personnel tested in Chrome private mode.

Your kindly help will be appreciated.
Candy.Yang
 
Posts: 24
Joined: Mon Nov 10, 2014 5:02 am

Re: Add to cart doesn't work on different domain name

Postby admin » Wed Nov 12, 2014 4:26 pm

hello, this is a most probably a problem caused by browser cross domain policty. it's important that scripts on both of your sites load from a proper URL address. i would need to see your real URLs to be able to see the problem - please check console tab at google chrome when pressing F12 key -> there should be no "cross domain" problems.

other related configuration:
- if those two domains share exactly the same files, you should disable any page cache, or other types of cache
- make sure that your configuration.php has no livesite url configured
- make sure that your joomla configuration for cookie is not configured (it will not share the cart upon those two domains unless one of them is it's subdomain). To share the cookie and the cart you may want to set up cookie domain as ".maindomain.com" and thus it will be shared upon all subdomains
- sharing a cookie/cart on two different domains is blocked by default by most browsers as far as i know - you may need to use a different cookie/session soluton then a one included in default joomla installation

many recent add-to-cart problems that i have seen were also caused by:
- system cache plugin was enabled (this plugin must be disabled because it's not compatible with virtuemart)
- gavick template cache settings - some themes inlucde their own caching solution which is not always compatible with virtuemart
- "cookie policy" plugin sometimes block the cookies and thus clear cart/session on random pages. it's important that your cookie policy plugin (or sometimes directly configured from the template) is properly configured, NOT TO DELETE COOKIES even when the customer haven't yet agreed. Otherwise you can use a large pop-up "this site is not functional without cookies. either leave or agree with cookie policty", or you can modify your themes, to hide the "add to cart" + "login modules" + all other content that uses either autentication or session so they are hidden unless the customer agrees to the cookie policy.

best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: Add to cart doesn't work on different domain name

Postby Candy.Yang » Thu Nov 13, 2014 12:26 pm

Thank you so much, Stan. For the detail explanation of the trouble shooting.

The problem is solved!
I tried "Joomla configuration for cookie is not configured" you said, and the cart is back to normal on both domain again.
Glad I don't have to disable server cache cause we really need to speed up our loading time.

Thanks for your help again. :)
Candy.Yang
 
Posts: 24
Joined: Mon Nov 10, 2014 5:02 am

Re: Add to cart doesn't work on different domain name

Postby admin » Thu Nov 13, 2014 8:21 pm

hello, you are welcome, so you "deleted" cookie config to get this work as far as i understand.

if you are using page cache or other types of caches, make sure that a cache from one site does not mix with the cache of the other site. especially if you are using shared memory (apc, xcache, memcached, etc..) it's very important that the "secret" in configuration.php file are different on these two sites. otherwise it may mix sessions and thus a logged in user to one site may be a completely different user on the other site.

best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 2