i want in details product page display with $_product->getPrice() and $_product->getSpecialPrice(), also the percentage by which the price has been changed, how i can display this percentage in page?
Thanks
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this community$origPrice = $_product->getPrice();
$finalPrice = $_product->getFinalPrice();
$percentage = ($origPrice - $finalPrice) * 100 / $origPrice;
This covers both cases: when you have a special price and when you have a catalog rule that discounts your product price.
All you need to do is print the $percentage
variable.
Also, do a verification if $origPrice
is not zero, and format the variable value as you want.