Virtuemart Extensions by

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

Virtuemart does not show Ajax popup when adding a product

Dear friends, we suggested a code change to vmprices.js that handle your ajax requests for adding the products into your cart. The patch towards the latest VM2.0.22e is published here and whole javascript file can be downloaded here. This patch do not depend on any of our extensions and are made for you to have more stable version of virtuemart. 


The patch introduces these changes: 

1. It sends data to cart over POST not GET, so your customers will have more privacy as the product information will not be included in the URL 

2. It uses pure AJAX raw format instead of the JSON response

3. It is able to parse malformatted JSON response resulting from notices or errors caused by php error reporting

4. It uses encoding that is compatible with suhosin and other core php modules that filter php execution when double encoded data are found

If you decide to use our vmprices.js, you can upload it to your /components/com_virtuemart/assets/js/vmprices.js 

With google chrome, please check if you are getting any errors by pressing F12 key and proceed to console tab. The file was tested on a live site, latest svn of virtuemart (2.0.22e) and our demos with all types of products. 


The support for this patch is available here


We had wrapped the modifications within an installable plugin that automatically overrides the default Virtuemart javascripts. This plugin is compatible with VM2.0.0 to the latest (currently 2.6.0) and runs on Joomla 2.5.x 

The major differnces are

  • personal data protection of your customers - the product IDs and quantities are not send over GET but rather over POST which is hidden to middle servers especially when you are using https
  • mod_security support. Some servers block suspicious GET activities and therefore POST is prefered
  • more error handling and usage of pure ajax instead of json, the add to cart functionality does not get broken once any part of your joomla modifies the VM's json response (with error reporting on for example)
  • it's much more error prone towards facebox and fancybox javascripts
  • this plugin still does not solve jquery issues and jquery must be functional on your site for proper add to cart functionality

Download as plugin (last update 29.5.2014) 


Further Recommendations

Since 29.5.2014 the plugin automatically removes the noscript tags which would work in most cases as far as they are exactly rendered as below. If not, you need to modify your theme files to remove the noscript tags. 

As one of the most fundamental issues with Virtuemart we consider a requirement of a functional javascript for the cart system to work. If your site gives a various errors with javascripts at a different positions (head, body, execution) your add to cart may not work at all. After clicking the add to cart button, you may end up at the "empty cart page". This is caused by a default Virtuemart code that looks like this: 

<noscript><input type="hidden" name="task" value="add"/></noscript>

As defined in your:


(and a few other files depending on your theme)

A missing task in the default code results to add-to-cart malfunction. The problem is that <noscript> content does not get executed once javascript is enabled, but malfunctioning/broken. Therefore to make the Virtuemart work with a broken javascript on some of the browsers such as IE11 or similar, you may want to update all occurances of this tag to: 

<input type="hidden" name="task" value="add"/>

(i.e. remove the noscript tags wherever you find them). For this to work properly on the browsers which do execute the javascript properly, you must use our plugin as of up to Virtuemart 2.6.0. The issue of the <noscript> tags is being solved in Virtuemart and will  be removed for the next stable version of Virtuemart after 2.6.0.

Understanding cart mechanism 

Your cart is saved in a session. Session is a data collection usually stored in your database paired with a special ID saved in a cookie on the customer browser. This ID in cookie is saved per Joomla configuration of cookie path and cookie domain. Many Virtuemart javascript may run improperly if your domain runs both and The cookie and session if improperly configured has a differnt content (of cart) per these two domains. 

To enable the same cart content (session) per both and you may want to set up your cookie path to:

and path to "/" so it's available to all levels of directories. 

Session furthermore has a timeout. This is configured in Joomla global configuration and it's very recommended for shop owners to make the session expiry time as large as possible so your customers have enough time to fill the forms or leave the site unchanged. Watch your #__session table for amount of opened sessions and customize the session timeout to a value that your server can still handle. Millions of opened sessions will lead to a slow site.  Timeout decides on how many minutes your customer can do no action on your site until the session and cart gets deleted. 

Some server configuration may also require a special configuration for cookie and session storing per https and non http domains. Please ask your hosting if your cart gets changed upon changing from https to http and vice versa. 

To get around the issue of using both www and non-www for your site, you may want to modify your .htaccess file at the root of your Joomla to this: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


This will make sure that all javascripts, css or page views get loaded from www. prefix of your site. 










You are here