whitehumorous Posted August 6, 2013 Share Posted August 6, 2013 Hi, I would like to add a column in Order History table to show the product image as attached. Can someone advise me? Thanks Link to comment Share on other sites More sharing options...
whitehumorous Posted August 6, 2013 Author Share Posted August 6, 2013 Anyone able to help? Link to comment Share on other sites More sharing options...
whitehumorous Posted August 7, 2013 Author Share Posted August 7, 2013 (edited) I try to copy the code from cart but the result shows only the question mark image. The product link is correct but seems it get the wrong image link. <a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'medium_default')}" alt="{$product.name|escape:'htmlall':'UTF-8'}"></a> Edited August 7, 2013 by whitehumorous (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 7, 2013 Share Posted August 7, 2013 this is the proper way, but in the order history products array isn't full. What to do? you have to edit the history controller, untortunately there is no other way to achieve what you expect. Link to comment Share on other sites More sharing options...
whitehumorous Posted August 7, 2013 Author Share Posted August 7, 2013 this is the proper way, but in the order history products array isn't full. What to do? you have to edit the history controller, untortunately there is no other way to achieve what you expect. Can you give me some hint how to edit the history controller? Which file and the code. Anyway thanks for your reply. Link to comment Share on other sites More sharing options...
Rjworld Posted June 14, 2021 Share Posted June 14, 2021 i write this code and it's work properly.3 files are important to add this in preatshop 1.7. i tested this code in preastashop 1.7.6.2 file 1: Root/classes/order/Order.php (product image path return) code: / GET ORDER PRODUCT IMAGE URL BY order id // @ return image url // $order is order id public function getOrderProductUrl($idOrder) { $imagePath = ''; $order = new Order($idOrder); $product_id =Db::getInstance()->getValue( 'SELECT product_id FROM `' . _DB_PREFIX_ . 'order_detail` WHERE `id_order` = ' .$idOrder ); $id_product = $product_id; $id_lang = (int) Configuration::get('PS_LANG_DEFAULT'); $image = Image::getCover($id_product); $product = new Product($id_product); $link = new Link; $imagePath = $link->getImageLink($product->link_rewrite[Context::getContext()->language->id], $image['id_image'], 'home_default'); return "https://".$imagePath; } file 2 - Root/controllers/front/HistoryController.php (Controller) Code: this code put inside the foreacjh loop. which id return for data. $order.. $orders[$customer_order['id_order']]['product_img'] = Order::getOrderProductUrl((int) $customer_order['id_order']); File 3 - Root/themes/Your Theme/templates/customer/history.tpl code: use this image tag where you want to show product image <th><img src="{$order.product_img}" alt="product-image" width="216px"></th> Link to comment Share on other sites More sharing options...
redfordnl Posted May 2, 2023 Share Posted May 2, 2023 Hello, Thanks for this code. But sadly I can't get it to work in Prestashop 8.x... I get an blank screen on the my account and history detail pages both. So the code is crashing for this Prestashop version. Does somebody have a good solution for this? Thanks in advance. Greetings 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