Post by daveydave » Thu Mar 22, 2018 9:38 pm

Hello,
I'm upgrading an OpenCart site from 1.5 to 3.0.2.0. In the old site, I had added the ability (thanks to this forum) to include the SKU and UPC in emails. I've gone through the changes I made to implement this and it now looks very different in the latest version of OC. I've searched the forums and not been able to find any posts on this subject for this version. Does anyone have a clue where to start?

I'm currently looking at
catalog/model/checkout/order.php

and
catalog/controller/checkout/order.php

Am I at least starting in the right place?

New member

Posts

Joined
Fri Aug 28, 2015 10:26 pm

Post by straightlight » Thu Mar 22, 2018 9:41 pm

daveydave wrote:
Thu Mar 22, 2018 9:38 pm
Hello,
I'm upgrading an OpenCart site from 1.5 to 3.0.2.0. In the old site, I had added the ability (thanks to this forum) to include the SKU and UPC in emails. I've gone through the changes I made to implement this and it now looks very different in the latest version of OC. I've searched the forums and not been able to find any posts on this subject for this version. Does anyone have a clue where to start?

I'm currently looking at
catalog/model/checkout/order.php

and
catalog/controller/checkout/order.php

Am I at least starting in the right place?
How different? What are you looking for to do exactly? More information is needed.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by daveydave » Thu Mar 22, 2018 9:44 pm

I'm just looking to include UPC and SKU in the email that customers get.

New member

Posts

Joined
Fri Aug 28, 2015 10:26 pm

Post by straightlight » Thu Mar 22, 2018 9:51 pm

Which email are you specifically looking for?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by daveydave » Thu Mar 22, 2018 9:57 pm

Either the email they get on completing a purchase or the email the shop owner gets on a purchase. Basically, the receipt email. As it is, it does not include SKU or UPC when I tried adding it in the theme.

New member

Posts

Joined
Fri Aug 28, 2015 10:26 pm

Post by straightlight » Thu Mar 22, 2018 10:06 pm

In catalog/controller/mail/order.php file,

find all instances of:

Code: Select all

$this->load->model('tool/upload');
add below each:

Code: Select all

$this->load->model('catalog/product');
Then, find all instances of:

Code: Select all

$data['products'][] = array(
add above each:

Code: Select all

$product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
Then, find all instances of:

Code: Select all

'model'    => $order_product['model'],
add below each:

Code: Select all

'upc'     => (!empty($product_info['upc']) ? strip_tags(html_entity_decode($product_info['upc'], ENT_QUOTES, 'UTF-8')) : ''),
'sku'     => (!empty($product_info['sku']) ? strip_tags(html_entity_decode($product_info['sku'], ENT_QUOTES, 'UTF-8')) : ''),
In catalog/view/theme/<your_theme>/template/mail/order_alert.twig file,

find:

Code: Select all

{% for product in products %}
you can add:

Code: Select all

{{ product.upc }}

{{ product.sku }}
before the second: {% endfor %} ending below. This should resolved the issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by daveydave » Thu Mar 22, 2018 10:57 pm

That worked perfectly.

Thank you so much!

New member

Posts

Joined
Fri Aug 28, 2015 10:26 pm

Post by SynysterDory » Wed Feb 19, 2020 12:12 am

straightlight wrote:
Thu Mar 22, 2018 10:06 pm
In catalog/controller/mail/order.php file,

find all instances of:

Code: Select all

$this->load->model('tool/upload');
...
It's been a long time since this has been posted.
Can you help me to achive that?, I tried your but it didn't work
OC 3.0.3.2

New member

Posts

Joined
Fri Nov 22, 2019 3:52 am
Location - México

Post by straightlight » Wed Feb 19, 2020 2:21 am

SynysterDory wrote:
Wed Feb 19, 2020 12:12 am
straightlight wrote:
Thu Mar 22, 2018 10:06 pm
In catalog/controller/mail/order.php file,

find all instances of:

Code: Select all

$this->load->model('tool/upload');
...
It's been a long time since this has been posted.
Can you help me to achive that?, I tried your but it didn't work
OC 3.0.3.2
PM sent.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Bing [Bot], shanghua and 463 guests