VirtueMart Add to Cart Button doesn't work - What to do?
Written by Eli Aschkenasy
Wednesday, 05 January 2011 17:31
Maybe I should have titled this article: "VirtueMart gone awry - again..."
Getting upset with VirtueMart is a state that most developers/designers/integrators have experienced at least once in their lifetime. (In defense of VirtueMart - they are providing a free component that eventually does what one really needs...) This time the problem that I faced was that people called me up stating they couldn't add a product to the cart. They apparently clicked the Add to Cart button and nothing happens! I propmptly check it on my machine, and low and behold, it works like a charm. Now, I'm stressed! Is it a browser issue, FF, IE, Safari. all tests work! What's the problem?!?
Well, the problem was that I checked the shopping cart at www.mydomain.com, while they got to the shopping cart via mydomain.com (without the www prefix). The - hardcoded :-( - ajax code that governs the adding function, calls the code via www.mydomain.com even though the current FQDN is domain.com which results in joomla to ignore the call.
The solution to this (should using the ajax still be required) is to change the root .htaccess file to include following lines
You have to un-comment the Options line, and change the domain name to the correct value. The redirect is 301 (permanent) instead of the more commonly used 302 (temporary). This will preserve SEO ranking.Now any browser trying to go to http://mydomain.com will be automatically redirected to http://www.mydomain.com and your VirtueMart shopping cart should work just fine.




Comments
Thanks for you patience.
Please help
as far as the option line goes; you can examine the htaccess file i it already contains that line. otherwise just create a new section...
RSS feed for comments to this post