嗨我想要添加"排序依据"在类别页面中根据产品销售数量。
通过在model / catelog / product.php
中添加新的排序查询,我已经到了这里if ($data['sort'] == 'pd.name' || $data['sort'] == 'p.model') {
$sql .= " ORDER BY LCASE(" . $data['sort'] . ")";
} elseif ($data['sort'] == 'p.price') {
$sql .= " ORDER BY (CASE WHEN special IS NOT NULL THEN special WHEN discount IS NOT NULL THEN discount ELSE p.price END)";
//custom
} elseif ($data['sort'] == 'total_sold') {
$sql .= " ORDER BY ( ( SELECT sum( quantity ) FROM " . DB_PREFIX . "order_product op where op.product_id=p.product_id GROUP BY p.product_id )) ";
问题是,我们如何通过添加产品领域的数量来改变这个数量的销售订单" jan"。现在我们在产品中有自己的数量销售调整" jan"领域。所以我们需要排序依据 (以上声明销售的实际产品)+(每个产品的jan字段中的值)。