<!-- SHOW SHIPPING RATES-->
<?php
$quote = Mage::getModel('sales/quote');
$quote->getShippingAddress()->setCountryId('US'); // Set your default shipping country here
$_product->getStockItem()->setUseConfigManageStock(false);
$_product->getStockItem()->setManageStock(false);
$qty = $_product->getStockItem()->getMinSaleQty();
$quote->addProduct($_product,$qty);
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->getShippingAddress()->collectTotals();
$rates = $quote->getShippingAddress()->getShippingRatesCollection();
// Find cheapest rate
$cheapestrate = null;
foreach ($rates as $rate) {
if (is_null($cheapestrate) || $rate->getPrice() < $cheapestrate) {
$cheapestrate = $rate->getPrice();
}
}
$corehelper = Mage::helper('core');
if ($cheapestrate) {
echo '<p><strong>Shipping costs:</strong> ' . $corehelper->currency($cheapestrate) . '</p>';
}else {
echo "<strong>Free shipping</strong> for this product.";
}
?>
<!-- END SHOW SHIPPING RATES-->
magento产品页面显示最低运费
最新推荐文章于 2024-08-30 10:14:12 发布