搜索
首页php教程php手册Ecshop系统添加免运费赠品后购物车变为收取运费解决办法

使用商城的朋友可能会经常碰到关于利用ecshop来实现一些活动的需求,把电影票设置为免运费。但是事实情况却事与愿违,消费者购买订单超过100元并添加免运费的赠品后,订单反而又要收取邮费

flow.php

    }
}
 代码如下
 代码如下 复制代码

/* 添加赠品到购物车 */
foreach ($favourable['gift'] as $gift)
{
    if (in_array($gift['id'], $_POST['gift']))
    {
        add_gift_to_cart($act_id, $gift['id'], $gift['price']);
    }
}

复制代码

/* 添加赠品到购物车 */

foreach ($favourable['gift'] as $gift)
 代码如下 复制代码

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);
}

{

    if (in_array($gift['id'], $_POST['gift']))

    {

        add_gift_to_cart($act_id, $gift['id'], $gift['price']);

我把该函数修改后的源码贴出来,大家对照一下就明白了:

 代码如下

复制代码
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系统添加免运费赠品后,购物车变为收取运费的bug这个问题了。 本文地址:转载随意,但请附上文章地址:-)
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热工具

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )专业的PHP集成开发工具

WebStorm Mac版

WebStorm Mac版

好用的JavaScript开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。