I'm using the following formula to show pergentage discount on frontend

$sconto =  100 - ($_product->getFinalPrice() / $_product->getPrice())*100);

It's working well with > 1 € prices, but failes with this case:

  • Full price 0,90 €
  • Discounted price 0,86 €
  • Discount (by catalog price rule): 5%
  • Discount showed: 4%

I think it is a round problem, but I don't now how to solve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.