News:

Looking for documentation? Take a look on our wiki

Main Menu

[ SOLVED ] Add to Cart Button 2.0.8e Not working

Started by mhebert, November 09, 2012, 08:17:00 AM

Previous topic - Next topic

mhebert

Site: 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:

  • I've also tried changing the .htaccess file to say "Header set Access-Control-Allow-Origin *" which makes the popup come up that the item has been added to the cart, but when you check the cart, the item is still not there.
  • I've tested the add to cart button on Chrome and IE9 and both don't work. It used to work, but stopped and I don't know what has changed.
  • I've tried all combinations of the "Activate Css Styles & Javascripts" section, but none have had the result.
  • I've tried to unpublish modules like random images, sliders, etc.
  • I've updated the PHP from 5.2... to 5.3.15 as you see above. 
  • I've read all types of posts on the forum, but none have helped. I hope someone has a suggestion for me or some alternative troubleshooting I could do.

Thanks in advance!!

mhebert

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.