Friday, March 14, 2014

get catalog rule applied price of product in Magento


 >> We use to get product price like :
                       $_product->getPrice();
                       $_product->getFinalPrice();
     
      Here you can get the catalog rule applied price like:
            $store_id = Mage::app()->getStore()->getId();
            $discounted_price = Mage::getResourceModel('catalogrule/rule')->getRulePrice(
                                                      Mage::app()->getLocale()->storeTimeStamp($store_id),
                                                      Mage::app()->getStore($store_id)->getWebsiteId(),
                                                      Mage::getSingleton('customer/session')->getCustomerGroupId(),
                                                                      $_product->getId());
               
           
            if ($discountedPrice===false) { // if no rule applied for the product
                $discountedPrice = $_product->getFinalPrice();
            }else{
                $discountedPrice = number_format($discountedPrice,2);
            }