(我知道Opencart的早期版本对此有疑问,但我使用的是3.0.3.2。当我更改代码以在优化搜索中合并图像时,出现了PHP错误。(链接的计算机图像只是占位符。)
我尝试更改catalog / controller / product / category.php中的代码
if ($category_info['image']) {
$data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_category_height'));
} else {
$data['thumb'] = '';
}
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
$data['compare'] = $this->url->link('product/compare');
$url = '';
if (isset($this->request->get['filter'])) {
$url .= '&filter=' . $this->request->get['filter'];
}
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
$product_total = $this->model_catalog_product->getTotalProducts($filter_data);
$results = $this->model_catalog_product->getProducts($filter_data);
我在第135行和第137行(上面的代码的最后几行)出现未定义的变量错误。
答案 0 :(得分:0)
我认为该错误与变量$filter_data
应在这两行之前声明
$filter_data = array(
'filter_category_id' => $category_id,
'filter_sub_category' => $this->config->get('config_product_category') ? true : false,
'filter_filter' => $filter,
'sort' => $sort,
'order' => $order,
'start' => ($page - 1) * $limit,
'limit' => $limit
);