推荐阅读:
[AI-人工智能]免翻墙的AI利器:樱桃茶·智域GPT,让你轻松使用ChatGPT和Midjourney - 免费AIGC工具 - 拼车/合租账号 八折优惠码: AIGCJOEDISCOUNT2024
[AI-人工智能]银河录像局: 国内可靠的AI工具与流媒体的合租平台 高效省钱、现号秒发、翻车赔偿、无限续费|95折优惠码: AIGCJOE
[AI-人工智能]免梯免翻墙-ChatGPT拼车站月卡 | 可用GPT4/GPT4o/o1-preview | 会话隔离 | 全网最低价独享体验ChatGPT/Claude会员服务
[AI-人工智能]边界AICHAT - 超级永久终身会员激活 史诗级神器,口碑炸裂!300万人都在用的AI平台
ecshop增加已售数量和评论数量很简单,步骤如下:
1.在ecshop程序goods.php页面最下面加入这两个函数
function get_buy_sum(ParseError: KaTeX parse error: Expected '}', got 'EOF' at end of input: goods_id)
{sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' .
'FROM ' . GLOBALS[′ecs′]−>table(′orderinfo′).′ASo,′.GLOBALS['ecs']->table('order_info') . ' AS o, ' .GLOBALS[′ecs′]−>table(′orderinfo′).′ASo,′.GLOBALS['ecs']->table('order_goods') . ' AS g ' .
"WHERE o.order_id = g.order_id " .
"AND o.order_status = '" . OS_CONFIRMED . "' " .
"AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) .
" AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) .
" AND g.goods_id = 'goodsid′";returngoods_id'";
returngoodsid′";returnGLOBALS['db']->getOne(ParseError: KaTeX parse error: Expected 'EOF', got '}' at position 7: sql);
}̲
function get_…goods_id) {
sql="selectcount(∗)from".sql= "select count(*) from ".sql="selectcount(∗)from".GLOBALS['ecs']->table('comment')." where id_value='".goodsid."′ANDstatus=1";returngoods_id."' AND status = 1";
returngoodsid."′ANDstatus=1";returnGLOBALS['db']->getOne($sql);
}
2.在ecshop程序goods.php中加入
在代码:
$smarty->display(‘goods.dwt’, $cache_id);
的前面,加入如下代码:
$smarty->assign('buy_num',get_buy_sum($goods_id));
$smarty->assign('comment_num',get_comment_num($goods_id));
3.ecshop中goods.dwt模板中加入如下代码:
<!-- {if ParseError: KaTeX parse error: Expected 'EOF', got '}' at position 8: buy_num}̲ 已出售量-->
buy_num}
</dd>
</li>
<!--{/if}-->
<!-- {if ParseError: KaTeX parse error: Expected 'EOF', got '}' at position 12: comment_num}̲ 评论数量-->
comment_num}</a>
</dd>
</li>
<!--{/if}-->
宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取
本文标签属性:
ecshop:ecshop小程序源码