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

Ecshop系统添加免运费赠品后购物车变为收取运费解决办法

May 25, 2016 pm 04:55 PM

使用商城的朋友可能会经常碰到关于利用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']);
    }
}

出问题的地方正是函数“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, ".
                "'$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这个问题了。



本文地址:

转载随意,但请附上文章地址:-)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)