opencart 2.3.0.2 最新商品无特价

opencart 2.3.0.2 latest products without special prices

我希望在最新模块中能够只显示没有特价的产品! 在 model/catalog/product.php 中,我修改了

getLatestProducts() 函数
foreach ($query->rows as $result) {

                $product_data[$result['product_id']] = $this->getProduct($result['product_id']);

        }

foreach ($query->rows as $result) {
$queryCheckSpecial = $this->db->query("SELECT product_id FROM ". DB_PREFIX ."product_special WHERE product_id =".$result['product_id']);
    if (!$queryCheckSpecial->row){
        $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
    }else{
        continue;
        }
    }

但它不起作用! 我做错了什么? 任何帮助将不胜感激!

编辑:

catalog\controller\extension\module\latest.php

查找:

'sort'  => 'p.date_added',

后添加:

'ignore_special'  => 1,

编辑:

catalog\model\catalog\product.php

查找(第一个匹配项):

if (!empty($data['filter_name']) || !empty($data['filter_tag'])) {

前加:

if (!empty($data['ignore_special'])) {
    $sql .= " AND (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) IS NULL";
}

然后清除缓存。

简单更新:

this:

foreach ($query->rows as $result) {
$queryCheckSpecial = $this->db->query("SELECT product_id FROM ". DB_PREFIX ."product_special WHERE product_id =".$result['product_id']);
    if (!$queryCheckSpecial->row){
        $product_data[$result['product_id']] = $this->getProduct($result['product_id']);
    }else{
        continue;
        }
    }
}

with:

foreach ($query->rows as $result) {
    $product_info = $this->getProduct($result['product_id']);
    if (!$product_info['special']){
        $product_data[$result['product_id']] = 
    }
}

另外不要忘记在测试前清除缓存。

@digicart 我已经完成 catalog\controller\extension\module\latest.php

'ignore_special'  => 1,

在catalog\model\catalog\product.php

if (!empty($data['ignore_special']) &&  empty($data['filter_category_id'])){

            $this->log->debug('dsadsa');

            $queryCheckSpecial = $this->db->query("SELECT product_id FROM ". DB_PREFIX ."product_special WHERE product_id =".$result['product_id']);
            if (!$queryCheckSpecial->row){

                $product_data[$result['product_id']] = $this->getProduct($result['product_id']);

            }else{
                continue;

           }

在 getproducts() 的末尾

它正在最新页面上运行!问题是在类别页面中,不知何故存在忽略特殊字段,我不知道为什么!