VirtueMart Forum

VirtueMart 2 + 3 => General Questions => Topic started by: Mitsiman on September 18, 2019, 07:03:39 am

Title: Virtuamart www Issue not adding anything to the Cart
Post by: Mitsiman on September 18, 2019, 07:03:39 am
I recently had to move my site to another address, and have now moved it back to the original address again.

The issue I am having is the site loads up fine, whether the address be www.shop.rpw.com.au or shop.rpw.com.au

But it will only add products to the cart if you are using the address shop.rpw.com.au. IF you add the www in front it just sits there thinking whenever you try to add a product to the cart.

I had siteground (Host) look into this and they changed the .htaccess file apparently to setup the redirect but it didn't make any difference, the problem still exists and they believe its a hard coded issue.

I have updated to the latest versions being

Joomla! 3.9.11 Stable [ Amani ] 13-August-2019 15:00 GMT
VirtueMart 3.6.0 10113

I really have no idea where to proceed from here. Any help would be appreciated.
Title: Re: Virtuamart www Issue not adding anything to the Cart
Post by: Studio 42 on September 18, 2019, 07:35:55 am
Try to empty livesite in the Joomla config.
Title: Re: Virtuamart www Issue not adding anything to the Cart
Post by: GJC Web Design on September 18, 2019, 13:09:44 pm
it doesn't work because

Access to XMLHttpRequest at 'http://shop.rpw.com.au/index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json&lang=en&Itemid=896' from origin 'http://www.shop.rpw.com.au' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

try the htaccess force the other way around -- i.e. no www
Title: Re: Virtuamart www Issue not adding anything to the Cart
Post by: Mitsiman on September 18, 2019, 15:54:47 pm
Thank you very much that worked perfectly and the site is now running properly again. Is there a reason why this is happening though? Surely this is not something you would normally need to do.
Title: Re: Virtuamart www Issue not adding anything to the Cart
Post by: Studio 42 on September 19, 2019, 10:17:31 am
It depend the apache settings. see for eg. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin
If yuou use a cache then the links can be bad.
It's why always redirecting to non WWW should be used, to prevent this problem.
If you set livesite in the config. Then you can have same problem.
Title: Re: Virtuamart www Issue not adding anything to the Cart
Post by: GJC Web Design on September 19, 2019, 13:19:22 pm
simple explanation : ajax calls etc must to/from the identical domains - otherwise the browser will block it  .. this is for security