magento收取运费,占小计的百分比

magento收取运费,占小计的百分比,magento,shipping,Magento,Shipping,希望根据百分比计算运费,这也是管理员可以管理的。 例如:-运费[管理]:10 如果小计=100,则 运费=10英镑。 提前谢谢。唉,我得到了答案。 文件从app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php复制到->local/Mage/Shipping/Model/Carrier/Flatrate.php 关于第96行,请相应编辑: if ($request->getFreeShipping() === true || $reque

希望根据百分比计算运费,这也是管理员可以管理的。 例如:-运费[管理]:10 如果小计=100,则 运费=10英镑。 提前谢谢。

唉,我得到了答案。 文件从app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php复制到->local/Mage/Shipping/Model/Carrier/Flatrate.php 关于第96行,请相应编辑:

if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
                $shippingPrice = '0.00';
            }
                    //code starts here
            if ($this->getConfigData('shipper_type') == 'P')
            {
            $session        = Mage::getSingleton('checkout/session');
            $quote_id       = $session->getQuoteId();

            $item_quote     = Mage::getModel('sales/quote')->load($quote_id);

            $shippingPrice  = $item_quote->getSubtotal()*($this->getConfigData('price')/100);
            //code ends here
            }


            $method->setPrice($shippingPrice);
            $method->setCost($shippingPrice);
在app/code/core/Mage/Shipping/etc/system.xml中。[关于第181行]

我希望这对某人有所帮助。

唉,我得到了答案。 文件从app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php复制到->local/Mage/Shipping/Model/Carrier/Flatrate.php 关于第96行,请相应编辑:

if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
                $shippingPrice = '0.00';
            }
                    //code starts here
            if ($this->getConfigData('shipper_type') == 'P')
            {
            $session        = Mage::getSingleton('checkout/session');
            $quote_id       = $session->getQuoteId();

            $item_quote     = Mage::getModel('sales/quote')->load($quote_id);

            $shippingPrice  = $item_quote->getSubtotal()*($this->getConfigData('price')/100);
            //code ends here
            }


            $method->setPrice($shippingPrice);
            $method->setCost($shippingPrice);
在app/code/core/Mage/Shipping/etc/system.xml中。[关于第181行]


我希望这对其他人有所帮助。

我认为system.xml部分是错误的,它应该引用shipperType,而不是handlingType。除此之外,这是一个巨大的帮助。@iJeep:谢谢。谢谢你指出这一点。现在system.xml已经更新了。请避免更改核心文件,更好的方法是按照本教程的建议执行:我对代码进行了扩展。我认为system.xml部分是错误的,它应该引用shipperType,而不是handlingType。除此之外,这是一个巨大的帮助。@iJeep:谢谢。谢谢你指出这一点。现在system.xml已经更新了。请避免更改核心文件,更好的方法是按照本教程的建议执行:我对代码进行了扩展
class Mage_Shipping_Model_Source_ShipperType
{
    public function toOptionArray()
    {
        return array(
            array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_FIXED, 'label' => Mage::helper('shipping')->__('Fixed')),
            array('value' => Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_PERCENT, 'label' => Mage::helper('shipping')->__('Percent')),
        );
    }
}