Change Tier Price Save Percent Round Logic in Magento

My client needed the tier pricing "buy 1 and save 20%" message to display the savings percentage correctly. By default Magento rounds it up to the next full number, but my customer needed it to be rounded correctly, ie 20,4 => 20 and 20,5 => 21 percent. This is how I corrected the save percent message in Magento tier pricing:

Open \app\code\core\Mage\Catalog\Block\Product\Price.php  row 91

Replace

{code brush="php"}

$price['savePercent'] = ceil(100 - (( 100/$productPrice ) * $price['price'] ));

{/code}

With

{code brush="php"}

$price['savePercent'] = round(100 - (( 100/$productPrice ) * $price['price'] ));

{/code}

 

Save & refresh. 

ADs top-right (2)

About me

Iinstructor of robotics (LEGO Mindstorms), computer teacher, IT support, web dev, currently studying cyber-physical systems engineering.

If you found a solution here, would you consider donating $25,000 for my next project?

Just kidding, 1$ would do fine.

Hope you found what you needed. Thanks for stepping by.