ecshop 详情页面获取商品销量和评论数
2014-05-04 16:17
288 查看
添加页面:根目录下面的goods.php 找到
/* 记录浏览历史 */
if (!empty($_COOKIE['ECS']['history']))
......
添加代码如下:
/*新添加的程序 获取销量和评论数*/
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.order_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'";
$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.order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED, OS_SPLITING_PART)) .
" 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);
}
$smarty->assign('buy_num',get_buy_sum($goods_id));
$smarty->assign('comment_num',get_comment_num($goods_id));
/* 记录浏览历史 */
if (!empty($_COOKIE['ECS']['history']))
......
添加代码如下:
/*新添加的程序 获取销量和评论数*/
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.order_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'";
$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.order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED, OS_SPLITING_PART)) .
" 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);
}
$smarty->assign('buy_num',get_buy_sum($goods_id));
$smarty->assign('comment_num',get_comment_num($goods_id));
相关文章推荐
- ecshop 商品列表页面 按销量排行
- ECSHOP在商品详细页面上获取该商品的顶级分类id和名称
- ecshop:产品页面添加商品销量,已显示OK
- 商品详情页面特殊制作,获取网页的高度,collectionView根据内容的变化其高度也随着变化
- ecshop 获取某个商品的 所有订单信息 或者销量
- ecshop商品列表页面增加按销量排行
- 让zen cart商品评论显示在商品详情页面
- ecshop wap 商品详情页面调用图片
- 让ecshop显示商品销量或者月销量,调用评论数量
- ECSHOP商品详情页面如何实现直接购买和放入到购物车同时存在
- ecshop 商品详情页面显示-赠品信息-优惠活动
- 让zen cart商品评论显示在商品详情页面
- ECSHOP 版本2.7 商品详情页面,显示购买记录
- ecshop 商品列表页面 按销量排行
- ECSHOP在商品详细页面上获取该商品的顶级分类id和名称
- ecshop商品详情页显示商品销量
- 商品详情页面调用该商品评论数量
- 解决 ECSHOP v273 产品详情页面评论不显示的问题
- ecshop商品列表页面增加按销量排序
- ecshop 商品详情页面显示商品简单描述