你现在的位置:首页 > PHP网站建设知识库 > ZenCart > 正文

如何让zencart分类产品排序显示最新商品

如何让zencart分类产品排序显示最新商品呢?问题解决: 

1: \includes\index_filters\default_filter.php 

将case 5的:order by p.products_date_added DESC改成:order by p.products_ordered DESC 
将default的:order by p.products_ordered DESC改成:order by p.products_date_added DESC

2:\includes\modules\product_listing.php 

Bestselling 跟New Arrival 互换位置 

3:\includes\index_filters\default_filter.php 

这里比较重要了,决定了是否成功: 
// We show them all$listing_sql = “select ” . $select_column_list . ” p.products_id, p.products_type,p.products_status,p.products_price,p.products_price_retail,p.products_price_sample,p.product_is_wholesale,p.product_wholesale_min,p.products_quantity, p.products_quantity_order_min, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_statusfrom ” . TABLE_PRODUCTS_DESCRIPTION . ” pd, ” .TABLE_PRODUCTS . ” p left join ” . TABLE_MANUFACTURERS . ” m on p.manufacturers_id = m.manufacturers_id, ” .TABLE_PRODUCTS_TO_CATEGORIES . ” p2c left join ” . TABLE_SPECIALS . ” s on p2c.products_id = s.products_idwhere p.products_status = 1and p.products_id = p2c.products_idand pd.products_id = p2c.products_idand pd.language_id = ‘” . (int)$_SESSION['languages_id'].”‘”. $displayOrder. $priceOrder.”and ” . $product_in_categories_sql; 
在这段代码的最后一句的;前加入:. ” order by p.products_date_added DESC” 也就是最后一句改成: 
and ” . $product_in_categories_sql. ” order by p.products_date_added DESC”;