で、追加するcatalog/controller/module/latest.php
前に:$this->data['products'][] = array(
$categories = $this->model_catalog_product->getCategories($result['product_id']);
if($categories){
$categories_info = $this->model_catalog_category->getCategory($categories[0]['category_id']);
$category_title = $categories_info['name'];
}else{
$category_title = '';
}
$this->data['products'][]
以下のように配列を更新します。
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'category_title' => $category_title,
'thumb' => $image,
'name' => $result['name'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']),
);
latest.tpl
では、カテゴリ タイトルを として取得します$product['category_title']
。
追加情報: - モデル関数はコントローラー内で呼び出す必要があります。コントローラーで定義された変数$this->data['variable_name']
は、テンプレート ファイルで としてアクセスできます$variable_name
。
良い1日を !!