| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Product weight in grams with no decimal places. | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Product weight in grams with no decimal places.
Hi,
If you have your site product weight set to just grams then it makes sense to remove the 2 decimal places when displaying product details as this is kind of meaningless (and at a glance misread). (i.e. 25 g looks better than 25.00 g) I'm sure its not the only way of fixing this, but I've managed to sort this one by using the smarty math function to multiply the weight by 1 and format the output to 0 decimal places with Code:
This update affects Skin1\customer\main\product.tpl (make sure you edit product, and not products with an s in the same directory or you'll get confused) -------------- Update the following line - approx 26 lines from the top (which displays the product detail weight) Code:
with this one (replacing the {$product.weight} with the math function above) Code:
And that's it ! Id be interested to know if there are any alternative or less compute intensive way of doing this - it's a shame smarty doesn't have a string function) - I think maybe a weight format option wouldn't be a bad idea for future relase maybe? Anyway, TTFN, John |
|||||||
#2
|
|||||||||
|
|||||||||
try
{$product.weight|replace:".00":""}
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. EWD Hosting Hands On Hosting |
|||||||||
#3
|
|||||||
|
|||||||
Usefull to know!
Thanks Shan. |
|||||||
#4
|
|||||||||
|
|||||||||
http://smarty.php.net is mucho usefull
__________________
Looking for a reliable X-cart host ? You wont go wrong with either of these. EWD Hosting Hands On Hosting |
|||||||||
|
|||
X-Cart forums © 2001-2020
|