2
나는 내 제품 view.phtml 파일에이 코드를 가지고 있습니다. 나는 배송 견적을 받고 영국 주소로 최저 비용을 책정하여 제품 페이지에 표시합니다. 페이지에 전체 운송 비용 견적을 보내는 것보다. 간단한 제품 잘 작동, 구성 가능한 제품의 제품 페이지에 배송비를 어떻게 넣을 수 있습니까?
<?php
if($_product->isSaleable())
{
$quote = Mage::getModel('sales/quote');
$quote->getShippingAddress()->setCountryId('GB');
$quote->addProduct($_product);
$quote->getShippingAddress()->collectTotals();
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->getShippingAddress()->collectShippingRates();
$rates = $quote->getShippingAddress()->getShippingRatesCollection();
$minPrice = PHP_INT_MAX;
foreach ($rates as $rate) {
$minPrice = min($minPrice, $rate->getPrice());
}
if ($minPrice == 0) {
echo ('This item qualifies for FREE shipping');
}
elseif ($minPrice < PHP_INT_MAX) {
echo ('Shipping to UK from £' . money_format('%i', $rate->getPrice()) . "\n");
}
}
?>
. 그러나 구성 가능한 제품에, 그것은 항상 무료 배송을 표시합니다! 이 문제를 어떻게 해결할 수 있습니까?
대단히 감사합니다. 위의 코드가 구성 가능한 제품에서 작동하도록했지만 지금은 간단한 제품에서는 작동하지 않습니다. 나중에 내 솔루션으로 업데이트하겠습니다. –