0
我需要啓用統一費率運費,但不希望它顯示在前端的任何地方,請幫助我這樣做的感謝扁平率送貨方式
我需要啓用統一費率運費,但不希望它顯示在前端的任何地方,請幫助我這樣做的感謝扁平率送貨方式
我想你想創建這個自定義moudle。
我已經創建了一個爲此管理員免費送貨module.This是我的模型file.this可能會使用你。
<?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'));
}
}
如果有人有此解決方案,請幫助我 – rishu 2013-03-07 11:06:52