广州传奇网络
地址:广州市天河区东圃大马路富华楼C座
电话:13808825895
QQ:1564443073
1、对于交易量很大的网站,每个商品的“累计售出”个数可能随时都在变化,
所以本方法使用了 insert 函数来实现,以达到能体现实时最新的销售量(也就是销售量不会被缓存)
2、修改 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;
- }
3、修改 模板文件夹下 goods.dwt 文件
在
- <strong>{$lang.goods_click_count}:</strong>{$goods.click_count}
下面增加一行代码
ecshop模版 ecshop插件 ecshop二次开发 ecshop教程
- <strong>累计售出:</strong>{insert goods_id=$id}{$goods.measure_unit}