2
我想在opencart 2.0的類別頁面中添加產品選項。如何在opencart 2.0的類別頁面中添加產品選項
我已經加入\目錄\型號\目錄\ product.php這個代碼
public function hasOptionPriceIncrease($product_id) {
$option_data = $this->getProductOptions($product_id);
if (is_array($product_option_value)) {
foreach ($product_option_value as $option) {
if (is_array($option['product_option_value'])) {
foreach ($option['product_option_value'] as $value) {
if ($value['price'] > 1) {
return true;
}
}
}
} return false }
,然後在\控制器\產品\ category.php
'has_option_price_increase' =>$this->model_catalog_product->hasOptionPriceIncrease($result['product_id'])
所以現在在類別$這 - >數據[「產品」] []變得像這個 -
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'rating' => $result['rating'],
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url),
'has_option_price_increase' =>$this->model_catalog_product->hasOptionPriceIncrease($result['product_id'])
);
現在,我不知道如何在我的VI調用此EW即在collection.tpl
請幫我在我看來,以顯示這一點,顯示在分類頁面的產品選項。
嘿@ jx12345,我看到你也做了同樣的事情,你可以請我幫忙看看你的朋友 – user949914
請問你如何在前臺展示這個價格? –