我正在尝试获取订单详细信息,以显示产品组合而非封面图片的图像。
我对以下代码中究竟要改变的内容感到有些失落。一步一步的解释将不胜感激。
我在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));
}

这是/controller/front/OrderDetailController.php
:
$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']);
}

此代码段位于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'}" />
&#13;