This worked for me, however, when I have a special price, I get 0.00s as the list price and our price.
e.g.
List Price: 0.00
Our Price: 0.00
You Save: 6%
Any suggestions would be appreciated. thanks.
<?php
}
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
$list_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s>';
$our_price = '<span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
//get the list price and special price and then display the savings
$no_savings = preg_replace("/,/", "", substr(($currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']))), 1));
$now_savings = preg_replace("/,/", "", substr(($currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']))), 1));
$now_savings = $now_savings + 0.0;
$savings_b = (($now_savings / $no_savings) * 100);
$savings = (100 - $savings_b);
$savings = round($savings);
} else {
$list_price = preg_replace("/,/", "", substr(($currencies->display_price($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id']))),1));
$list_price =$list_price + 0.0;
$our_price = preg_replace("/,/", "", substr(($currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']))),1));
$our_price = $our_price + 0.0;
$savings_a = (($our_price / $list_price) * 100);
$savings = (100 - $savings_a);
$savings = round($savings);
}?>
<p></p>
<center>List Price: <? echo "$"; echo number_format($list_price, 2); ?><br>
<strong>Our Price: <? echo "$"; echo number_format($our_price, 2); ?></strong><br>
<font color="#FF0000">You Save: <? echo $savings. "%"; ?></font>
[/CODE][CODE]