Dove99x Posted January 13, 2018 Share Posted January 13, 2018 (edited) Hello, I was wondering how to add images to product confirmation email on version 1.6.1.7? Adding the code below to classes/PaymentModule.php doesn't seem to be working $cover = Image::getCover((int)$product['id_product']); // array image if (sizeof($cover['id_image']) > 0) { $folder = Image::getImgFolderStatic($cover['id_image']); // folders inside /img/p/ $image = '<img src="../img/p/'.$folder.$cover['id_image'].'-medium_default.jpg" alt="" width="125" height="125" class="imgm img-thumbnail" />'; } else { $image = '<img src="../img/p/en-default-medium_default.jpg" alt="" width="125" height="125" class="imgm img-thumbnail" />'; } $product_var_tpl = array( 'reference' => $product['reference'], 'image' => $image, 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), 'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false), 'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => array() ); Than I added {$product['image']} to the order_conf.html but nothing showed. What do you suggest I do? Edited January 13, 2018 by Dove99x (see edit history) Link to comment Share on other sites More sharing options...
Dove99x Posted January 17, 2018 Author Share Posted January 17, 2018 Anyone have any suggestions? Link to comment Share on other sites More sharing options...
NemoPS Posted January 18, 2018 Share Posted January 18, 2018 you can just use $this->context->link->getImageLink and use it as src Link to comment Share on other sites More sharing options...
Dove99x Posted January 18, 2018 Author Share Posted January 18, 2018 Thank you for the reply @NemoPS - I really appreciate it. maybe I'm doing it wrong, but I've updated the "order_conf_product_list.tpl" with the code <img src="{$this->context->link->getImageLink}"> but it is not showing anything for me. Do I need to do anything extra as I've removed all changes to classes/PaymentModule.php Link to comment Share on other sites More sharing options...
Dove99x Posted January 18, 2018 Author Share Posted January 18, 2018 It looks like downloading the PaymentModule.php from this post https://www.prestashop.com/forums/topic/229948-how-to-put-product-images-in-customer-order-mail/ resolved it for me. Again, thank you @NemoPS for responding and assisting! Link to comment Share on other sites More sharing options...
david_caribou Posted August 26, 2019 Share Posted August 26, 2019 (edited) We can have a better solution, without override or modify PaymentModule.php so Mail.php send an Array for product. We only 6 keys, but we have the id product. It's alll we need for the tpl; smarty var for url img cannot work because product in Mail is a simple Array, but we not need img with the url rewrite inside an email. and in htaccess we can find line like this RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L] order_conf_product_list.tpl {foreach $list as $product} {assign var='defaultImage' value=Product::getCover($product['id_product'])} // we have now the ID image //// tr, td etc.... <img src="DOMAINNAME/{$defaultImage['id_image']}-medium_THEMENAME/{$defaultImage['id_image']}-medium_default.jpg" width="110" height="120"/> //// replace DOMAINENAME by https://www.yourdomaine //// replace THEMENAME by your name theme //// tr, td etc.... {/foreach} this code work because all image name is related to id and the rewrite inside default htaccess work well. and if you look in ftp you see for id 40 : p/4/0 => 40-small_default.jpg, 40-medium_default.jpg,40-large_default.jpg, etc...... Edited August 26, 2019 by david_caribou (see edit history) 2 Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 13, 2019 Share Posted September 13, 2019 On 26/8/2019 at 11:56 AM, david_caribou dice: this code work because all image name is related to id and the rewrite inside default htaccess work well. Hello david_caribou, this is supposed to works also on PS1.7? Link to comment Share on other sites More sharing options...
david_caribou Posted September 13, 2019 Share Posted September 13, 2019 yes i am in 1.7.6.1 but work in 1.7.6 Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 13, 2019 Share Posted September 13, 2019 I confirm that it's working. But I had to modify "-medium_THEMENAME" to "-medium_default". So instead of my template name I wrote "default". Link to comment Share on other sites More sharing options...
david_caribou Posted September 13, 2019 Share Posted September 13, 2019 perhaps because in my theme i have 3 new formats and size for image, i will try default for see the result Link to comment Share on other sites More sharing options...
RoadToSuccess Posted June 22, 2021 Share Posted June 22, 2021 (edited) I just installed 1.7.7.5 most recent stable version and with this post's help was able to get my images back onto my order confirmation email. Here is my code for that section if it should help another. It has my formatting but the code being implemented correctly should work. order_conf_product_list.tpl {foreach $list as $product} {assign var='defaultImage' value=Product::getCover($product['id_product'])} <table class="table" width="100%" align="left"> <tr> <td colspan="5" width="5"> </td> <td colspan="5" align="left" colspan="5" style="margin-bottom: 20px; text-align: left;"> <img src="https://motleymutt.com/shop/{$defaultImage['id_image']}-medium_default/{$defaultImage['id_image']}-medium_default.jpg" width="150" height="150"/> <br> <font size="2" face="Open-sans, sans-serif" color="#107fab"> <strong>{$product['name']}</strong> </font> {* {if count($product['customization']) == 1} <br> {foreach $product['customization'] as $customization} {$customization['customization_text']} {/foreach} {/if} Edited June 22, 2021 by RoadToSuccess (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted July 20, 2021 Share Posted July 20, 2021 I recently upgraded to PS1.7.7.5 so the customization has been removed. Now I'm trying to add it again, but it seem not working anymore. First of all I have a doubt about the correct path of "order_conf_product_list.tpl" file. In found it in these folders: /mails/_partials/ /mails/it/ /themes/TEMPLATE_NAME/mails/it/ /themes/TEMPLATE_NAME/mails/en/ Which is the correct file to be modified? Link to comment Share on other sites More sharing options...
pinwheel Posted September 30, 2021 Share Posted September 30, 2021 Good evening everyone, I have implemented the above and have the image not showing. The outline is, just not the needed image. I did try default and also the template I'm using. Prestashop 1.7.7.1 is the version. Is anyone using the above method with this? I am thinking the path might be different for the images. I also tried -home_default.jpg which is in the order confirmation page. Any help would be much appreciated. I have found that dozens of people have the same problem and want an image in the order email. Link to comment Share on other sites More sharing options...
DARKF3D3 Posted June 3, 2023 Share Posted June 3, 2023 This method no more works on PS8. Link to comment Share on other sites More sharing options...
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