Hi, I'd like to add some extra fields in ask a question form. I've read other topics about this but they're all for VM 1.x. Infact on VM 2 I can't find the file ps_communication. Anyway, can you tell me what's the procedure to add fields?
Thank you :)
I have the same question.
In the old Virtuemart is easy to add new fields.
The Steps
This is how I got it to work.
Edit: administrator/components/com_virtuemart/languages/shop/english.php
At line 70
Add: 'PHONE_PROMPT' => 'Enter your Phone Number',
Edit: components/com_virtuemart/themes/default/templates/pages/shop.ask.tpl.php
At line 32
Or where you want your phone field to appear.
Add:
<label for="phone"><?php echo $VM_LANG->_('PHONE_PROMPT') ?></label>
<br /><input type="text" id="phone" name="phone" size="50" class="inputbox" value="">
<br /><br />
Edit: administrator/components/com_virtuemart/html/shop.ask.php
At line 80
Add
'phone' => $phone,
Edit: administrator/components/com_virtuemart/classes/ps_communication.php
At line 156
Add: $phone = $d['phone'];
At line 157
Change to: $subject_msg = vmRequest::getVar( 'text', '', 'post', 'phone' );
At line 205
Add: 'phone' => $phone,
Edit: components/com_virtuemart/themes/default/templates/order_emails/enquiry_email.tpl.php
Add: <?php echo $phone ?>
New Virtuemart 2.0
Edit: language/en-GB/en-GB.com_virtuemart.ini
Add: COM_VIRTUEMART_ASK_PHONE="Enter your Phone Number"
EDIT: components/com_virtuemart/views/askquestion/tmpl/form.php
where you want your phone field to appear.
<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_NAME') ?> : <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"/></label>
<br />
<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_EMAIL') ?> : <input type="text" class="validate[required,custom[email]]" value="<?php echo $this->user->email ?>" name="email" id="email" size="30" validation="required email"/></label>
<br/>
<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_PHONE') ?> : <input type="text" class="validate[required]" value="<?php echo $this->user->phone ?>" name="phone" id="phone" size="30" validation="required phone"/></label>
<br/>
<label>
Also need to edit the file com_virtuemart/views/askquestion/tmpl/mail_html_question.php
<table class="html-email" cellspacing="0" cellpadding="0" border="0" width="100%"> <tr >
<th width="100%">
<?php echo JText::_('COM_VIRTUEMART_QUESTION_ABOUT').' '.$this->product->product_name ?>
</th>
</tr>
<tr>
<td valign="top" width="100%">
<?php
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user['name'], $this->user['email']) . "<br />";
// Add "phone" When sending the message //
echo $this->comment. "<br />";
?>
</td>
</tr>
</table>
Please help me to add new field in "Ask A Question"
What other files need to edit?
Hi, I also want such customization, any updates on this ?
Thanks!
I am also facing the same problem in virtuemart 2.0, one could evaluate a solution for this?
This field is very important to shop around, but I could not build something and did not find any solution in the search.
Does anyone have an idea to finish the code?
New Virtuemart 2.0!!!!!
Edit: language/en-GB/en-GB.com_virtuemart.ini
Add: COM_VIRTUEMART_ASK_PHONE="Enter your Phone Number"
EDIT: components/com_virtuemart/views/askquestion/tmpl/form.php
where you want your phone field to appear.
<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_NAME') ?> : <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"/></label>
<br />
<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_EMAIL') ?> : <input type="text" class="validate[required,custom[email]]" value="<?php echo $this->user->email ?>" name="email" id="email" size="30" validation="required email"/></label>
<br/>
<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_PHONE') ?> : <input type="text" class="validate[required]" value="<?php echo $this->user->phone ?>" name="phone" id="phone" size="30" validation="required phone"/></label>
<br/>
<label>
Also need to edit the file com_virtuemart/views/askquestion/tmpl/mail_html_question.php
<table class="html-email" cellspacing="0" cellpadding="0" border="0" width="100%"> <tr >
<th width="100%">
<?php echo JText::_('COM_VIRTUEMART_QUESTION_ABOUT').' '.$this->product->product_name ?>
</th>
</tr>
<tr>
<td valign="top" width="100%">
<?php
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user['name'], $this->user['email']) . "<br />";
echo $this->phone. "<br />";
echo $this->comment. "<br />";
?>
</td>
</tr>
</table>
Also need to edit the file com_virtuemart/views/askquestion/view.html.php in line 44
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user['name'], $this->user['email']) . "<br />";
echo $this->phone. "<br />";
echo $this->comment. "<br />";
?>
Also need to edit the file com_virtuemart/views/askquestion/tmpl/mail_raw_question.php
<?php
echo JText::sprintf('COM_VIRTUEMART_WELCOME_VENDOR', $this->vendor->vendor_store_name) . "\n" . "\n";
echo JText::_('COM_VIRTUEMART_QUESTION_ABOUT') . ' '. $this->product->product_name."\n" . "\n";
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user->name, $this->user->email) . "\n";
echo $this->phone. "\n";
echo $this->comment. "\n";
Problem solved, the phone appears in the e-mail notification.
PS: It is important to check what files virtuemart is calling when loading the form. In my case, he was calling the folder template \ html \ com_virtuemart
I'm posting this because I have not found anything on the internet, if you had your problem solved sends a post, thanks!!
rodrigo-fuchs,
if you are a coder,
instead of hacking the "core"
Why not, add the form field.
Then, join the "phone", and "question" into the same string?
Hi BanquetTables,
I'm not a programmer, working with webdesign.
I tried this way but could not.
You seem to have advanced knowledge in this field would help as would be the final code for this solution?
Thanks for the suggestion!
great work rodrigo-fuchs, I think that you should just correct the 4. group of changes. Namely, I think it is just a copy/paste error and it shouldn't be:
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user['name'], $this->user['email']) . "<br />";
echo $this->phone. "<br />";
echo $this->comment. "<br />";
?>
but
function renderMailLayout() {
$this->setLayout('mail_html_question');
$this->comment = JRequest::getString('comment');
$this->phone = JRequest::getString('phone');
in view.html.php
Greets!
Can anyone tell me what to do with virtuemart 3 with joomla 3.4 version for extra field "phone" in ask a question form. Please help me.