RE: Display "You save n%"

DanBiel <[email protected]>
Newsgroups gmane.comp.web.oscommerce.features
Message-ID <d912166e8d5a6a1bfcbc80b112fcb5f4@osCommerce-Forums>
This message was sent from: Features
http://forums.oscommerce.com/viewtopic.php?p=181292#181292
----------------------------------------------------------------

if ($new_price = tep_get_products_special_price($product_info_values['products_id'])) {
      $list_price = '<s>' . $currencies->display_price($product_info_values['products_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) . '</s>';
			$our_price = '<span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info_values['products_tax_class_id'])) . '</span>';
			//get the list price and special price and then display the savings
			$no_savings = substr(($currencies->display_price($product_info_values['products_price'], tep_get_tax_rate($product_info_values['products_tax_class_id']))), 1);
			$no_savings = $no_savings + 0.0;
			$now_savings = substr(($currencies->display_price($new_price, tep_get_tax_rate($product_info_values['products_tax_class_id']))), 1);
			$now_savings = $now_savings + 0.0;
			$savings = (($now_savings / $no_savings) * 100);
			$savings = round($savings);    						

    } else {
      $list_price = $currencies->display_price($product_info_values['products_price'], tep_get_tax_rate($product_info_values['products_tax_class_id']));
    }?>
		<center>List Price: <? echo $list_price; ?><br>
		        Our Price: <? echo $our_price; ?><br>
						You Save: <? echo $savings. "%"; ?>

I put this code into the products_info page so that it displays just under the product picture.  Works wonderfully!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.