I would like to place a link on any product page where a potential customer can send an individual e-mail with questions about the product etc.
Linking the existent contact form is not the problem. But is it possible, to transmit the product-no as subject (or a specific string which i can pass through) like "index.php?route=information/contact&subject='Hello world'" ?
Thanks for your help!
Step 1, edit the product page:
Open catalog/view/theme/your_template/template/view/product.tpl
Search for this code:
Code: Select all
<div class="image-additional">
<?php foreach ($images as $image) { ?>
<a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="colorbox" rel="colorbox"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
<?php } ?>
</div>
Code: Select all
<a href="index.php?route=information/contact&subject=<?php echo $heading_title; ?>" class="button">Ask Question about this item</a>
Step 2, altering the contact controller:
Here you want to tell the contact page there is some more data that is to be email. You are also telling the controller thta if there is no product subject, then the subject is to be changed to the original subject used in OC.
Open catalog/controller/information/contact.php
Search for this code:
Code: Select all
$this->data['entry_captcha'] = $this->language->get('entry_captcha');
Code: Select all
if (isset($this->request->get['subject'])) {
$this->data['subject'] = $this->request->get['subject'];
}else{
$this->data['subject'] = '';
}
Code: Select all
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
Code: Select all
if(isset($this->request->post['subject'])){
$mail->setSubject(html_entity_decode(sprintf($this->request->post['subject'], $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
}else{
$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
}
Open catalog/view/theme/your_template/information/contact.tpl
Search for this code:
Code: Select all
<?php if ($error_email) { ?>
<span class="error"><?php echo $error_email; ?></span>
<?php } ?>
<br />
Code: Select all
<b>Subject: </b><br />
<b>Question about item: <?php echo $subject; ?></b>
<input type="hidden" name="subject" value="Question about item: <?php echo $subject; ?>" />
<br /><br />
I hope this helps,
Let me know how you get on
Peter
For OpenCart & PHP/MySQL support feel free to PM me
Click here for my extentions
Did I help you? Donate here to show support
For OpenCart & PHP/MySQL support feel free to PM me
Click here for my extentions
Did I help you? Donate here to show support
Did you edit all the files accordingly?
Peter
For OpenCart & PHP/MySQL support feel free to PM me
Click here for my extentions
Did I help you? Donate here to show support
For OpenCart & PHP/MySQL support feel free to PM me
Click here for my extentions
Did I help you? Donate here to show support
Cheers
https://www.opencart.com/index.php?rout ... n_id=34175
Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido
I made for 2.3.0.2 and 3.0.2.0comprido wrote: ↑Mon May 28, 2018 11:48 amI built the vqmod for more comfort on modifying files.
https://www.opencart.com/index.php?rout ... n_id=34175
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Pedro Martin - websitesbuilder.com.au
Checkout my free extensions: https://www.opencart.com/index.php?rout ... r=comprido
***1- https://www.opencart.com/index.php?rout ... load_id=47
***2- xxvirusxx vqmod
Basically “Ask Question” link should be active only when extension ***1- is on with Text “Free” and show up below “Free”
OC 2..3.0.2 - Default Theme.
Thank you
Users browsing this forum: Semrush [Bot] and 26 guests