0
我嘗試添加模型和製造商名稱在搜索結果頁面上顯示(OC版本2.2.0.0)。我有解決方案,可以在Opencart v 1.5.6 +上運行。Opencart 2.2.0.0未定義的搜索結果頁索引
1.我已經加入此代碼到/catalog/controller/product/search.php
'manufacturer' => $result['manufacturer'],
'model' => $result['model'],
此代碼:
$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, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating' => $result['rating'],
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)
);
}
2.在/目錄/查看/主題/默認/模板/產品/ search.tpl我已添加此代碼:
在「div class caption」我試着打電話這名以
<?php echo $product['model']; ?>
<?php echo $product['manufacturer']; ?>
結果:在版本2.2 OC錯誤UNDEFINED INDEX。在Opencart 1上,此代碼完美無缺。
任何消耗?
一定要檢查值是否正確傳遞給數組中的這些鍵。未定義的索引是當有一個沒有賦值的屬性時。 – g9m29
你好,謝謝你的回答。 Mayby你知道我在哪裏可以找到Opencart CMS文件中的所有密鑰? –