VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: Jovi007 on June 28, 2012, 17:29:49 PM

Title: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: Jovi007 on June 28, 2012, 17:29:49 PM
I would like to know how to add custom fields to the forms provided for "Call for Price" and "Ask a Question about Product".

Namely, I'd like to add fields such as Company Name, Phone Number, Country, etc.

I was able to accomplish this in the earlier version of VirtueMart, but cannot find the files needed in the VM2.

If anyone knows how or can point me in the right direction, IT WILL BE GREATLY APPRECIATED!

Thank you in advance,

Carlos
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: Jovi007 on July 17, 2012, 18:16:12 PM
I am still in need of this help. If anyone can provide me with the information it would be GREATLY APPRECIATED!

Thank you!

Carlos
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: Engholm on August 22, 2012, 10:46:02 AM
I have the same request. Any ideas for this?

Regards,
Engholm
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: tvver on September 05, 2012, 03:57:43 AM
I could really use some help on this too. Anyone? Anyone?
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: ptfeplastics on September 05, 2012, 09:50:04 AM
I also have this problem,anyone could help us?
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: molenwal1 on September 11, 2012, 07:50:52 AM
As is do not want to hack in the VM core code, i have solved it this way to add a phone field:
Copy from directory components/com_virtuemart/views/askquestion the files form.php and mail_html_question.php to your template in html/com_virtuemart/askquestion.

In form.php changed the form to:

<form method="post" class="form-validate" action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$this->product->virtuemart_product_id.'&virtuemart_category_id='.$this->product->virtuemart_category_id.'&tmpl=component') ; ?>" name="askform" id="askform">

  <label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_NAME')  ?> : </label><input type="text" class="validate[required,minSize[4],maxSize[64]]" value="<?php echo $this->user->name ?>" name="name" id="name" size="30"  validation="required name"/>
   <br /><br />
  <label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_EMAIL')  ?> : </label><input type="text" class="validate[required,custom[email]]" value="<?php echo $this->user->email ?>" name="email" id="email" size="30"  validation="required email"/>
  <br/><br />
  <label><?php echo JText::_('COM_VIRTUEMART_SHOPPER_FORM_PHONE')  ?> : </label><input type="text" class="validate[required,custom[phone]]" value="<?php echo $this->phone ?>" name="phone" id="phone" size="30"  validation="required phone"/>
  <br/><br />
  <label>
    <?php
    $ask_comment 
JText::sprintf('COM_VIRTUEMART_ASK_COMMENT'$min$max);
    echo 
$ask_comment;
    
?>

    </label>
  <br />
  <textarea title="<?php echo $ask_comment ?>" class="validate[required,minSize[<?php echo $min ?>],maxSize[<?php echo $max ?>]] field" id="comment" name="comment" rows="10"></textarea>

  <div class="submit">
    <input class="highlight-button" type="submit" name="submit_ask" title="<?php echo JText::_('COM_VIRTUEMART_ASK_SUBMIT')  ?>" value="<?php echo JText::_('COM_VIRTUEMART_ASK_SUBMIT')  ?>" />

    <div class="width50 floatright right paddingtop">
      <?php echo JText::_('COM_VIRTUEMART_ASK_COUNT')  ?>
       <input type="text" value="0" size="4" class="counter" id="counter" name="counter" maxlength="4" readonly="readonly" />
    </div>
  </div>

  <input type="hidden" name="virtuemart_product_id" value="<?php echo JRequest::getInt('virtuemart_product_id',0); ?>" />
  <input type="hidden" name="tmpl" value="component" />
  <input type="hidden" name="view" value="productdetails" />
  <input type="hidden" name="option" value="com_virtuemart" />
  <input type="hidden" name="virtuemart_category_id" value="<?php echo JRequest::getInt('virtuemart_category_id'); ?>" />
  <input type="hidden" name="task" value="mailAskquestion" />
  <?php echo JHTML::_'form.token' ); ?>
</form>



In mail_html_question.php at start:

<?php
defined
('_JEXEC') or die('');
$this->phone JRequest::getString ('phone');
?>


And this:
<td valign="top" width="100%">
    <?php
   
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM'$this->user['name']) . "<br />";
   echo 
JText::_('COM_VIRTUEMART_USER_FORM_EMAIL') . " : " $this->user['email'] . "<br />";
   echo 
JText::_('COM_VIRTUEMART_SHOPPER_FORM_PHONE') . " : " $this->phone "<br />";
   echo 
$this->comment"<br />";
  
?>

</td>


Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: vega55 on March 06, 2015, 04:42:57 AM
file upload?
<td><label><?php echo JText::_('COM_VIRTUEMART_FILES_FORM_FILE')  ?> : </label></td>
<td><input type="file" class="validate[required,custom[file]]" value="<?php echo $this->user->file ?>" name="file" id="file" size="30"  validation="required file"/></td>
</tr>


jqv:custom rule not found file error

please help
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: jenkinhill on March 06, 2015, 11:21:09 AM
What? This is a 2 year old thread so what has your problem to do with that obviously old VM version?
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: vega55 on March 06, 2015, 23:52:15 PM
VirtueMart version: 2.6.4

file upload form
form error : "jqv:custom rule not found file"

form php

<td><label><?php echo JText::_('COM_VIRTUEMART_FILES_FORM_FILE')  ?> : </label></td>
<td><input type="file" class="validate[required,custom[file]]" value="<?php echo $this->user->file ?>" name="file" id="file" size="30"  validation="required file"/></td>
</tr>


mail_html_question.php

<tr>
<td align="center" style="border-bottom : 1px solid #dad8d8;">
<span style="font-size: 14px; font-weight: bold"><?php echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM'$this->user['name'], $this->user['email']); ?></span>

<br /><br /><?php echo $this->file"<br />";
<br /><br /><?php echo $this->comment?>
<br /><br />
</td>
</tr>


mail_raw_question.php

<?php
defined
('_JEXEC') or die('');

echo 
JText::sprintf('COM_VIRTUEMART_WELCOME_VENDOR'$this->vendor->vendor_store_name) . "\n" "\n";
echo 
JText::_('COM_VIRTUEMART_QUESTION_ABOUT') . ' '$this->product->product_name;
if (
$this->product->product_sku) echo ' ('.JText::_('COM_VIRTUEMART_PRODUCT_SKU').' '.$this->product->product_sku .')' ;
echo 
"\n" "\n";
echo 
JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM'$this->user->name$this->user->email) . "\n";
echo 
$this->file"\n";
echo 
$this->comment"\n";
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: jenkinhill on March 07, 2015, 00:01:01 AM
Quote from: vega55 on March 06, 2015, 23:52:15 PM
VirtueMart version: 2.6.4

http://virtuemart.net/news/latest-news/462-security-release-of-vm2-6-10-and-vm2-9-9b
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: vega55 on March 07, 2015, 01:10:26 AM
VirtueMart 2.9.9b

The problem continues

file upload form
form error : "jqv:custom rule not found file"
:-[ :-[ :-[ :-[ :-[ :-[
Title: Re: How to add Custom Fields to "Ask A Question../Call for Price" ??
Post by: GJC Web Design on March 07, 2015, 02:02:23 AM
QuoteVirtueMart 2.9.9b

a non stable test version for pre release VM3??????

what's wrong with using the current VM3.0.6.2?