最近、私は同じ要件を持っていると私はイベントオブザーバメソッドを実装することで固定。あなたがイベントを実装することにより、任意の条件のいずれかの配送方法への追加送料を追加することができます実際に
はsales_quote_collect_totals_before
と(ただしダミーコード)オブザーバモデル法と呼ばれるようになっています
public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer)
{
/**@var Mage_Sales_Model_Quote $quote */
$quote = $observer->getQuote();
$someConditions = true; //this can be any condition based on your requirements
$newHandlingFee = 15;
$store = Mage::app()>getStore($quote>getStoreId());
$carriers = Mage::getStoreConfig('carriers', $store);
foreach ($carriers as $carrierCode => $carrierConfig) {
if($carrierCode == 'fedex'){
if($someConditions){
Mage::log('Handling Fee(Before):' . $store->getConfig("carriers/{$carrierCode}/handling_fee"), null, 'shipping-price.log');
$store->setConfig("carriers/{$carrierCode}/handling_type", 'F'); #F - Fixed, P - Percentage
$store->setConfig("carriers/{$carrierCode}/handling_fee", $newHandlingFee);
###If you want to set the price instead of handling fee you can simply use as:
#$store->setConfig("carriers/{$carrierCode}/price", $newPrice);
Mage::log('Handling Fee(After):' . $store->getConfig("carriers/{$carrierCode}/handling_fee"), null, 'shipping-price.log');
}
}
}
}
あなたはどんな側 - に気づくくださいこのような方法でストアの設定値を設定することで、 – pspahn