Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

formating custom price


njtermite

Recommended Posts

Hey Guys,

Ok so I have a few prices showing on my product info page..

default_price, sales_price_, lease_price

 

I'm pulling the data from the database fine, but I'm trying to get it to format it like it does with the sales price. Currently my custom prices are showing as 8.7500 instead of 8.75 for example.

 

I tried doing this code here..

 

added to currencies.php

function display_default_price($products_default_price) {
  return $this->format($products_default_price);
}

 

then added to product_info.php

$products_default_price = '<s>' . $currencies->display_default_price($product_info['products_default_price']);

 

Any suggestions?

 

Thanks!

Mark

 

P.S. opps sorry if I posted in the wrong place

Link to comment
Share on other sites

ok I figured this out... heres how I have it working if anyone else needs to do something like this..

 

You don't need to add any code to currencies.php

 

 

added to product_info.php

 

$products_lease_price = $currencies->display_price($product_info['products_lease_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

 

then added this code to call it

echo $products_lease_price;

 

Why it wasn't working early for me was because I was using this code...

echo ($product_info['products_lease_price'];

 

Which meant it was pulling straight from the database and not my new variable.

 

Regards,

Mark

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...