News:

Support the VirtueMart project and become a member

Main Menu

How to add Custom Fields to "Ask A Question../Call for Price" ??

Started by Jovi007, June 28, 2012, 17:29:49 PM

Previous topic - Next topic

Jovi007

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

Jovi007

I am still in need of this help. If anyone can provide me with the information it would be GREATLY APPRECIATED!

Thank you!

Carlos

Engholm

I have the same request. Any ideas for this?

Regards,
Engholm

tvver


ptfeplastics


molenwal1

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>


Webdesign, Joomla, Virtuemart, Webshop, Webhosting, SEO

vega55

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

jenkinhill

What? This is a 2 year old thread so what has your problem to do with that obviously old VM version?
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

vega55

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";

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

vega55

VirtueMart 2.9.9b

The problem continues

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

GJC Web Design

QuoteVirtueMart 2.9.9b

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

what's wrong with using the current VM3.0.6.2?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation