眾所周知,最新版的商品詳情頁, 已經能夠顯示購買數量、評論數量了,
但是唯獨沒有顯示收藏數量,也就是淘寶上的收藏人氣,下面我們就把它顯示出來。
1)、首先打開 /includes/lib_insert.php 文件
在文件末尾增加下面代碼
/**
* 調用某商品的累積收藏
*/
function insert_goods_collect($arr)
{
$sql='select count(user_id) as ids '.'from '. $GLOBALS['ecs']->table('collect_goods')."as co "."where co.goods_id=".$arr['goods_id'];
$row=$GLOBALS['db']->GetRow($sql);
if($row)
{
$ids = intval($row['ids']);
}
else
{
$ids = 0;
}
return $ids;
}
2)、接著打開模板文件 /themes/default/goods.dwt ,這里以官方默認模板(2.7.2版)為例
在
<strong>{$lang.goods_rank}</strong>
上邊添加
<strong>收藏人氣:</strong>{insert name='goods_collect' goods_id=$id}人<br>
以上就是本文章的內容,希望對大家有所幫助。
新聞熱點
疑難解答