Tuesday, December 27

How to get actual price and special price of a product in Magento

Here is a quick and useful code on getting actual price and special price of any product in Magento. The actual price is the real price assigned to the product and special price is the price after any discount is applied to the product.

Loading Product

$_productId = 52;
$_product = Mage::getModel('catalog/product')->load($_productId);

Get Actual Price
// without currency sign
$_actualPrice = $_product->getPrice();
 
// with currency sign
$_formattedActualPrice = Mage::helper('core')->currency($_product->getPrice(),true,false);

Get Special Price
// without currency sign
$_specialPrice = $_product->getFinalPrice();
 
// with currency sign
$_formattedSpecialPrice = Mage::helper('core')->currency($_product->getFinalPrice(),true,false);


Ref : http://blog.chapagain.com.np/magento-how-to-get-actual-price-and-special-price-of-a-product

No comments:

Post a Comment