Virtuemart. The “Buy” button doesn’t work.

Recently I’ve come across the following problem: there is one occasion when the “Buy” button doesn’t work in the shops made on Joomla + Virtuemart. At the beginning I thought that this is a problem with inactive cookies but I was wrong.

The problem is connected to the prefix “www” and settings in the admin panel. If the domain in admin panel is www.yourdomain.com, then if a user enters your domain without “www” he/she is not able to buy anything as the “Buy” button doesn’t work. And vice versa.

How to solve this problem?

There are two ways: via .htaccess file and via VirtueMart.cfg.php.

The second way is easier.

Find a file  VirtueMart.cfg.php (administrator/components/com_virtuemart/virtuemart.cfg.php)

Find a code:

define( ‘URL’, “www.site.ru/” );
define( ‘SECUREURL’, “www.site.ru/” );

and choose it to:

define( ‘URL’, $mosConfig_live_site.$app );
define( ‘SECUREURL’, $mosConfig_live_site.$app );

Everything should be sorted now.

If you enjoyed this post, make sure you subscribe to my RSS feed!