首页 > 网站 > 建站经验 > 正文

解决ecshop免运费赠品加入购物车依旧收取运费问题

2024-04-25 20:43:26
字体:
来源:转载
供稿:网友

ecshop所有版本包括最新2.7.4版本,存在免运费赠品加入购物车后依旧收取运费的错误漏洞问题。比如把充值卡商品后台勾选设置为免运费,买家购买该充值卡商品并添加免运费的赠品后,订单反而又要收取邮费的BUG问题。

解决方法打开ECSHOP网站根目录中的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 ) ".

"SELECT '$_SESSION[user_id]', '" . SESS_ID . "', goods_id, goods_sn, goods_name, market_price, ".

"'$price', 1, is_real, extension_code, 0, '$act_id', '" . CART_GENERAL_GOODS . "' " .

"FROM " . $GLOBALS['ecs']->table('goods') .

" WHERE goods_id = '$id'";

$GLOBALS['db']->query($sql);

}

将以上的代码修改为如下代码

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, ".

"'$price', 1, is_real, extension_code, 0, '$act_id', '" . CART_GENERAL_GOODS . "', is_shipping " .

"FROM " . $GLOBALS['ecs']->table('goods') .

" WHERE goods_id = '$id'";

$GLOBALS['db']->query($sql);

}

按照以上操作就很好的解决了ECShop网店添加免运费赠品后,购物车变为收取运费的错误漏洞这个问题了。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表