Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento: Getting Discounted price

Tags:

magento

We have a mixture of products, some with specialPrice and some with Catalog Rules set.

I need to display the discounted % for all my products on my frontend.

We were using $_product->getSpecialPrice() to get the discounted price, but this fails for products which prices based on catalog rules.

Is it possible to get the Discounted prices based on the catalog rule or from the specialPrice ?

like image 448
TheVyom Avatar asked Nov 24 '11 09:11

TheVyom


1 Answers

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

Here is the difference in the three prices:

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

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

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

like image 157
Mohammad Azhar Avatar answered Nov 13 '22 16:11

Mohammad Azhar