欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ECShop顯示某商品銷售累計效果的實現(xiàn)代碼

  發(fā)布時間:2011-04-19 00:53:49   作者:佚名   我要評論
最近在學(xué)習(xí)ECShop內(nèi)容, 想在商品頁面中將某一商品的累計銷售數(shù)量顯示出來。
 通過學(xué)習(xí)、查詢,解決該問題。
參照文章:http://www.ecshop120.com/ecshop-mobanxiugai/article-19.html
方案如下:
修改 includes/lib_insert.php 文件,
增加一個函數(shù)

復(fù)制代碼
代碼如下:

/**
* 調(diào)用某商品的累積售出
*/
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}

相關(guān)文章

最新評論