Lunarhotel.co.uk

How about a view of the sea of tranquility?
Home Joomla things Dealing with spam on the Virtuemart Ask a question about this product page
E-mail
Print
PDF
Written by Web Master   
Monday, 23 November 2009 18:31
User Rating: / 2
PoorBest 
Article Index
Dealing with spam on the Virtuemart Ask a question about this product page
Making the changes
All Pages

Anyone who's setup an online store with Virtuemart will know about the "Ask a question about this product" page being spammed. Opinion is divided between introducing a CAPTCHA system (requires a lot of core hacks) to removing the link all together. This is my solution which is somewhere between the two.

If the product "Ask a question" page is visited, this code alteration will ask the user to login, or register before asking a question.

This alteration only requires changes to shop.ask.tpl. Therefore you can safely upgrade VirtueMart without fear of loosing the changes.

Backup your files before you do this, or indeed any code change of any kind. You've been warned

Note: Ive attached to the bottom of this article a pre-modified version of shop.ask.tpl.php (zipped) for Virtuemart 1.1.4. Ive not tested it on other versions.

Load up the file /components/com_virtuemart/themes/<your theme>/templates/pages/shop.ask.tpl.php in your editor, you should see something like this

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
mm_showMyFileName( __FILE__ );

if ( $set == 0 ) { // This is the enquiry form!


$validate = vmIsJoomla( '1.5' ) ? JUtility::getHash( $mainframe->getCfg( 'db' ) ) : mosHash( $mainframe->getCfg( 'db' ) );

?>
<br />
<a class="button" href="/<?php echo $product_link ?>"><?php echo $VM_LANG->_('VM_RETURN_TO_PRODUCT') ?></a>
<br /><br />

<form action="<?php echo $mm_action_url ?>index.php" method="post" name="emailForm" id="emailForm">
<label for="contact_name"><?php echo $VM_LANG->_('NAME_PROMPT') ?></label>
<br /><input type="text" name="name" id="contact_name" size="80" class="inputbox" value="<?php echo $name ?>"><br /><br />
<label for="contact_mail"><?php echo $VM_LANG->_('EMAIL_PROMPT') ?></label>
<br /><input type="text" id="contact_mail" name="email" size="80" label="Your email" class="inputbox" value="<?php echo $email ?>"><br /><br />
<label for="contact_text"><?php echo $VM_LANG->_('MESSAGE_PROMPT') ?></label><br />
.
.
.

Continued on the next page.....



Last Updated on Monday, 23 November 2009 21:29
 

You must register if you wish to comment

Joomla EmailAsUsername Testamonials

"Thanks for a great plugin, and speedy helpful support."

"I really appreciate how responsive you have been and I want to reward you by adding a very positive comment on the Joomla site where I found your great plugin"

"Wow, tested it out and works like a champ"

"I had a couple of installation issues which Dylan sorted for me the same afternoon. Superb service for the price."

"Thank you!!!  Best support I have ever had!"

"Thank you soooooo much for your time and effort on this, you're a life saver!....If your ever in the London or Guildford area I'll get the beers in!"

Whos online

We have 7 guests online