VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: mhebert on November 09, 2012, 08:17:00 AM

Title: [ SOLVED ] Add to Cart Button 2.0.8e Not working
Post by: mhebert on November 09, 2012, 08:17:00 AM
Site: www.chexsports.com (http://www.chexsports.com)

PHP Version 5.3.15
MySQL Version 5.5.23-55
Virtuemart: 2.0.8e
Joomla! 2.5.6

When I view the console this is the error i get:
XMLHttpRequest cannot load http://www.chexsports.com/index.php?option=com_virtuemart&nosef=1&view=productdetails&task=recalculate&format=json&customPrice%255B0%255D%255B9%255D%3D483%26quantity%255B%255D%3D1%26option%3Dcom_virtuemart%26virtuemart_product_id%255B%255D%3D267%26virtuemart_manufacturer_id%3D16%26virtuemart_category_id%255B%255D%3D10. Origin http://chexsports.com is not allowed by Access-Control-Allow-Origin.

What I've done so far:

Thanks in advance!!
Title: Re: Add to Cart Button 2.0.8e Not working
Post by: mhebert on November 09, 2012, 09:43:05 AM
I don't know if this is proper forum etiquette to reply with my own solution, but through much trial and error I solved the problem on my own.

First when your cart is not working, my advice is to check the console and see if any error is happening.
If the error   "is not allowed by Access-Control-Allow-Origin" happens, you're likely having a URL problem.

I solved my problem by adding a redirect to my .htaccess file so that all non-www requests were redirected to www.mydomain.com and it immediately fixed the issue.

The reason I posted this reply is that I've found that most people who are having cart issues are because they're loading Jquery twice, but that's not the case with this issue. I hope it solves the problem for someone else.