Create Account
/ Reminder
 
 
 

New World Designs
Disabling/removing "Ask a question about this product" in VirtueMart
Tuesday, 29 September 2009 02:04

One of the largest problems with VirtueMart is the huge amounts of spam that comes through the "Ask a question about this product" form linked on the product flypage (product details). There are no spam controls or filters of any form, so you get the lot.

 

This is because spammers use "robots" to travel around the Internet at thousands of pages per hour, looking for forms to fill in with what every they are selling. The robots are quite clever and know how to fill in the forms automatically and press submit. Once this is done it will save this URL and visit again a little later and do it again and again and again.

 

You can either

- Hack files and add a captcha system - Delete the link to the "Ask a question about this product" form

- Disable it properly so it wont work again without touching the core files.

 

To add a captcha system i a monster of a job, it also involves a large number of core hacks, which will all be over written when you update the core files.

 

Deleting the link to the form will not work, as the spam robot has already saved the path to the form, so it just goes directly to the form and bi-passes any links to it.

 

Soooooo

The best way is to disable it completely in a way that wont be effected when you update the site.

 

To do this open the file

components/com_virtuemart/themes/default/templates/pages/shop.ask.tpl.php

(assuming "default" is the name of your theme, i usually rename them, so if any updates come down it wont over write my templates.)

 

When you open this in your favourite editor, such as Dreamweaver, "select all" and replace it with just this, nothing else, just this in red below.

 

<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
?>

 

This will remove the actual form, so it is impossible for the spam spider to fill it in. Give it a go, try and click on the "Ask a question about this product", you should see a blank space where the form used to live.

 

Now we need to remove the link to the form in the first place, which is very easy

 

Open

components/com_virtuemart/themes/default/templates/product_details/flypage.tpl.php

or what ever flypage you are using,

(the flypage is what VirtueMart calls the product detail page)

 

Now find

 

 

And delete it, now save the page and upload it back to your site and you should find there is no more link.

 

Thats it, you will never get another spam again.

 

If you want to, you could actually just replace the with a link to the your normal contact form, with something like this

 

<a href="/index .php?option=com_contact&view=contact&id=1">Ask a question about this product</a>

(Ive added a space between index and .php in that code above, as my SEF component was making it into a link and showing it as a SEF link lol, So you need to remove that space of course)

 

Which will link to your contact form, just make sure your id number is correct, so it goes to the right contact form.

 

Regards

Ian

 

Trackback(0)
Comments (0)add comment

Write comment
smaller | bigger
password
 

busy
 

© 1998 - 2009 New World Designs
Website hosted by New World Hosting Home | Photography | Web Design | Legal Documents | Blog