我需要启用统一费率运费,但不希望它显示在任何地方的前端请帮助我这样做谢谢
答案 0 :(得分:0)
我认为你想为此创建一个自定义模块。
我为管理员免费送货模块创建了一个。这是我的模型文件。这可能会用于你。
<?php
class Namespace_Shipping_Model_Carrier_Customrate
extends Mage_Shipping_Model_Carrier_Abstract
implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'my_customrate';
protected $_isFixed = true;
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
if (!$this->getConfigFlag('active')) {
return false;
}
if (!Mage::app()->getStore()->isAdmin()) {
return false;
}
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()) {
$freeBoxes += $item->getQty() * $child->getQty();
}
}
} elseif ($item->getFreeShipping()) {
$freeBoxes += $item->getQty();
}
}
}
$result = Mage::getModel('shipping/rate_result');
$method = Mage::getModel('shipping/rate_result_method');
$method->setCarrier('proporta_customrate');
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod('proporta_customrate');
$method->setMethodTitle($this->getConfigData('name'));
$method->setPrice(0);
$method->setCost(2);
$result->append($method);
return $result;
}
public function getAllowedMethods()
{
return array('proporta_customrate' => $this->getConfigData('name'));
}
}