如何在magento中按日期添加运费?

时间:2013-12-22 12:08:52

标签: php magento

如果客户想要当天发货,我想提供一个选项,运费将是10美元,否则将是标准费用。只想添加当天发送的复选框。我只有那么多的信息,如果有人可以提供帮助,我会很高兴,因为它对我很难。

1 个答案:

答案 0 :(得分:1)

假设您已在请求送货对象中传递deliveryDate。

如果我们考虑统一费率的代码。然后在下面的功能  public function collectRates(Mage_Shipping_Model_Rate_Request $ request)

    {
If($request->Deliverydate  == Today )// replace code for getting today
{
ShippingPrice=10;
}
elseif ($this->getConfigData('type') == 'O') { // per order
            $shippingPrice = $this->getConfigData('price');
        } elseif ($this->getConfigData('type') == 'I') { // per item
            $shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
        } else {
            $shippingPrice = false;
        }