| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Weight to three decimal places | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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:
Code:
vixnfox
__________________
V 4.3.1 Live: Developing on PHP 5.3.0 MySQL server 5.0.75-community-log MySQL client 5.1.36 Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11 Windows 7 64bit on a Toshiba Satellite P500 ADELAIDE, SOUTH AUSTRALIA |
|||||||
#2
|
|||||||
|
|||||||
![]() 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:
Code:
I will search my system for the list of files and changes required and post back.
__________________
Syddos Nothing is impossible, We just don't know how to do it ........Yet! Xcart 4.1.X PRO (Testing Platform: winXP Pro) Perl 5.8.7 (win32) WINAMP 1.6.3 (win32 server package. Includes the following) - phpMyAdmin v2.8.03 - MySql 5.0.21 - Apache 2.0.55 (win32) - php 5.1.4 - SQLitemanager 1.2.0 |
|||||||
#3
|
|||||||
|
|||||||
![]() Many thanks syddos. I will look forward to it. Pity metric wasnt catered to fully as an option.
vixnfox
__________________
V 4.3.1 Live: Developing on PHP 5.3.0 MySQL server 5.0.75-community-log MySQL client 5.1.36 Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11 Windows 7 64bit on a Toshiba Satellite P500 ADELAIDE, SOUTH AUSTRALIA |
|||||||
#4
|
|||||||
|
|||||||
![]() 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:
Code:
---------------------------------------------------------------------------------------------------------------------------------- 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:
These changes will display 3 decimal places on product pages, and on the "Add"/"Display" admin/provider shipping and shipping rates pages.
__________________
Syddos Nothing is impossible, We just don't know how to do it ........Yet! Xcart 4.1.X PRO (Testing Platform: winXP Pro) Perl 5.8.7 (win32) WINAMP 1.6.3 (win32 server package. Includes the following) - phpMyAdmin v2.8.03 - MySql 5.0.21 - Apache 2.0.55 (win32) - php 5.1.4 - SQLitemanager 1.2.0 |
|||||||
#5
|
|||||||
|
|||||||
![]() 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
__________________
V 4.3.1 Live: Developing on PHP 5.3.0 MySQL server 5.0.75-community-log MySQL client 5.1.36 Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11 Windows 7 64bit on a Toshiba Satellite P500 ADELAIDE, SOUTH AUSTRALIA |
|||||||
#6
|
|||||||
|
|||||||
![]() 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.
__________________
Syddos Nothing is impossible, We just don't know how to do it ........Yet! Xcart 4.1.X PRO (Testing Platform: winXP Pro) Perl 5.8.7 (win32) WINAMP 1.6.3 (win32 server package. Includes the following) - phpMyAdmin v2.8.03 - MySql 5.0.21 - Apache 2.0.55 (win32) - php 5.1.4 - SQLitemanager 1.2.0 |
|||||||
#7
|
|||||||
|
|||||||
![]() 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
__________________
V 4.3.1 Live: Developing on PHP 5.3.0 MySQL server 5.0.75-community-log MySQL client 5.1.36 Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11 Windows 7 64bit on a Toshiba Satellite P500 ADELAIDE, SOUTH AUSTRALIA |
|||||||
#8
|
|||||||
|
|||||||
![]() 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
__________________
X-Cart Pro 4.7.12 Active and working great with reBOOT-reDUX ![]() X-Cart Pro 4.6.6 Retired after 6 years of first class service ![]() X-Cart Pro 4.1.7 Retired after 9 years of first class service ![]() Apache: 2.4.25 PHP: 7.4.5 MariaDB: 10.1.44 Arch: x86_64 |
|||||||
#9
|
|||||||
|
|||||||
![]() 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?
__________________
Version 4.1.6 to 4.1.11 |
|||||||
|
|||
X-Cart forums © 2001-2020
|