This post is posted on Saurabh Patel’s Request. He required this thing to be done in Magento.
To display Special Price percentage discount in Magento, you need to do following steps
1) Goto app/design/frontend/YOURTHEME/default/template/catalog/product/price.phtml
2) Basically we need to find the percentage of the difference between the actual price and special price. So first we will obtain both special and actual price of the product using following code
$_actualPrice = $_store->roundPrice($_store->convertPrice($_product->getPrice()));
$_convertedFinalPrice = $_store->roundPrice($_store->convertPrice($_product->getFinalPrice()));
Here Both these prices are already retrived in the file price.phtml
3) To get the discount percentage use the following code
$_discountPercentage = round((($_actualPrice-$_convertedFinalPrice)/$_actualPrice)*100);
Now you got the discount percentage stored in $_discountPercentage variable. Next you need to display this percentage only where Special price is available. To do so you need to find the class “special-price” and under that class you can enter the discount amount percentage.
You can simply call it using echo $_discountPercentage.”%”. You can format it as per your requirement.
Thats it. Please provide your feedback as a comments