When Tablequote compares weights it seems to be using the default weight unit for all products, causing inaccurate analysis of weight bands.
For example, in my site, the default units are grams and a single 400g product falls into the 201-500 weight band whereas a single 1.5kg product is quoted in the 0-200 band.
I plan to try and fix this for myself, if I succeed I will supply a patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | uc_tablequote.module.patch | 12.06 KB | anrikun |
| #1 | uc_tablequote.weight.fix_.module.patch | 913 bytes | autopoietic |
Comments
Comment #1
autopoietic commentedI have created a patch against (6.x-2.0) which I think resolves this problem. The code is pretty much straight from the uc_weight module, instead of checking item weights from uc_cart_get_contents() I have used the $products object passed into the quote function.
After applying this patch Table Quote should convert product weights to use the store's default weight format before adding up the order's total weight.
IMPORTANT: this does mean that if the sites default weight unit is changed the rates returned by the Table Quote module will be drastically affected.
I suggest this should be resolved by either of the following options:
I prefer 1) as it may help administrators to set tables up according to different mail companies default weight unit.
Comment #2
autopoietic commentedComment #3
anrikun commentedNice patch but there are still mistakes:
- function signature is wrong. It should be:
- default uc_weight_unit should be "lb" (not "kg") like in other uc modules
This module is very useful but has many bugs, and some of them are critical.
Here is a patch that addresses several issues at once:
- fixes uc_tablequote_quote function signature
- adds autopoietic's patch (see above)
- adds #461444: Spelling mistake in module patch
- allows ranges like 'from 50kg to 60kg' next to 'from 60kg to 70kg', without complaining about them overlapping: min value is inclusive, max value is exclusive.
- fixes indentation, converting tabs to spaces
- fixes the critical #768924: Security bug: Module does not check any limit
Comment #4
anrikun commentedThese changes have been committed to the new 6.x-2.x-dev (http://drupal.org/node/772292).
Comment #5
plachShould not the issue status be changed to fixed then?
Comment #6
anrikun commentedYou're right! :-)