magento的运费 运费:

magento的运费 运费:,magento,methods,each,product,shipping,Magento,Methods,Each,Product,Shipping,(美国/加拿大境内): 我们每种产品收费5.95美元,每增加一种产品收费1.00美元 (海外) 我们对一种产品收取12.95美元,每增加一种产品收取2.00美元 如何在magento中实现每个附加产品价格?请查找app/code/Local/MY/Shipping/Model/Carrier/MyFlatrate.php 在这里,您可以添加collectRates方法 public function collectRates(Mage_Shipping_Model_Rate_Request $

(美国/加拿大境内): 我们每种产品收费5.95美元,每增加一种产品收费1.00美元

(海外) 我们对一种产品收取12.95美元,每增加一种产品收取2.00美元


如何在magento中实现每个附加产品价格?

请查找app/code/Local/MY/Shipping/Model/Carrier/MyFlatrate.php 在这里,您可以添加collectRates方法

 public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    if (!$this->getConfigFlag('active')) {
        return false;
    }

    $freeBoxes = 0;
    if ($request->getAllItems()) {
        foreach ($request->getAllItems() as $item) {

            // Write your logic here
        }
    }


    $result = Mage::getModel('shipping/rate_result');
    if ($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;
    }

    $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
    $shippingPrice = $this->get_pro_ship();

    if ($shippingPrice !== false) {
        $method = Mage::getModel('shipping/rate_result_method');

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

        $method->setMethod('flatrate');
        $method->setMethodTitle($this->getConfigData('name'));

        if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
            $shippingPrice = '0.00';
        }


        $method->setPrice($shippingPrice);
        $method->setCost($shippingPrice);

        $result->append($method);
    }

$request->getAllItems()包含购物车/报价单中的所有产品。

您可以根据报价单中的国家/地区和产品数量创建自定义发货方法。谢谢,我为国家/地区添加了两个统一费率,但我无法为每个附加产品实施$1和$2……您能告诉我这是如何实现的或任何扩展可用吗?