rating rating rating rating rating rated by 0 please register or login to rate

VirtueMart Add to Cart Button doesn't work - What to do?

Attention: open in a new window. PDFPrintE-mail

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

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]

RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
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  

 
+2 # drno 2011-01-31 04:04
this works fine now. thank you. why can't virtuemart develop according to standards???
Reply | Reply with quote | Quote
 
 
+1 # sturrup 2011-04-28 13:29
sorry for this dumb question but can you explain "you have to un-comment the Options line, I'm not sure if I understand. And do you delete what's already in the .htaccess file or do you just add it above what's already there?

Thanks for you patience.
Reply | Reply with quote | Quote
 
 
0 # jeff 2011-05-06 17:06
where is the htaccess file in the ftp, cant seem to find it.

Please help
Reply | Reply with quote | Quote
 
 
0 # theadmin 2011-06-02 22:07
the htaccess file is in the root of your website. if it's not there (and assuming that you have a linux host that allows for a custom htacccess file) you can add it to the root of your installation. if you use joomla! as your VM basis, there will be a htaccess.txt file which you will have to rename to .htaccess
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...
Reply | Reply with quote | Quote
 
 
0 # rozmarbeka 2011-08-24 15:09
Great, very good guys. Thanks a lot. :P
Reply | Reply with quote | Quote
 

Joomla Administration