Totti Posted October 11, 2016 Share Posted October 11, 2016 (edited) hello how you can insert the product image in the email when the product is back in stock? Edited October 11, 2016 by Totti (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted October 13, 2016 Share Posted October 13, 2016 Not without modifying the Mail Alerts module. You'd have to find the template variables on line 182 of modules/mailalerts/MailAlert.php: $template_vars = array( '{product}' => (is_array($product->name) ? $product->name[$id_lang] : $product->name), '{product_link}' => $product_link ); And change it to something like: $id_image = 0; $result = Product::getCoverImage((int)$product->id); if (is_array($result) && isset($result['id_image'])) { $id_image = (Configuration::get('PS_LEGACY_IMAGES') ? $product->id.'-' : '').(int)$result['id_image']; } else { $id_image = $this->context->language->iso_code.'-default'; } $template_vars = array( '{product}' => (is_array($product->name) ? $product->name[$id_lang] : $product->name), '{product_link}' => $product_link, '{product_image_link}' => $link->getImageLink($product->link_rewrite, $id_image, 'small_default') ); I haven't tested this code, but it should get the product image link in the 'small_default' size of 80x80 pixel and put it in the {product_image_link} variable. You can then use that in modules/mailalerts/mails/en/customer_qty.html like this: <img src="{product_image_link}" alt="{product}" width="80" height="80" /> Hopefully, this will point you in the right direction. 1 Link to comment Share on other sites More sharing options...
Totti Posted October 16, 2016 Author Share Posted October 16, 2016 I try it right away, thank you. Link to comment Share on other sites More sharing options...
DARKF3D3 Posted March 26, 2017 Share Posted March 26, 2017 Hello rocky, i just tried doing the same on PS 1.6.1.10 with multistore enabled and MailAlerts module 3.2.9 but there's something wrong. When I apply the modify the MailAlert module stop working, and when increa the quantity of a product from BO rpoduct detail instead of showeing the green confirmation popup if show a red message: "error: Internal Server Error". I think because there's something wrong with the module, so it's not able to send the email. Link to comment Share on other sites More sharing options...
originmad Posted June 5, 2017 Share Posted June 5, 2017 (edited) Hi there, I think i figured it out for 1.6.1.13. I'm not php developer. There might be problem on code quality but its working $image_url = ''; $image = Product::getCover((int)$id_product); if (sizeof($image) > 0) { $image_type = 'large_default'; $image_url = $context->link->getImageLink($product->link_rewrite, $id_product.'-'.$image['id_image'], $image_type); } $template_vars = array( '{product}' => (is_array($product->name) ? $product->name[$id_lang] : $product->name), '{product_link}' => $product_link, '{image_url}' => $image_url ); Edited June 5, 2017 by originmad (see edit history) Link to comment Share on other sites More sharing options...
Kaper Posted February 17, 2018 Share Posted February 17, 2018 Any solution for PS 1.6.1.7 please? The code is different here Link to comment Share on other sites More sharing options...
AliRoberto Posted January 11, 2020 Share Posted January 11, 2020 PS 1.7 same? 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