2016-05-19 5 views

答えて

2

テーマの '/template/catalog/product/view.phtml'ファイルに次のコードを貼り付けることができます。

if($_product->isSaleable()) 
{ 
$quote = Mage::getModel('sales/quote'); 
$quote->getShippingAddress()->setCountryId('DK'); 
$quote->addProduct($_product); 
$quote->getShippingAddress()->collectTotals(); 
$quote->getShippingAddress()->setCollectShippingRates(true); 
$quote->getShippingAddress()->collectShippingRates(); 
$rates = $quote->getShippingAddress()->getShippingRatesCollection(); 

foreach ($rates as $rate) 
{ 
echo $rate->getPrice(); 
} 
} 

最後のforeachはあなたに有効な別の配送方法の配送料金を提供します。任意の変数に格納し、view.phtmlファイルに必要な場所に表示します。あなたは終わった!

+0

Magento CE 1.9.3.6でうまく動作します。 – Anse

+1

誰もデンマークに住んでいるわけではないので、ちょうど1つのグリッチです: '$ quote-> getShippingAddress() - > setCountryId(Mage :: getStoreConfig( 'general/country/default')); ' – Anse

+0

デンマークのために設定されたなぜ。 –

関連する問題