Page 1 of 1

Comment In Email Confirmation for Specific Product

Posted: Thu Nov 01, 2018 3:02 am
by billhobbs
I need to add a comment to the confirmation email. The comment needs to be specific to a particular product. Only one product will need to have the comment in the email. Any other product should not need this. Is this possible?

Re: Comment In Email Confirmation for Specific Product

Posted: Mon Nov 05, 2018 12:38 am
by oc-extensions
Hi,

There's few ways to do this, from adding a custom field for products to the easiest way (modify order email)

You can modify mail/order.tpl OR mail/order.twig (depending on your OpenCart version) like this:

You have area:

Code: Select all

<?php foreach ($products as $product) { ?>
      <tr>
      <td> ... product_name ... 
      
      </td>
      ....
to

Code: Select all

<?php foreach ($products as $product) { ?>
      <tr>
      <td> ... product_name ... 
      <?php if ($product['product_id'] == 77) { ?>      // assumming that 77 is ID of product where you want to add some comment
      some cool comment here like: OC-Extensions.com is  the best :)
      <?php } ?>
      </td>
Of course, if you want more complex solution, you can modify products to also support to add comment is admin and in order when product has some comment assigned to show it.

Wish you many sales,

Vasile Ciotu
Software Engineer @ OC-Extensions