Post by billhobbs » Thu Nov 01, 2018 3:02 am

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?

New member

Posts

Joined
Fri Feb 24, 2017 3:54 am

Post by oc-extensions » Mon Nov 05, 2018 12:38 am

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

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm
Who is online

Users browsing this forum: No registered users and 71 guests