`
精通php
  • 浏览: 1596 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

ecshop如何在商品详细页显示已售数量和评论数量

阅读更多
ecshop增加已售数量和评论数量很简单,步骤如下:

1.在ecshop程序goods.php页面最下面加入这两个函数 function get_buy_sum($goods_id) { $sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.orer_status = '" . OS_CONFIRMED . "' " . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " AND g.goods_id = '$goods_id'"; return $GLOBALS['db']->getOne($sql); } function get_comment_num($goods_id) { $sql= "select count(*) from ".$GLOBALS['ecs']->table('comment').' where id_value='".$goods_id."' AND status = 1"; return $GLOBALS['db']->getOne($sql); }

2.在ecshop程序goods.php中加入 $smarty->assign('buy_num',get_buy_sum($goods_id)); $smarty->assign('comment_num',get_comment_num($goods_id));

3.ecshop中goods.dwt模板中加入如下代码:

    累计售出:{$buy_num}



常年承接PHP电商类(比如ecshop,shopnc,opencart,zencart,magento等)系统开发,联系我Q919299821


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics