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>