Guido Buldrighini Posted October 1, 2020 Posted October 1, 2020 Hi, is it possible to show product image in order conf email? I find this but it doesn't work:https://www.prestashop.com/forums/topic/229948-how-to-put-product-images-in-customer-order-mail/?tab=comments#comment-2089340
0 datakick Posted October 1, 2020 Posted October 1, 2020 26 minutes ago, Guido Buldrighini said: Hi, is it possible to show product image in order conf email? I find this but it doesn't work:https://www.prestashop.com/forums/topic/229948-how-to-put-product-images-in-customer-order-mail/?tab=comments#comment-2089340 Of course it's possible. You need to 1) edit file /classes/module/PaymentModule.php and change lines $productVarTpl = [ 'reference' => $product['reference'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), 'unit_price' => Tools::displayPrice($productPrice, $this->context->currency, false), 'price' => Tools::displayPrice($productPrice * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => [], ]; to look like this: $productVarTpl = [ 'id_product' => (int)$product['id_product'], 'id_product_attribute' => $product['id_product_attribute'] ? (int) $product['id_product_attribute'] : null, 'id_image' => $product['id_image'], 'link_rewrite' => $product['link_rewrite'], 'reference' => $product['reference'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), 'unit_price' => Tools::displayPrice($productPrice, $this->context->currency, false), 'price' => Tools::displayPrice($productPrice * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => [], ]; That will pass additional data to the order_conf_product_list.tpl template 2) edit /mails/en/order_conf_product_list.tpl -- replace /en/ with iso code of your language and add this code there, just after first <tr>: <td style="border:1px solid #D6D4D4;"> <table class="table"> <tr> <td width="10"> </td> <td> <img src="{$link->getImageLink($product['link_rewrite'], $product['id_image'], 'cart')}" alt="{$product['name']}" /> </td> <td width="10"> </td> </tr> </table> </td> note the 'cart' string in getImageLink function. This is the image type that will be used. You can change it to any image type that exists in your system. 'cart' or 'home' should work fine in most cases 3) edit /mails/en/order_conf.html you will need to add new column header here, and also adjust table colspans. Put this code <th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Image</th> just above <th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Reference</th> and replace two occurances of colspan="5" with colspan="6" That should do the trick. Result looks something like this: 2
0 Guido Buldrighini Posted October 1, 2020 Author Posted October 1, 2020 (edited) Hi, thank you very much, I tried to make the changes it indicates but the result is the following: (screenshot attached) Edited October 1, 2020 by Guido Buldrighini screenshot edit
0 datakick Posted October 1, 2020 Posted October 1, 2020 12 minutes ago, Guido Buldrighini said: Hi, thank you very much, I tried to make the changes it indicates but the result is the following: (screenshot attached) Your email client is probably configured to not show images
0 Wartin Posted October 2, 2020 Posted October 2, 2020 Here it works perfect, in Niara. The product column becomes a little narrow now, but it's cool.
0 Francisco Ampuero Posted July 29, 2021 Posted July 29, 2021 On 10/1/2020 at 9:58 AM, datakick said: Of course it's possible. You need to 1) edit file /classes/module/PaymentModule.php and change lines $productVarTpl = [ 'reference' => $product['reference'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), 'unit_price' => Tools::displayPrice($productPrice, $this->context->currency, false), 'price' => Tools::displayPrice($productPrice * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => [], ]; to look like this: $productVarTpl = [ 'id_product' => (int)$product['id_product'], 'id_product_attribute' => $product['id_product_attribute'] ? (int) $product['id_product_attribute'] : null, 'id_image' => $product['id_image'], 'link_rewrite' => $product['link_rewrite'], 'reference' => $product['reference'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), 'unit_price' => Tools::displayPrice($productPrice, $this->context->currency, false), 'price' => Tools::displayPrice($productPrice * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => [], ]; That will pass additional data to the order_conf_product_list.tpl template 2) edit /mails/en/order_conf_product_list.tpl -- replace /en/ with iso code of your language and add this code there, just after first <tr>: <td style="border:1px solid #D6D4D4;"> <table class="table"> <tr> <td width="10"> </td> <td> <img src="{$link->getImageLink($product['link_rewrite'], $product['id_image'], 'cart')}" alt="{$product['name']}" /> </td> <td width="10"> </td> </tr> </table> </td> note the 'cart' string in getImageLink function. This is the image type that will be used. You can change it to any image type that exists in your system. 'cart' or 'home' should work fine in most cases 3) edit /mails/en/order_conf.html you will need to add new column header here, and also adjust table colspans. Put this code <th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Image</th> just above <th bgcolor="#f8f8f8" style="border:1px solid #D6D4D4;background-color: #fbfbfb;color: #333;font-family: Arial;font-size: 13px;padding: 10px;">Reference</th> and replace two occurances of colspan="5" with colspan="6" That should do the trick. Result looks something like this: Gracias!!!!!! Funciona perfecto TB11
Question
Guido Buldrighini
Hi, is it possible to show product image in order conf email?
I find this but it doesn't work:
https://www.prestashop.com/forums/topic/229948-how-to-put-product-images-in-customer-order-mail/?tab=comments#comment-2089340
6 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now