News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

AskQuestion - Add Fields - Help!

Started by mikidudle, April 20, 2018, 01:06:29 AM

Previous topic - Next topic

mikidudle

Hello.  Please forgive me - I am experiencing some deep frustration around this topic.  I'm so confused and I really could use some help.

I am running Joomla! 3.8.7 and Virturemart 3.2.14
I am using the Protostar template
I am using overrides and have successfully copied the askquestion files to home-root/templates/html/com_virtuemart/askquestion and they function fine as long as I put all the files under the askquestion folder and remove the tmpl folder.
I am using OVERRIDE variable that equals 'Your Phone Number' for the label portion of the text box.

I have followed to the letter many suggestions concerning this topic, including: "Add custom field (Phone Number) to 'Ask A Question' form - VirtueMart 3 by User SAWebCo"  The results are that the form does not send data to the sent email.
For two weeks my customer waits. I can see phone (and even address) field when I create them for the form but they never transfer to the email.
I have attached the 4 files that concern this process.  Can anyone tell me what I am doing wrong? 
Thank you so much - in advance.
Mike

StefanSTS

Hi,

I did that for a customer once.

I added a core override for the view.html.php of askquestion view. Find the section that looks similar and add all the stuff with $phonenumber.

$this->user = JFactory::getUser ();
if (empty($this->user->id)) {
   $fromMail = vRequest::getEmail ('email'); //is sanitized then
   $fromName = vRequest::getVar ('name', ''); //is sanitized then
   $phonenumber = vRequest::getVar ('phone', '');
   //$fromMail = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromMail);
   $fromName = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $fromName);
   $phonenumber = str_replace (array('\'', '"', ',', '%', '*', '/', '\\', '?', '^', '`', '{', '}', '|', '~'), array(''), $phonenumber);
   $this->user->email = $fromMail;
   $this->user->name = $fromName;
   $this->user->phone = $phonenumber;
}

Hope it helps
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

mikidudle

Thanks Stefan,
This is a little different from what I was doing and while it wasn't rejected it did not in fact make the phone number appear in the email.
I am at such a loss. 
I've tried to use the variable 'phone', 'phonenumber' (as you did), and also tried $this->phone as well as $this->user->phone and variations on that theme.
Any other ideas?

StefanSTS

Hi Mike,

I thought you might have changed the form.php for the askquestion view already.

Just find the part that looks like the following and add the TR with the phone:


<table class="askform">
<tr>
<td><label for="name"><?php echo vmText::_('COM_VIRTUEMART_USER_FORM_NAME')  ?> : </label></td>
<td><input type="text" class="validate[required,minSize[3],maxSize[64]]" value="<?php echo $this->user->name $this->user->name $sessData['name'?>" name="name" id="name" size="30"  validation="required name"/></td>
</tr>
<tr>
<td><label for="email"><?php echo vmText::_('COM_VIRTUEMART_USER_FORM_EMAIL')  ?> : </label></td>
<td><input type="text" class="validate[required,custom[email]]" value="<?php echo $this->user->email $this->user->email $sessData['email'?>" name="email" id="email" size="30"  validation="required email"/></td>
</tr>
<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>
</table>


Hope that helps
Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.