flow.php
代码如下 | 复制代码 |
/* 添加赠品到购物车 */ foreach ($favourable['gift'] as $gift) { if (in_array($gift['id'], $_POST['gift'])) { add_gift_to_cart($act_id, $gift['id'], $gift['price']); } } |
出问题的地方正是函数“add_gift_to_cart”,找到函数的定义,仍在在flow.php文件,
我把该函数修改后的源码贴出来,大家对照一下就明白了:
代码如下 | 复制代码 |
function add_gift_to_cart($act_id, $id, $price) { $sql = "INSERT INTO " . $GLOBALS['ecs']->table('cart') . " (" . "user_id, session_id, goods_id, goods_sn, goods_name, market_price, goods_price, ". "goods_number, is_real, extension_code, parent_id, is_gift, rec_type, is_shipping ) ". "SELECT '$_SESSION[user_id]', '" . SESS_ID . "', goods_id, goods_sn, goods_name, market_price, ". is_shipping " . |
这样就很好的解决了Ecshop系统添加免运费赠品后,购物车变为收取运费的bug这个问题了。
时间: 2024-09-25 20:19:39