Author Topic: How to disable Product Inquiry?  (Read 23439 times)

Spellscape

  • Beginner
  • *
  • Posts: 29
How to disable Product Inquiry?
« on: October 09, 2011, 10:46:39 am »
Hi all
How to disable Product Inquiry? I'm getting to much spam from it and it's not really needed for my site.

filterit

  • Jr. Member
  • **
  • Posts: 147
Re: How to disable Product Inquiry?
« Reply #1 on: November 13, 2011, 13:53:31 pm »
First disable the code as this can be called directley.

com_virtuemart/themes/default(or what ever you use)/templates/pages/shop.ask.tpl.php

Change these few lines

mm_showMyFileName( __FILE__ );

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


at the end

}
**/
?>

The above will also take out the ability form spamers to call the link directley.

Then take the link out of your /themes/VM_THEME/templates/browse/

Or leave it in and use this.

http://forum.virtuemart.net/index.php?topic=66513.0

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10375
  • VirtueMart Version: 3+
Re: How to disable Product Inquiry?
« Reply #2 on: November 13, 2011, 15:05:12 pm »
you can header redirect if you want  shop.ask.tpl
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );header('Location: http://SITE.com/');
exit;


OR, what I do is add a spam question field at the top of the file. THE question is actually a picture, so spammers do not read it.


<label for="ziptie"><img style="vertical-align:middle" src="images/spampre.png"></label>
   <input type="text" name="ziptie" id="ziptie" size="10" class="inputbox" value="<?php echo $ziptie ?>"><br /><br />

THEN validate the field. like this


else if ( ( document.emailForm.ziptie.value.search("1234") ==-1 ) || ( document.emailForm.ziptie.value.search("1234") ==-1 ) || ( document.emailForm.ziptie.value.search("1234") ==-1 ) ) {
         alert( "Make sure the spam prevention question is correct" );

      }

PASTE the above code right after this:

alert( "You cannot enter more than one email address" );

      }

[attachment cleanup by admin]
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

tvigar

  • Beginner
  • *
  • Posts: 11
Re: How to disable Product Inquiry?
« Reply #3 on: November 18, 2011, 20:32:19 pm »
Excellent work!

Thank you for the ziptie tutorial!

That worked perfectly!

Stingraynut

  • Beginner
  • *
  • Posts: 48
Re: How to disable Product Inquiry?
« Reply #4 on: December 05, 2011, 04:28:55 am »
This looks to be the answer to my spam problem but nothing happens!!

In configuration>site it shows the template as vjm_eros

I went to      components/com_virtuemart/themes/  vmj_eros/templates/pages/shop.ask.tpl.php

I inserted the code as indicated and there was no change on refreshing the product enquiry form-

I renamed the shop.ask.tpl.php file and the product enquiry form still showed!!!

I don't want to hijack this extremely useful thread so I've posted my problem as a new topic - https://forum.virtuemart.net/index.php?topic=94361.0

Rob

Tikkiro

  • Jr. Member
  • **
  • Posts: 88
Re: How to disable Product Inquiry?
« Reply #5 on: December 09, 2011, 19:12:09 pm »
Hi all
Like others I'm getting hammered by this problem at the minute despite the latest version.  I've just tried to edit the PHP file but given I've zilch knowledge of what I'm doing really in there, wonder if someone could take 2 secs to point out whatever the (probably obvious) error is on it as it just crashes my site without an error msg?   Thanks.

Code: [Select]
<script type="text/javascript"><!--
function validateEnquiryForm() {
if ( ( document.emailForm.text.value == "" ) || ( document.emailForm.email.value.search("@") == -1 ) || ( document.emailForm.email.value.search("[.*]" ) == -1 ) ) {
alert( "<?php echo $VM_LANG->_('CONTACT_FORM_NC',false); ?>" );
} else if ( ( document.emailForm.email.value.search(";") != -1 ) || ( document.emailForm.email.value.search(",") != -1 ) || ( document.emailForm.email.value.search(" ") != -1 ) ) {
alert( "You cannot enter more than one email address" );
} <label for="ziptie"><img style="vertical-align:middle" src="images/spampre.png"></label>
          <input type="text" name="ziptie" id="ziptie" size="10" class="inputbox" value="<?php echo $ziptie ?>"><br /><br />
          else if ( ( document.emailForm.ziptie.value.search("1234") ==-1 ) || ( document.emailForm.ziptie.value.search("4") ==-1 ) || ( document.emailForm.ziptie.value.search("4") ==-1 ) ) {
         alert( "Make sure the spam prevention question is correct" );
        }
        else {
document.emailForm.action = "<?php echo sefRelToAbs("index.php"); ?>"
document.emailForm.submit();
}
}
--></script>

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10375
  • VirtueMart Version: 3+
