I've attached modified files (only the files that are moded - rest of the files for the addon unchanged). I needed more field flexibility so I can use this for more aspects of the product - more like a very flexible product specification.
1. Adds admin control of the usage of the "weight" field - allows it to be turned off as historically the product weight field could be used in different ways and did not necessarily represent the actual weight. e.g. was sometimes used as the total shipping weight for input to shipping modules.
2. Because of above can now add Weight as a field and kg and lbs are available as units.
3. Can now have a "Text" type field which allows a lot of flexibility in adding item-specific fields.This necessitates changing the dimensions_value field type in the database from FLOAT to TEXT. - everything keeps working as it should with the change.
4. Now have admin control of whether to use "Euro" style decimal separator (comma) or decimal point (dot). Current version has it linked to metric values but this is not a metric feature - it is a country/language feature and metric values outside of most EU countries use the dot for the decimal separator. Should be straight forward now to link to language in the future if anyone wants to take it that far.
5. I found that the Button to toggle metric/imperial was appearing on products that had no dimensions set - (may be a side affect of the change at 4?). Fixed by changing "if (!empty($dimensions_query))" to "if (mysqli_num_rows($dimensions_query))" in pi_dimensions.php.
6. Changed the button text to be "Toggle imperial/metric" which I believe is more easily recognized in my market.
Products Measures / Dimensions
Extension to the addon - Products Measures / Dimensions
Extension to the addon
- Attachments
-
- Product Measures Revisions.zip
- (30.66 KiB) Downloaded 39 times
-
- VIP Member
- Posts: 13
- Joined: Sat Sep 04, 2021 5:32 am
- Contact:
Re: Extension to the addon
Thank you very much for the work you are sharing as well as the comments! If you want, I can add you as co-author to the add-ons, which would allow you to upload your improvements as a revision, and allow both of us to offer our support/updates?
Regarding metrics/imperial I'm very happy that someone who knows something corrects my mistakes!
//Daniel
Is TEXT necessary for what you need, or could it be VARCHAR(255)? I think that would be preferable, if possible.PandV wrote: from FLOAT to TEXT[/b].
I did consider doing something more flexible with the separators, so thank you for doing it! At some point, it probably should read the value from the main language-file and just use that, so that would be the next thing I pursue.PandV wrote: 4. Now have admin control of whether to use "Euro" style decimal separator (comma) or decimal point (dot). Current version has it linked to metric values but this is not a metric feature - it is a country/language feature and metric values outside of most EU countries use the dot for the decimal separator. Should be straight forward now to link to language in the future if anyone wants to take it that far.
Regarding metrics/imperial I'm very happy that someone who knows something corrects my mistakes!
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
- Kofod95
- VIP Member
- Posts: 613
- Joined: Sat Feb 06, 2021 7:38 pm
- Contact:
Re: Extension to the addon
Yes, that would be fine - would put the pressure on me to clean it all up!Kofod95 wrote:If you want, I can add you as co-author to the add-ons, which would allow you to upload your improvements as a revision, and allow both of us to offer our support/updates?
Yes I agree, VARCHAR is a better option than TEXT.Kofod95 wrote:Is TEXT necessary for what you need, or could it be VARCHAR(255)? I think that would be preferable, if possible.
-
- VIP Member
- Posts: 13
- Joined: Sat Sep 04, 2021 5:32 am
- Contact:
Re: Extension to the addon
I've have added you as co-author, so you should be able to upload a revision now - thank you again for your contribution!
I noticed also that I made a mistake in the "convert to" field, so if you want, it would be a great help if you added a null-value to the beginning of that array (something like ['id' => '', 'text' => TEXT_NONE]] (and then a constant in the language-files defining TEXT_NONE)
//Daniel
I noticed also that I made a mistake in the "convert to" field, so if you want, it would be a great help if you added a null-value to the beginning of that array (something like ['id' => '', 'text' => TEXT_NONE]] (and then a constant in the language-files defining TEXT_NONE)
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
- Kofod95
- VIP Member
- Posts: 613
- Joined: Sat Feb 06, 2021 7:38 pm
- Contact: