0
試圖在類別頁面中獲取「新」標籤。例如,如果產品具有類別219,則會有貼紙。Opencart在類別頁面中獲取category_id
我已經在控制器中添加什麼category.php
$product_info = $this->model_catalog_product->getProduct($product_id);
$categories = $this->model_catalog_product->getCategories($product_info['$product_id']);
$categories_info = $this->model_catalog_category->getCategory($categories[0]['category_id']);
$this->data['category_id'] = $categories_info['category_id'];
在category.tpl
<?php if($category_id=="219") { ?>
<img src="new.jpg">
<?php } ?>
但沒有出現。
UPD:更改代碼
$categories = $this->model_catalog_product->getCategories($result['product_id']);
$categories_info = $this->model_catalog_category->getCategory($categories[3]['category_id']);
$this->data['category_id'] = $categories_info['category_id'];
category.tpl
<?php if ($category_id=="219") { ?>
<?php } else { ?>
<?php } ?>
如果我使用$類別它只能[3] [ 'CATEGORY_ID'],但我不能搜索使用php函數in_array對它進行數組賦值。
我必須說,這是Opencart的1.5的templase。 – Hazzy