Jump to content

How to display product cover images in order confirmation email


Richard Avenia

Recommended Posts

I am wondering how i would be able to include product images in the order confirmation email sent to customers on completion of a purchase. (Prestashop 1.7.6.7)

In the PDF attached to the confirmation email, product images are included in the order summary; however, in the email there doesn't seem to be that option. I have followed several tutorials attempting to add that functionality into PaymentModule.php and order_conf_product_list.tpl but to no success (this tutorial: https://catalogo-onlinersi.net/en/content/28-add-product-images-to-mail-order-confirmation)...

I am attaching some pictures showing where I would like to insert the product images in the email and how they are displayed in the attached invoice PDF.

I am also attaching the lines I tried adding to the respective mail files, however in the final result the <img> tag results with <img src=(unknown) /> ... Am I on the right track or is it completely off?

Screenshot_2.png

Screenshot_3.png

Screenshot_4.png

Screenshot_5.png

Link to comment
Share on other sites

  • 2 years later...
  • 5 months later...
hace 13 horas, ps8moduly.cz dijo:

Hello.
Could you please be more specific?
Where do you get the 500 error?
When confirming the order?

Hola y gracias por la ayuda.

El error 500 lo obtengo al presionar el boton REALIZAR PEDIDO en el ultimo paso en el Checkout, al activar depuracion se puede ver el sgte error

tres.thumb.png.2754f7ece3079231e9abb01272e50690.png

cuatro.png.7b231e870cead9feea1a0302044181f7.png

Para poner en contexto el error te comento que;

Agregue el código que usted compartió

//Agregamos imagen del producto con combinaciones en el email de confirmacion del pedido                         
if ($product['id_product_attribute']) {
    $existsAttributeImage = Db::getValue('SELECT id_image FROM '._DB_PREFIX_.'product_attribute_image WHERE id_product_attribute = '.$product['id_product_attribute']);
    if ($existsAttributeImage) {
        $image = new Image((int)$existsAttributeImage);
        $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImagePath().'-home_default.jpg';
    } else {
        $image_url = 'undefined';
    }  
} else {
    $id_image = Image::getCover($product['id_product']);
    $image = new Image((int)$id_image['id_image']);
    $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImagePath().'-home_default.jpg';    
}

//Colocar esto debajo de reference en classes/PaymentModule.php
'image' => $image_url,

quedando asi

uno.png.bb122cc8ef8b13421439fbc4207f0348.png

En la plantilla de correo agregue lo siguiente:

<img src="{$product['image']}" />

quedando asi

dos.png.4160ffa1fdfcad80913c31a5502c888c.png

 

Adjunto archivo PaymentModule.php

PaymentModule.rar

Espero vuestra ayuda gracias de antemano un saludo.

 

 

Edited by Pier100 (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...