Magento 表中的费率不适用于免费送货

Magento 表中的费率不适用于免费送货,magento,matrix,rate,flat,Magento,Matrix,Rate,Flat,我需要显示一个货运公司的免费航运选项列表,即时通讯使用 扩展“Webshopapps矩阵费率”适用于价格 但当运费为0(免费)时,它就不起作用了(见链接中的图片) 这是密码 } 有什么线索吗?我不知道你想达到什么目的,但我想为不同类别提供不同的运费价格,运费价格是篮子中类别的最大值,高于一定价格的免费运费(还有一个类别,礼品券,如果是单独的话,也可以免费运费),不同国家的运输价格也不同 我使用并修改了它,以提供我想要的详细规则。打开共享图像文件。如果价格达到“0”,则不显示交货类型。如果我将

我需要显示一个货运公司的免费航运选项列表,即时通讯使用 扩展“Webshopapps矩阵费率”适用于价格

但当运费为0(免费)时,它就不起作用了(见链接中的图片)

这是密码

}


有什么线索吗?

我不知道你想达到什么目的,但我想为不同类别提供不同的运费价格,运费价格是篮子中类别的最大值,高于一定价格的免费运费(还有一个类别,礼品券,如果是单独的话,也可以免费运费),不同国家的运输价格也不同


我使用并修改了它,以提供我想要的详细规则。

打开共享图像文件。如果价格达到“0”,则不显示交货类型。如果我将运输价格设置在0以上,一切都会正常工作。
protected $_code = 'matrixrate';
protected $_default_condition_name = 'package_weight';

protected $_conditionNames = array();

public function __construct()
{
    parent::__construct();
    foreach ($this->getCode('condition_name') as $k=>$v) {
        $this->_conditionNames[] = $k;
    }
}


/**
 * Enter description here...
 *
 * @param Mage_Shipping_Model_Rate_Request $data
 * @return Mage_Shipping_Model_Rate_Result
 */
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    if (!$this->getConfigFlag('active')) {
        return false;
    }

    // exclude Virtual products price from Package value if pre-configured
    if (!$this->getConfigFlag('include_virtual_price') && $request->getAllItems()) {
        foreach ($request->getAllItems() as $item) {
            if ($item->getParentItem()) {
                continue;
            }
            if ($item->getHasChildren() && $item->isShipSeparately()) {
                foreach ($item->getChildren() as $child) {
                    if ($child->getProduct()->isVirtual() || $item->getProductType() == 'downloadable') {
                        $request->setPackageValue($request->getPackageValue() - $child->getBaseRowTotal());
                    }
                }
            } elseif ($item->getProduct()->isVirtual() || $item->getProductType() == 'downloadable') {
                $request->setPackageValue($request->getPackageValue() - $item->getBaseRowTotal());
            }
        }
    }

    // Free shipping by qty
    $freeQty = 0;
    if ($request->getAllItems()) {
        foreach ($request->getAllItems() as $item) {
            if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
                continue;
            }

            if ($item->getHasChildren() && $item->isShipSeparately()) {
                foreach ($item->getChildren() as $child) {
                    if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
                        $freeQty += $item->getQty() * ($child->getQty() - (is_numeric($child->getFreeShipping()) ? $child->getFreeShipping() : 0));
                    }
                }
            } elseif ($item->getFreeShipping()) {
                $freeQty += ($item->getQty() - (is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0));
            }
        }
    }

    if (!$request->getMRConditionName()) {
        $request->setMRConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
    }

     // Package weight and qty free shipping
    $oldWeight = $request->getPackageWeight();
    $oldQty = $request->getPackageQty();

    if ($this->getConfigData('allow_free_shipping_promotions') && !$this->getConfigData('include_free_ship_items')) {
        $request->setPackageWeight($request->getFreeMethodWeight());
        $request->setPackageQty($oldQty - $freeQty);
    }

    $result = Mage::getModel('shipping/rate_result');
    $ratearray = $this->getRate($request);

    $freeShipping=false;

    if (is_numeric($this->getConfigData('free_shipping_threshold')) && 
        $this->getConfigData('free_shipping_threshold')>0 &&
        $request->getPackageValue()>$this->getConfigData('free_shipping_threshold')) {
            $freeShipping=true;
    }
    if ($this->getConfigData('allow_free_shipping_promotions') &&
        ($request->getFreeShipping() === true || 
        $request->getPackageQty() == $this->getFreeBoxes()))
    {
        $freeShipping=true;
    }
    if ($freeShipping)
    {
        $method = Mage::getModel('shipping/rate_result_method');
        $method->setCarrier('matrixrate');
        $method->setCarrierTitle($this->getConfigData('title'));
        $method->setMethod('matrixrate_free');
        $method->setPrice('0.00');
        $method->setMethodTitle($this->getConfigData('free_method_text'));
        $result->append($method);

        if ($this->getConfigData('show_only_free')) {
            return $result;
        }
    }

   foreach ($ratearray as $rate)
    {
       if (!empty($rate) && $rate['price'] >= 0) {
          $method = Mage::getModel('shipping/rate_result_method');

            $method->setCarrier('matrixrate');
            $method->setCarrierTitle($this->getConfigData('title'));

            $method->setMethod('matrixrate_'.$rate['pk']);

            $method->setMethodTitle(Mage::helper('matrixrate')->__($rate['delivery_type']));

            $shippingPrice = $this->getFinalPriceWithHandlingFee($rate['price']);
            $method->setCost($rate['cost']);
            $method->setDeliveryType($rate['delivery_type']);

            $method->setPrice($shippingPrice);

            $result->append($method);
        }
    }

    return $result;
}

public function getRate(Mage_Shipping_Model_Rate_Request $request)
{
    return Mage::getResourceModel('matrixrate_shipping/carrier_matrixrate')->getNewRate($request,$this->getConfigFlag('zip_range'));
}

/**
 * Get allowed shipping methods
 *
 * @return array
 */
public function getAllowedMethods()
{
    return array('matrixrate'=>$this->getConfigData('name'));
}


public function getCode($type, $code='')
{
    $codes = array(

        'condition_name'=>array(
            'package_weight' => Mage::helper('shipping')->__('Weight vs. Destination'),
            'package_value'  => Mage::helper('shipping')->__('Price vs. Destination'),
            'package_qty'    => Mage::helper('shipping')->__('# of Items vs. Destination'),
        ),

        'condition_name_short'=>array(
            'package_weight' => Mage::helper('shipping')->__('Weight'),
            'package_value'  => Mage::helper('shipping')->__('Order Subtotal'),
            'package_qty'    => Mage::helper('shipping')->__('# of Items'),
        ),

    );

    if (!isset($codes[$type])) {
        throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Matrix Rate code type: %s', $type));
    }

    if (''===$code) {
        return $codes[$type];
    }

    if (!isset($codes[$type][$code])) {
        throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Matrix Rate code for type %s: %s', $type, $code));
    }

    return $codes[$type][$code];
}