Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to show Product Price / 12 (for monthly pricing)


Guest

Recommended Posts

Hi all, I have this coding in product info:

 

	if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
		$products_price = '<span class="product_info_price">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
	} else {
		$products_price = '<span class="product_info_price">' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
}

 

I want to add a new string $month_price, where it is the $products_price / 12 and only show 2 decimal places, I have tried the coding below, but it only returns a Zero, and unsure if it will if working only show 2 decimal places, can anyone help?

 

 

	if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
		$products_price = '<span class="product_info_price">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
	$month_price = ($currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) / 12);
} else {
		$products_price = '<span class="product_info_price">' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
	$month_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) / 12;
}

Link to comment
Share on other sites

Where am I going wrong

 

	if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
		$products_price = $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
		} else {
		$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
		}

$month_price = ($products_price / 12);

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...