多语言展示
当前在线:579今日阅读:26今日分享:39

商品排序,销量降序。

商品排序,销量降序。
工具/原料

电脑 代码编辑器

方法/步骤:
1

1.实现结果 详解。

2

2.销量降序,商品默认按照销量降序排序显示

4

4.评论数排序只有降序排序

5

5.1).商品评论模拟数据insert into sp_comment select null,cmt_msg,user_id,goods_id,cmt_star,cmt_zannum,is_show,unix_timestamp(),unix_timestamp() from sp_comment2).设置不同商品都有几个评论update sp_comment set goods_id=floor(rand()*8)+273).查看每个商品的评论数目select g.goods_id,g.goods_name,(select count(cNaNt_id) from sp_comment c where g.goods_id=c.goods_id) pl from sp_goods gwhere g.goods_id in ('27','28','29','30','31','32','33','34')

6

6.价格排序价格排序有升、降序之分价格有三个状态:不排序、升序、降序

7

7.给各个排序条件设置超链接:

8

8.控制器中给各个排序条件进行设置:

9

9.测试结果。

推荐信息