求点击排行

2016-07-07 15:02 来源:www.chinab4c.com 作者:ecshop专家

我想在网站左面弄一个点击排行谁能告诉我怎么弄!啊谢谢了!

回答:
获取点击排行的函数
  1. function get_click_count($num)
  2. {
  3. $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('goods').' where is_delete = 0 AND is_on_sale = 1';
  4. $sql .=' ORDER BY click_count DESC';
  5. $sql .= " LIMIT $num ";
  6. $result = $GLOBALS['db']->getAll($sql);

  7. $goods = array();
  8. foreach ($result AS $idx => $row)
  9. {
  10. $goods[$idx]['id']= $row['goods_id'];
  11. $goods[$idx]['name']= $row['goods_name'];
  12. $goods[$idx]['brief']= $row['goods_brief'];
  13. $goods[$idx]['brand_name']= $row['brand_name'];
  14. $goods[$idx]['goods_style_name']= add_style($row['goods_name'],$row['goods_name_style']);
  15. $goods[$idx]['short_name']= $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
  16. $goods[$idx]['short_style_name']= add_style($goods[$idx]['short_name'],$row['goods_name_style']);
  17. $goods[$idx]['market_price'] = price_format($row['market_price']);
  18. $goods[$idx]['shop_price']= price_format($row['shop_price']);
  19. $goods[$idx]['thumb']= get_image_path($row['goods_id'], $row['goods_thumb'], true);
  20. $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
  21. $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
  22. }

  23. return $goods;
  24. }
复制代码


我比较笨看了 还是不知道怎么弄您能帮我一下吗~!

qq523313621


您能帮我弄的话 我愿意支付10q币

是按点击排序还是排行 ?




排行 就是看那个商品 顾客点的多~!

这个的关键在于找到goods表里点击排行的字段click_count

攻,攻,攻!楼主可是在挑衅?或是挑逗?




此话怎讲~!

留名!!