通过学习、查询,解决该问题。
参照文章:http://www.ecshop120.com/ecshop-mobanxiugai/article-19.html
方案如下:
修改 includes/lib_insert.php 文件,
增加一个函数
/**
* 调用某商品的累积售出
*/
function insert_goods_sells($arr)
{
$sql = 'SELECT SUM(goods_number) AS number ' .
' FROM ' . $GLOBALS['ecs']->table('order_goods') ." AS og , " . $GLOBALS['ecs']->table('order_info') ." AS o ".
" WHERE og.order_id = o.order_id and og.goods_id=".$arr['goods_id'];
$row = $GLOBALS['db']->GetRow($sql);
if ($row)
{
$number = intval($row['number']);
}
else
{
$number = 0;
}
return $number;
}
修改模板下goods.dwt文件
增加一行代码
<strong>累计售出:</strong>{insert name='goods_sells' goods_id=$id}{$goods.measure_unit}
参照文章:http://www.ecshop120.com/ecshop-mobanxiugai/article-19.html
方案如下:
修改 includes/lib_insert.php 文件,
增加一个函数
代码如下:
/**
* 调用某商品的累积售出
*/
function insert_goods_sells($arr)
{
$sql = 'SELECT SUM(goods_number) AS number ' .
' FROM ' . $GLOBALS['ecs']->table('order_goods') ." AS og , " . $GLOBALS['ecs']->table('order_info') ." AS o ".
" WHERE og.order_id = o.order_id and og.goods_id=".$arr['goods_id'];
$row = $GLOBALS['db']->GetRow($sql);
if ($row)
{
$number = intval($row['number']);
}
else
{
$number = 0;
}
return $number;
}
修改模板下goods.dwt文件
增加一行代码
<strong>累计售出:</strong>{insert name='goods_sells' goods_id=$id}{$goods.measure_unit}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!