turn off/disabling the shop "ask product" form in virtuemart

Virtue Mart for Joomla logo

Most people want to disable, remove or turn off the "Ask a question about this product" in vitruemart for joomla because it attracts alot of comment spam. If your getting lots of random messages in you email box with thumbnails of the products in your online shop (which is a virtuemart/joomla shop) then likely what's causing this is the link shown when you have products with no price. It links to a form that has no way of stopping robots from spamming you. Heres how to fix things...

There are three options:

1) Turn off the link  (note, it is not good enough to simply turn the link to the form page in the shop, because it may still be locatable through Google)
2) Delete the form completely.
3) Use Re-Captcha to thwart spammers and leave the functionality available:

NOTE: before we start, I often refer to the file:  joomla\components\com_virtuemart\themes\default\templates\pages\shop.ask.tpl.php   this may NOT be the right location if you have a template installed, if so you will need to replace the folder "default" with the folder name of the location of your virtuemart template. In this case the location would be joomla\components\com_virtuemart\themes\YOUR-VIRTUEMART-TEMPLATE-FOLDER-HERE\templates\pages\shop.ask.tpl.php

1) To turn off the link. Go into the Joomla Administrator backend and choose the virtuemart plugin. Under configuration there is an option to "show prices" (in the "global" tab under the section "Price Configuration". Many people use Virtuemart as a catalogue system and don't need to show prices. When the price is left empty thats when the "Ask a question about this product" link appears. To turn it of just uncheck "show prices". NOTE: If you turn off the link, the page is still accessible and any spam bot that knows about it might continue send you spam. You might want to try option 2:

2) Delete the form completely.
A rather simple solution is to delete the contents of the form page:

If you think you're not going to need the form that people can use to ask a question about a product, then why not remove it? Turn it off (as in option 1 above) and then edit the php file found here:  joomla\components\com_virtuemart\themes\default\templates\pages\shop.ask.tpl.php    now just delete everything and save the file back to the server. Done. No more spam.

3) Using Re-Captcha:

If you want to leave the functionality there, the only answer is to add reCaptcha to the form so that only humans can use it. This will stop spam from bots.

Step 1
Go to http://recaptcha.net/.  Sign up for an reCaptcha account so you can get a public and private key (you can use a google account for this).  You will need these keys in part 2.

Step 2
Go to  http://www.joomlaez.com/ and download reCAPTCHA Integrator Plugin for Joomla. and install it. In the Joomla administrator backend, go to the plugin manager and open the reCAPTCHA Integrator Plugin. Then:
    •    Enable the plugin
    •    Enter the public and private keys from part 1 (above)
    •    Set Inclusion Syntax to YES
    •    Set Auto-verify to YES
    •    Apply or save the settings

Step 3
Edit the file: joomla\components\com_virtuemart\themes\default\templates\pages\shop.ask.tpl.php
Look for the line which say something like: <input type="button" name="send"...
Above this line, add the text:      {captcha}

Save the file (and make sure it's uploaded to the server). Now you're done.

Now, whenever anyone goes to a product page and clicks the link "Ask a question about this product" there should be a reCAPTCHA box at the bottom of the page.

Posted in You too can (how to articles)