Magento: getting a discount

We have a mix of products, some with specialPrice and some with a set of catalog rules.

I need to display a% discount for all my products on my interface.

We used $ _product-> getSpecialPrice () to get a discount, but this does not match products whose prices are based on catalog rules.

Can I get a discount based on a catalog rule or a special price?

+7
source share
2 answers

Try this snippet: This will calculate the price rules.

Mage::getModel('catalogrule/rule')->calcProductPriceRule($product,$product->getPrice()); 

Is this what you are looking for?

+10
source

Yes, you can use $_product->getFinalPrice() .

Here is the difference in three prices:

$regularPrice = number_format($_product->getPrice(), 2);

$discountedPrice = number_format($_product->getFinalPrice(), 2);

$specialPrice = number_format($_product->getSpecialPrice(), 2);

+12
source

All Articles