![]() |
Weight to three decimal places
Hi,
i deal in jewellery components whose weight is often 1gram or less. I changed weight in database xcart_products to decimal(12,3) with default weight of 0.001 (1gram) I also changed this line in product_details.tpl from Code:
<input type="text" name="weight" size="18" value="{ $product.weight|formatprice|default:$zero }" /> Code:
<input type="text" name="weight" size="18" value="{ $product.weight|default:$zero }" /> vixnfox |
Re: Weight to three decimal places
In the Uk we use metric for weights etc, and this is one of the first things I change in all the X-cart Pro versions I've tested.
You will have to change several tpl files in addition to the 12/3 decimal in the database. I posted some info on the following link in June about this. http://forum.x-cart.com/showpost.php?p=127842&postcount=75 Note Also that Code:
{ $product.weight|formatprice|default:$zero } Code:
{ $product.weight|formatnumeric|default:$zero } I will search my system for the list of files and changes required and post back. |
Re: Weight to three decimal places
Many thanks syddos. I will look forward to it. Pity metric wasnt catered to fully as an option.
vixnfox |
Re: Weight to three decimal places
Note: I only have an X-Cart PRO license, and only v4.1.X setup for testing, so the skin1 directories may differ for X-Cart GOLD and Gold versions.
DATABASE TABLES Using phpadmin or similar editor, view the ⌠structure page■ xcart_products In the FIELD column locate weight In the TYPE column, change the entry from decimal(12,2) to decimal(12,3) In the DEFAULT column, change 0.00 to 0.000 xcart_shipping In the FIELD column locate weight_min and weight_limit In the TYPE column, change the entry from decimal(12,2) to decimal(12,3) In the DEFAULT column, change 0.00 to 0.000 xcart_shipping_rates In the FIELD column locate minweight and maxweight In the TYPE column, change the entry from decimal(12,2) to decimal(12,3) In the DEFAULT column, change 0.00 to 0.000 TEMPLATE FILES admin/main/shipping.tpl This following appears in 3 lines of code, each in a different template section, also make sure to check the extreme RIGHT of the editing page, as some of these lines a very long. Code:
Search for "data[{$s.shippingid}][weight_min]" Code:
The following appears in 1 line of code only in this template. ---------------------------------------------------------------------------------------------------------------------------------- customer/main/product.tpl Search for {if $product.weight ne "0.00"} Change to {if $product.weight ne "0.000"} Search for {$product.weight|formatprice} Change to {$product.weight|formatnumeric} ---------------------------------------------------------------------------------------------------------------------------------- skin1/main/product_details.tpl Search for { $product.weight|formatprice|default:$zero } Change to { $product.weight|formatnumeric|default:$zero } ---------------------------------------------------------------------------------------------------------------------------------- provider or admin/main/shipping_rates.tpl Code:
Search for "posted_data[{$shipping_rate.rateid}][minweight]" These changes will display 3 decimal places on product pages, and on the "Add"/"Display" admin/provider shipping and shipping rates pages. |
Re: Weight to three decimal places
That is excellent!! Thank you. I had found the shipping.tpl references and rhe xcart_products table but hadnt thought about the other files and tables you mentioned.
Metric rocks!! vixnfox |
Re: Weight to three decimal places
Glad to help.
I often wonder how many UK and European X-Cart owners have not spotted that they cannot enter metric weights for any product that falls between X.100g and X.999g, without X-Cart converting it to X.10g and X.99g. |
Re: Weight to three decimal places
Yes it makes you think. I ran a test order on products supposed to be 0.1 grams and soon reached the max weight limit, was most frustrating and prompted this thread.
Just a slight variation, I only really needed weight to 0.1 grams (many components are even less, but I aint weighing them!!) so I adjusted accordingly (12,1 default 0.0) and modded the files you listed accordingly. Works a treat! Of course I had to redo all my shipping charges, no big deal, oh and also in General settings changed the default weight symbol to grams, and specify 1 as the unit of weight defined by the symbol. vixnfox |
Re: Weight to three decimal places
Hi Syddos,
Many thanks for a great mod. Works fantastic in 4.1.7. Just one thing if anyone is working with product variants then you will also need to change the following so that the change shows up in Admin / Products / Variants screen: - skin1/admin/main/product_links.tpl Find this {if $product.weight ne "0.00"} Change to {if $product.weight ne "0.000"} Next skin1/modules/product_Options/product_variants.tpl Find this {$v.weight|formatprice} Change to {$v.weight|formatnumeric} Once again many thanks Kind regards Nick |
Re: Weight to three decimal places
I'm trying to get this working with 4.1.6 and I can't find the admin/main/shipping_rates.tpl file.
Is this named something different in 4.1.6? |
All times are GMT -8. The time now is 06:35 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.