PS newbi Posted July 12, 2015 Share Posted July 12, 2015 (edited) Hello I would like to show product image on order detail in Prestashop 1.6 I know i have to add the below code in order-detail.tpl, but where exactly do i place it, and do i need to do more then that? Should i also do an override or something? If yes, then what to override and where? the code: <img src="{$link->getImageLink('productimage', $product.image->id_image, 'home_default')}" /> Edited July 30, 2015 by PS newbi (see edit history) Link to comment Share on other sites More sharing options...
jgamio Posted July 13, 2015 Share Posted July 13, 2015 Your code is not right you put 'productimage' but you need to put the $product->link_rewrite instead You not need override because is a theme file you just need change your tpl file Link to comment Share on other sites More sharing options...
PS newbi Posted July 13, 2015 Author Share Posted July 13, 2015 Thanks for reply. Where exactly do i place <img src="{$link->getImageLink($product->link_rewrite, $product.image->id_image, 'home_default')}" /> ? Link to comment Share on other sites More sharing options...
PS newbi Posted July 16, 2015 Author Share Posted July 16, 2015 Your code is not right you put 'productimage' but you need to put the $product->link_rewrite instead You not need override because is a theme file you just need change your tpl file It doesn't make a difference. I only get a image box with a question mark. How do i get the product image to show? Thanks Link to comment Share on other sites More sharing options...
PS newbi Posted July 21, 2015 Author Share Posted July 21, 2015 Some people say that i need to do something in the controller, but what and where? Anyone? Please help. Thanks Link to comment Share on other sites More sharing options...
PS newbi Posted July 25, 2015 Author Share Posted July 25, 2015 (edited) This worked. Step1 in class/order/Order.php public function getProductsDetail() { return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT * FROM `'._DB_PREFIX_.'order_detail` od LEFT JOIN '._DB_PREFIX_.'product p ON ( p.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product) LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1) WHERE od.`id_order` = '.(int)($this->id)); } Step2 in /controller/front/OrderDetailController.php foreach($products as $key => $value) { $objet_produit= new Product($value['product_id']); $products[$key]['link_rewrite']= $objet_produit->link_rewrite; $products[$key]['cover']= Product::getCover($value['product_id']); } or $id_lang_default= Configuration::get('PS_LANG_DEFAULT'); foreach($products as $key => $value) { $objet_produit= new Product($value['product_id']); $products[$key]['link_rewrite']= $objet_produit->link_rewrite[$id_lang_default]; $products[$key]['cover']= Product::getCover($value['product_id']); } Step 3 in order-detail.tpl <img src="{$link->getImageLink($product.link_rewrite, $product.cover.id_image, 'small_default')}" title="{$product.product_name|escape:'htmlall':'UTF-8'}" alt="{$product.product_name|escape:'htmlall':'UTF-8'}" /> Edited July 25, 2015 by PS newbi (see edit history) Link to comment Share on other sites More sharing options...
PS newbi Posted July 25, 2015 Author Share Posted July 25, 2015 Now i have a new proplem. The order detail is showing wrong image for combination products. It is showing the cover image instead of the image for the combination. Someone help?? :-) Link to comment Share on other sites More sharing options...
jgamio Posted July 25, 2015 Share Posted July 25, 2015 You need use the image id for the combination <img src="{$link->getImageLink($product.link_rewrite, $product.cover.id_image, 'small_default')}" title="{$product.product_name|escape:'htmlall':'UTF-8'}" alt="{$product.product_name|escape:'htmlall':'UTF-8'}" /> you need get the image id and change $product.cover.id_image Link to comment Share on other sites More sharing options...
PS newbi Posted July 26, 2015 Author Share Posted July 26, 2015 jgamio, how do i get the image id for the combination? Where do i find it? Link to comment Share on other sites More sharing options...
jgamio Posted July 26, 2015 Share Posted July 26, 2015 Ok I dont sure but is something like these In your step2 use Product::getCombinationImages to get the combinations images then In your ps_order_detail table you have a field product_attribute_id You need do a for to compare ps_product_attribute to get the id_image to get the correct id for the image Link to comment Share on other sites More sharing options...
PS newbi Posted July 28, 2015 Author Share Posted July 28, 2015 Hello jgamio Could you please paste the code how you will do it step by step? It is easier for me to understand. :-) Thanks a lot. Link to comment Share on other sites More sharing options...
PS newbi Posted July 29, 2015 Author Share Posted July 29, 2015 up Link to comment Share on other sites More sharing options...
PS newbi Posted July 30, 2015 Author Share Posted July 30, 2015 (edited) This one worked: Step 1 + step 2 and below code in order_detail.tpl <img src="{$link->getImageLink('productimage', $product.image->id_image, 'small_default')}" /> Edited July 30, 2015 by PS newbi (see edit history) 1 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