kennyjack Posted October 25, 2014 Share Posted October 25, 2014 Hi I have make changes on the email template by adding an image below is the code <img src="{$img_ps_dir}/myimage.jpg" /> I have double comfirm that myimage.jpg is inside the correct path. but still now showing the image in email. I have search whole day on why image not showing in email template. is because of the cdi:swift code. how can i know my cdi:swift code of myimage.jpg? or is there another way to do? Thanks & Regards Kenny Link to comment Share on other sites More sharing options...
PrestaNitro Posted October 25, 2014 Share Posted October 25, 2014 (edited) Hi,You can try using: {shop_url}. Something like:<img src="{shop_url}/img//myimage.jpg" />Or even you can add your own variables to Mails, please, see this link:http://www.prestashop.com/forums/topic/252825-variables-in-the-email-templates/ Edited October 25, 2014 by PrestaNitro (see edit history) Link to comment Share on other sites More sharing options...
kennyjack Posted October 26, 2014 Author Share Posted October 26, 2014 (edited) Hi PrestaNitro, Let said myimage.jpg is inside my img folder and the myimage.jpg path is www.mydomain.com/img/myimage.jpg $template_vars['{shop_url}'] = Context::getContext()->link->getPageLink('index', true, Context::getContext()->language->id); how can i create the template_vars where myimage.jpg is in img folder. I have little knowledge on pretashop. could you help me? Thanks & regards Kenny Edited October 26, 2014 by kennyjack (see edit history) Link to comment Share on other sites More sharing options...
PrestaNitro Posted October 26, 2014 Share Posted October 26, 2014 Hi, The link above shows many methods to get the shop URL in PHP: http://www.prestashop.com/forums/topic/263420-solved-how-to-get-site-baseurl/Regards Link to comment Share on other sites More sharing options...
kennyjack Posted October 27, 2014 Author Share Posted October 27, 2014 Hi PrestaNitro, It seem like by putting path to retrieve image and showing on email template <img src="{shop_url}/img/myimage.jpg" /> does not work. email template does not accept the path to show image. it must use cdi:swift code to display. but i still no idea how can i get cdi:swift code of myimage.jpg Regards Link to comment Share on other sites More sharing options...
PrestaNitro Posted October 27, 2014 Share Posted October 27, 2014 Hi PrestaNitro, It seem like by putting path to retrieve image and showing on email template <img src="{shop_url}/img/myimage.jpg" /> does not work. email template does not accept the path to show image. it must use cdi:swift code to display. but i still no idea how can i get cdi:swift code of myimage.jpg Regards Since {shop_url} is not a valid tag to access "img" folder, the idea was to create your own mail template var, something like: $template_vars['{my_img_folder}'] = $smarty->tpl_vars['img_ps_dir']->value; And then use in your email the new template var: <img src="{my_img_folder}/myimage.jpg" /> Best regards, PrestaNitro Link to comment Share on other sites More sharing options...
Recommended Posts