Re: How to disable Product Inquiry?
« Reply #6 on: December 09, 2011, 20:18:44 pm »
THIS

<input type="text" name="ziptie" id="ziptie" size="10" class="inputbox" value="<?php echo $ziptie ?>"><br /><br />

SHOULD BE IN TH FORM, NOT the validation.

Right above the name field etc
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Tikkiro

  • Jr. Member
  • **
  • Posts: 88
Re: How to disable Product Inquiry?
« Reply #7 on: December 09, 2011, 21:10:00 pm »
THanks so much for that - figured it would be something simple but ignorance as always causes endless problems :).  Appreciate your speedy response.

Stingraynut

  • Beginner
  • *
  • Posts: 48
Re: How to disable Product Inquiry?
« Reply #8 on: December 16, 2011, 03:49:40 am »
I'm doing something wrong, although I think I am following the instructions -
At the top of shop.ask.tpl.php I have this -
Code: [Select]
<?php
if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );


<
label for="ziptie"><img style="vertical-align:middle" src="images/spampre.png"></label>
   <
input type="text" name="ziptie" id="ziptie" size="10" class="inputbox" value="<?php echo $ziptie ?>
"><br /><br />
/**
*
* @version $Id: shop.ask.tpl.php 1597 2009-01-05 20:16:22Z soeren_nb $
* @package VirtueMart
* @subpackage themes
* @copyright Copyright (C) 2007-2009 soeren - All rights reserved.
* @

Then down in the form I have this -
Code: [Select]
<script type="text/javascript"><!--
function validateEnquiryForm() {
if ( ( document.emailForm.text.value == "" ) || ( document.emailForm.email.value.search("@") == -1 ) || ( document.emailForm.email.value.search("[.*]" ) == -1 ) ) {
alert( "<?php echo $VM_LANG->_('CONTACT_FORM_NC',false); ?>" );
} else if ( ( document.emailForm.email.value.search(";") != -1 ) || ( document.emailForm.email.value.search(",") != -1 ) || ( document.emailForm.email.value.search(" ") != -1 ) ) {
alert( "You cannot enter more than one email address" );
}

else if ( ( document.emailForm.ziptie.value.search("1234") ==-1 ) || ( document.emailForm.ziptie.value.search("4") ==-1 ) || ( document.emailForm.ziptie.value.search("4") ==-1 ) ) {
         alert( "Make sure the spam prevention question is correct" );

      }

else {
document.emailForm.action = "<?php echo sefRelToAbs("index.php"); ?>"
document.emailForm.submit();
}
}
--></script>

<?php

Unfortunately the result is a blank page

Reading the correction above, I moved " <input type="text" name="ziptie" id="ziptie" size="10" class="inputbox" value="<?php echo $ziptie ?>"><br /><br />" to the form, leaving "<label for="ziptie"><img style="vertical-align:middle" src="images/spampre.png"></label>"  at the top

Code: [Select]
<form action="<?php echo $mm_action_url ?>index.php" method="post" name="emailForm" id="emailForm">
<input type="text" name="ziptie" id="ziptie" size="10" class="inputbox" value="<?php echo $ziptie ?>"><br /><br />
<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>



Rob

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10375
  • VirtueMart Version: 3+
Re: How to disable Product Inquiry?
« Reply #9 on: December 16, 2011, 12:49:05 pm »
the label is part of the form. Look at the rest of the code in the form.
<form>
<label> <input>

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Stingraynut

  • Beginner
  • *
  • Posts: 48
Re: How to disable Product Inquiry?
« Reply #10 on: December 17, 2011, 00:05:27 am »
I'm a bit confused here- please could someone post the code to shop.ask.tpl.php that includes all the new captcha inserted code so that i can see where everything goes?

Sorry to seem so dumb on this, I have often inserted PHP code with help from forums and seeing the complete altered code will prevent misunderstandings for others in the future.

Rob

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10375
  • VirtueMart Version: 3+
Re: How to disable Product Inquiry?
« Reply #11 on: December 17, 2011, 02:07:41 am »
Code: [Select]
<?php
if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
$doc =& JFactory::getDocument();
$doc->setMetaData'robots''noindex' );
/**
*
* @version $Id: shop.ask.tpl.php 1813 2009-06-17 18:36:15Z Aravot $
* @package VirtueMart
* @subpackage themes
* @copyright Copyright (C) 2007-2009 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName__FILE__ );

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

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

<br />

<form action="<?php echo $mm_action_url ?>index.php" method="post" name="emailForm" id="emailForm">
<label for="ziptie"><img style="vertical-align:middle" src="images/spampre.png"></label>
<input type="text" name="ziptie" id="ziptie" size="10" class="inputbox" value="<?php echo $ziptie ?>"><br /><br />
<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 />
<textarea rows="10" cols="60" name="text" id="contact_text" class="inputbox"><?php echo utf8_decode($subject?></textarea><br />

<input type="button" name="send" value="<?php echo $VM_LANG->_('SEND_BUTTON'?>" class="button" onclick="validateEnquiryForm()" />

<input type="hidden" name="product_id" value="<?php echo  $db_product->f("product_id")  ?>" />
<input type="hidden" name="product_sku" value="<?php echo  shopMakeHtmlSafe($db_product->f("product_sku"))  ?>" />
<input type="hidden" name="set" value="1" />
<input type="hidden" name="func" value="productAsk" />
<input type="hidden" name="page" value="shop.ask" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="flypage" value="<?php echo $flypage ?>" />
<input type="hidden" name="Itemid" value="<?php echo $Itemid ?>" />

<input type="hidden" name="<?php echo $validate ?>" value="1" />
</form>
<script type="text/javascript"><!--
function validateEnquiryForm() {
if ( ( document.emailForm.text.value == "" ) || ( document.emailForm.email.value.search("@") == -1 ) || ( document.emailForm.email.value.search("[.*]" ) == -1 ) ) {
alert( "<?php echo $VM_LANG->_('CONTACT_FORM_NC',false); ?>" );
} else if ( ( document.emailForm.email.value.search(";") != -1 ) || ( document.emailForm.email.value.search(",") != -1 ) || ( document.emailForm.email.value.search(" ") != -1 ) ) {
alert( "You cannot enter more than one email address" );

} else if ( ( document.emailForm.ziptie.value.search("1234") ==-1 ) || ( document.emailForm.ziptie.value.search("4") ==-1 ) || ( document.emailForm.ziptie.value.search("4") ==-1 ) ) {
alert( "Make sure the spam prevention question is correct" );

}
else {
document.emailForm.action = "<?php echo sefRelToAbs("index.php"); ?>"
document.emailForm.submit();
}
}
--></script>

<?php
}
else { 
// if set==1 then we have sent the email to the vendor and say thank you here.
  
?>

   <img src="<?php echo VM_THEMEURL ?>images/button_ok.png" height="48" width="48" align="center" alt="Success" border="0" />
   Thank You, You will be contacted shortly.
 
 
  <?php 
}
?>
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Stingraynut

  • Beginner
  • *
  • Posts: 48
Re: How to disable Product Inquiry?
« Reply #12 on: December 17, 2011, 02:49:33 am »
THANK YOU BT.pro !! Ok now I understand

BTW

At the top you have two lines I don't have
Code: [Select]
$doc =& JFactory::getDocument();
$doc->setMetaData( 'robots', 'noindex' );

should I include them?

and at the bottom I have one more line before closing the php
Code: [Select]
  <a class="button" href="<?php echo $product_link ?>"><?php echo $VM_LANG->_('VM_RETURN_TO_PRODUCT'?></a>
Is yours missing for a reason?

Thanks again,

Rob


PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10375
  • VirtueMart Version: 3+
Re: How to disable Product Inquiry?
« Reply #13 on: December 17, 2011, 13:28:33 pm »
The top is noindex for search engines, thats there for a reason.


and the bottom. MY ask question opens up in a pop up. So you should have that button in yours
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

kevinwood

  • Jr. Member
  • **
  • Posts: 151
Re: How to disable Product Inquiry?
« Reply #14 on: December 18, 2011, 18:30:49 pm »
I've never had any problems with product inquiry spam until today; I woke up to about 50 spams in my inbox, and they kept coming one every 15 minutes or so.

I don't care for captcha either so I decided to try out this suggestion.  I made my own image file asking a simple question (what is 1+2?) and added it to my shop.ask page.  I also added some code to ps_communication to ensure that spammers couldn't just auto-post the form. 

Unfortunately the spam kept coming, so it was obviously humans actually sitting there filling out the form.  At that point I decided to just change my product inquiry link to a mailto and redirect the shop.ask page to an anti-spam site.