VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: yableh on July 10, 2018, 17:51:08 PM

Title: product inquiry additional field
Post by: yableh on July 10, 2018, 17:51:08 PM
Hi,

Please i need to add a field to Product inquiry popup. (VirtueMart 3.2.14)

For now we can only get the Name and The E-mail but i need get the Phone number also, this field will not be mandatory.

someone can help me?

Thank you
Title: Re: product inquiry additional field
Post by: jenkinhill on July 10, 2018, 18:04:11 PM
See http://forum.virtuemart.net/index.php?topic=140031
Title: Re: product inquiry additional field
Post by: yableh on July 10, 2018, 18:18:47 PM
Quote from: jenkinhill on July 10, 2018, 18:04:11 PM
See http://forum.virtuemart.net/index.php?topic=140031

Thank you.
Title: Re: product inquiry additional field
Post by: yableh on July 10, 2018, 19:07:40 PM
I tried with no luck. I was able to display the phone field, but the phone number does not appear in the mail
Title: Re: product inquiry additional field
Post by: Studio 42 on July 10, 2018, 23:08:51 PM
You need to add entered phone in /components/com_virtuemart/views/askquestion/tmpl/mail_html_question.php
or better do an override in your template
Title: Re: product inquiry additional field
Post by: yableh on July 11, 2018, 02:12:54 AM
Quote from: Studio 42 on July 10, 2018, 23:08:51 PM
You need to add entered phone in /components/com_virtuemart/views/askquestion/tmpl/mail_html_question.php
or better do an override in your template

Thank you but still receive only Name and E-mail.

I add those lines in com_virtuemart/views/askquestion/view.html.php:

$phonenumber = vRequest::getVar ('phone', '');
$phonenumber = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $phonenumber);
$this->user->phone = $phonenumber;

Then in templates/my_template/html/com_virtuemart/askquestion/form.php ( i am using joomla / vm template from Gavick)

<tr>
      <td><label for="phone"><?php echo vmText::_('COM_VIRTUEMART_USER_FORM_PHONE')  ?> : </label></td>
      <td><input type="text" class="validate[required,custom[phone]]" value="<?php echo $this->user->phone ? $this->user->phone : $sessData['phone'] ?>" name="phone" id="phone" size="30"  validation="required phone"/></td>
   </tr>


Then in /components/com_virtuemart/views/askquestion/tmpl/mail_html_question.php

$this->user->phone