分类商品访问购买率

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

  1. function click_sold_info()
  2. {
  3. global $db, $ecs;
  4. $where = " WHERE o.order_id = og.order_id AND g.goods_id = og.goods_id " . order_query_sql('finished', 'o.');
  5. $click_sold_info = array();
  6. $sql = "SELECT og.goods_id, g.click_count,COUNT(og.goods_id) AS sold_times ".
  7. " FROM ". $ecs->table('goods') ." AS g, ". $ecs->table('order_goods') ." AS og, " .$ecs->table('order_info') . " AS o " . $where .
  8. " GROUP BY og.goods_id";
  9. $res = $db->query($sql);
  10. while ($item = $db->fetchRow($res))
  11. {
  12. if ($item['click_count'] <= 0)
  13. {
  14. $item['scale'] = 0;
  15. }
  16. else
  17. {
  18. /* 每一百个点击的订单比率 */
  19. $item['scale'] = sprintf("%0.2f", ($item['sold_times'] / $item['click_count']) * 100) .'%';
  20. }

  21. $click_sold_info[] = $item;
  22. }

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

这个是访问购买率的具体代码。请问我想修改成某个分类的商品访问购买率的汇总应该如何修改?

回答:
不错的想法,

根本不知道想做什么,如果需要二次开发的可以找我 QQ:283087481