View Single Post
  #5  
Old 04-18-2013, 01:12 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Changing the "Ask a question about this product" form

ok, I put this together quickly for you... tested and working fine on v4.5.5

1) skin/common_files/customer/main/ask_question.tpl

After...

Code:
<tr> <td class="data-name"><label for="phone">{$lng.lbl_phone}</label></td> <td>&nbsp;</td> <td> <input type="text" name="phone" id="phone" value="" size="30" /> </td> </tr>

Insert...

Code:
{*--------------------------------*} <tr> <td class="data-name"><label for="sample">Request a Sample</label></td> <td>&nbsp;</td> <td> <input type="checkbox" name="sample" id="sample" /> </td> </tr> <tr style="display:none" class="samples"> <td colspan="3"> <div class="field-container"> <div class="data-name"> <label for="product" class="data-required">Product</label> </div> <div class="data-value"> <input type="text" name="product" id="product" value="{$product.product}" style="width:100%" readonly /> </div> </div> </td> </tr> <tr style="display:none" class="samples"> <td colspan="3"> <div class="field-container"> <div class="data-name"> <label for="address" class="data-required">Address</label> <span class="star">*</span> </div> <div class="data-value"> <textarea name="address" id="address" rows="4" style="width:100%"></textarea> </div> </div> </td> </tr> {literal} <script type="text/javascript"> $("input#sample").click(function(){ if($("input#sample").attr('checked')) { $(".samples").fadeIn(); }else{ $(".samples").fadeOut(); } }); </script> {/literal} {*--------------------------------*}


2) In popup_ask.php

After...

Code:
|| empty($_POST['question'])


Insert...

Code:
|| ($_POST['sample'] == "on" && empty($_POST['address'])) // XCARTMODS ADDED


Then after...

Code:
$mail_smarty->assign('product', $product['product']);

Insert...

Code:
$mail_smarty->assign('sample', $_POST['sample']); // XCARTMODS ADDED $mail_smarty->assign('address', $_POST['address']); // XCARTMODS ADDED

Then after...

Code:
$smarty->assign('productid', $productid);

Insert...

Code:
$smarty->assign('product', $product); // XCARTMODS ADDED

3) In skin/common_files/mail/html/ask_question.tpl

After...

Code:
{if $phone} <tr> <td><b>{$lng.lbl_phone}:</b></td> <td>&nbsp;</td> <td>{$phone|escape}</td> </tr> {/if}

Insert...

Code:
{if $sample eq "on"} <tr> <td><b>Sample Requested:</b></td> <td>&nbsp;</td> <td>Yes</td> </tr> <tr> <td><b>Address:</b></td> <td>&nbsp;</td> <td>{$address|escape}</td> </tr> {/if}

4) Do a template cleanup.

Done
__________________
xcartmods.co.uk
Reply With Quote