Hi
I have added product image for invoice email as below, opencart 3.0.3.8
In catalog/controller/mail/order.php file
Find each $this->load->model('tool/upload');
Add below $this->load->model('catalog/product');
Find each $data['products'][] = array(
Add above $product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
Add below 'thumb' => $order_info['store_url'] . 'image/' . $product_info['image'],
in catalog/view/theme/default/template/mail/order_add.twig
Add <img src="{{ product.thumb }}" width="" height="" /> to position display
Any problem with this way? i want to load products image for email invoice from $this->load->model('tool/image'); but it doesn't work.
Anyone have another solution? please help
Thank you very much!
Please refer to your catalog/controller/product/product.php and look for: $this->model_tool_image lines.Van Quyen wrote: ↑Thu May 12, 2022 1:21 amHi
I have added product image for invoice email as below, opencart 3.0.3.8
In catalog/controller/mail/order.php file
Find each $this->load->model('tool/upload');
Add below $this->load->model('catalog/product');
Find each $data['products'][] = array(
Add above $product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
Add below 'thumb' => $order_info['store_url'] . 'image/' . $product_info['image'],
in catalog/view/theme/default/template/mail/order_add.twig
Add <img src="{{ product.thumb }}" width="" height="" /> to position display
Any problem with this way? i want to load products image for email invoice from $this->load->model('tool/image'); but it doesn't work.
Anyone have another solution? please help
Thank you very much!
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks 'straightlight'... It is working with this final solution
In catalog/controller/mail/order.php file
Find each: $this->load->model('tool/upload');
Add below
$this->load->model('catalog/product');
$this->load->model('tool/image');
Find each: $data['products'][] = array(
Add above
$product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
if ($product_info['image']) {
$image = $this->model_tool_image->resize($product_info['image'], 100, 100);
} else {
$image = $this->model_tool_image->resize('placeholder.png', 100, 100);
}
Add below
'thumb' => $image,
in catalog/view/theme/default/template/mail/order_add.twig
Add <img src="{{ product.thumb }}" /> to position display
In catalog/controller/mail/order.php file
Find each: $this->load->model('tool/upload');
Add below
$this->load->model('catalog/product');
$this->load->model('tool/image');
Find each: $data['products'][] = array(
Add above
$product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
if ($product_info['image']) {
$image = $this->model_tool_image->resize($product_info['image'], 100, 100);
} else {
$image = $this->model_tool_image->resize('placeholder.png', 100, 100);
}
Add below
'thumb' => $image,
in catalog/view/theme/default/template/mail/order_add.twig
Add <img src="{{ product.thumb }}" /> to position display
Hi guys.
I'd like to set the image in email for customer and admin, but I have 3.0.3.6 version.
If the configuration is the same, I only have one qiestion. I don't know how to set up this: "Add <img src="{{ product.thumb }}" /> to position display" in order_add.twig file. Can you please help me?
Thank you.
Greetings.
Martina
I'd like to set the image in email for customer and admin, but I have 3.0.3.6 version.
If the configuration is the same, I only have one qiestion. I don't know how to set up this: "Add <img src="{{ product.thumb }}" /> to position display" in order_add.twig file. Can you please help me?
Thank you.
Greetings.
Martina
For anyone in the future, as this was posted fairly long ago:kupikocke wrote: ↑Tue Dec 06, 2022 7:37 pmHi guys.
I'd like to set the image in email for customer and admin, but I have 3.0.3.6 version.
If the configuration is the same, I only have one qiestion. I don't know how to set up this: "Add <img src="{{ product.thumb }}" /> to position display" in order_add.twig file. Can you please help me?
Thank you.
Greetings.
Martina
The most basic solution:
Add:
Code: Select all
<img src="{{ product.thumb }}"/>
Code: Select all
{% for product in products %}
<tr><td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">
Code: Select all
{% for product in products %}
<tr>
<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">
<img src="{{ product.thumb }}"/>
{{ product.name }}
{% for option in product.option %}<br />
<small> - {{ option.name }}: {{ option.value }}</small>{% endfor %}
</td>
I made it more beautiful by adding another header with text: "photo" and then added the "<img src="{{ product.thumb }}"/>" to a new <td> tag before the one we put it inside before.
You also need to change "colspan=4" to a 5, cause it will be misaligned.
Who is online
Users browsing this forum: No registered users and 97 guests