folderNowadays, spammers are a real threat for websites. Because each website has a contact from, such forms are used by spammers in order to send spam over internet. In this article I share a way how one can protect by captcha field the “Product enquiry” form in Virtuemart 1.8 which works on Joomla 1.5.26.

The simple way is to install tinCaptcha component and plugin. We can download it from here: tinCaptcha v.1.1.

  1. First of all, we are to unpack the archive and get 2 files for component and plugin.
  2. Install the component first;
  3. Install the plugin;
  4. Go to “Extensions”->”Plugin Manager” and enable the plugin with the name as follows: “System - TinCaptcha”;
  5. By now, we are to change the code of VirtueMart as it is described in tincaptcha-v0.1.txt file which one can find in the same directory where the whole package was unpacked at step 1 of the guide:
    1. File: components/com_virtuemart/themes/default/templates/pages/shop.ask.tpl.php
      LINE ~34:
      [Code]
      -------------------------------------------------------------------------

      <textarea rows="10" cols="60" name="text" id="contact_text" class="inputbox">

      echo
      $subject ?>
      textarea><br />

      ========================================================================
      ADD AFTER:
      [Code]
      ------------------------------------------------------------------------
      if (JPluginHelper::isEnabled('system', 'tincaptcha')): ?>
          <label for="tincaptcha">php echo JText::_('TIN_CAPTCHA') ?><br />
          <input type="text" name="captcha" size="10" value="" class="inputbox" /><br />
          <img src="index.php?option=com_tincaptcha&task=captcha_display" />
          <br />
      endif; ?>
      ========================================================================
    2. LINE ~61 (before aforementioned update):
      [Code]
      ------------------------------------------------------------------------
      } else { 
          document.emailForm.action = "index.php"); ?>" 
          document.emailForm.submit(); 
      } 
      ========================================================================
      ADD BEFORE:
      [Code]
      ------------------------------------------------------------------------
      } else if ( document.emailForm.captcha.value == "" ) { 
          alert( "" ); 
      ========================================================================
    3. File: administrator/components/com_virtuemart/classes/ps_communication.php
      IN FUNCTION: mail_question()
      LINE ~138:
      [Code]
      ------------------------------------------------------------------------
      if ($db->f("product_sku")  @$d["product_sku"] ) { 
          $vmLogger->err( $VM_LANG->_('NOT_AUTH',false) ); 
          return false; 
      } 
      ========================================================================
      ADD AFTER:
      [Code]
      ------------------------------------------------------------------------
      if (JPluginHelper::isEnabled('system', 'tincaptcha')) 
      { 
          $checkSecurity = plgSystemTincaptcha::check( vmRequest::getVar('captcha', '', 'post') ); 
          if ($checkSecurity !== true) 
          { 
              JError::raiseError(500, $checkSecurity); 
              return false; 
          } 
      }  
      ========================================================================

We are done, enjoy!

About Us

Out Mission

Our mission is to fill the gap between modern technologies and real life experience.

Our Goal

Together with our customers gain in revenue and business efficiency by using cutting-edge technologies.

Payment Methods

We are using secure Paypal & Money-bookers payment method as well as wire transfer. You can pay directly form your Credit Card via Moneybookers or Paypal and NEVER store your card information on our site

Contact Us

Address : Chemin Vert 9, 1804 Corsier-sur-Vevey, Canton Vaud, Switzerland
Phone : +41 (21) 522.07.20