首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Prestashop 1.6 -根据最终总价计算的免运费

Prestashop 1.6 -根据最终总价计算的免运费
EN

Stack Overflow用户
提问于 2016-06-01 18:03:37
回答 1查看 1.5K关注 0票数 1

我用的是预铺1.6。我的网站提供“免费送货”为购买超过80美元。我的网站也有一个推广“买1得到1免费”。

现在,一个项目可以花费大约60美元的和我坚持客户购买两个产品从同一类别,以便有权购买1 get 1。

如果客户购买一种产品,它应该花费60美元(不免费送货,因为最终价格< 80)。

如果顾客购买2= 120美元,但是在“购买1得到1免费”促销之后,最终的总价是60。所以说,这个客户不是免费送货,但是我的网站给这个客户免费送货,因为“免费送货”的逻辑是基于折扣前的总价(120美元)。

我该怎么解决这个问题?我希望免费送货的计算是基于最终的总价(折扣后)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-02 08:10:27

您必须从getPackageShippingCost()重写Cart.php方法。

并改变这些行文:

代码语言:javascript
复制
    } else {
        if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
            $shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
        } else { // by price
            $shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency);
        }
    }
} else {
    if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
        $shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
    } else {
        $shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency);
    }
}

$order_total替换为$orderTotalwithDiscounts

代码语言:javascript
复制
    } else {
        if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
            $shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
        } else { // by price
            $shipping_cost += $carrier->getDeliveryPriceByPrice($orderTotalwithDiscounts, $id_zone, (int)$this->id_currency);
        }
    }
} else {
    if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
        $shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
    } else {
        $shipping_cost += $carrier->getDeliveryPriceByPrice($orderTotalwithDiscounts, $id_zone, (int)$this->id_currency);
    }
}

如果您不知道如何重写类,请查看这份文件

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37575809

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档