- 众所周知,最新版的商品详情页, 已经能够显示购买数量、评论数量了,
- 但是唯独没有显示收藏数量,也就是淘宝上的收藏人气,下面我们就把它显示出来。
- 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 版)为例 - 在
- 上边添加
转载请注明:汇站网 » 如何在ECSHOP商品详情页显示收藏数量