Needs review
Project:
Commerce Physical Product
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Oct 2012 at 15:08 UTC
Updated:
9 Mar 2015 at 19:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
johnv@joachim, IMO this weight (+ measures) is for the box /tin/can/bag the product is in, to be used for storage and shipping calculations. The weight you are referring to seems more like a 'normal' product attribute.
Comment #2
joachim commentedPrecisely.
But this module is making the assumption that there is only one field of type 'physical_weight' on the product when calculating how much a product weighs for shipping purposes.
Whereas the product can have more than one weight field: one for its shipping weight, and others which describe other things for the benefit of the consumer.
Comment #3
mrpeanut commented@joachim In your example, the other weight fields (e.g., maximum weight, suitable body weight, etc.) won't affect shipping. Because of that, you could simply use integer fields. Weight fields are pretty much strictly for shipping (in this context).
Comment #4
joachim commented> Because of that, you could simply use integer fields
Of course I could. But I don't want to! I would like the benefit of the weight field type for these: selection of units, conversion, etc etc.
> Weight fields are pretty much strictly for shipping (in this context).
Yes, and that is my point: they should not be!
Comment #5
mrpeanut commentedAhh, gotcha. I hadn't considered that. Why can't you simply add another weight field to your product type?
Comment #6
joachim commentedBecause this module assumes there is only one, and uses that as the order weight. Which is what this bug report is about.
Comment #7
dwkitchen commentedIf the UI was implemented in this module #1499538: Commerce Physical UI the the calculation can use the default defined field rather than just the first physical field it comes across.
Comment #8
cvangysel commentedMarking this as fixed as the issue has been resolved.
Comment #9
joachim commentedI don't understand how this has been fixed -- the other issue pointed to is not fixed either, and it doesn't yet implement what is needed here.
Comment #10
dwkitchen commentedIndeed, once the UI has been implimented the code that does these calculations will need to changed to target on those fields only.
Comment #11
cvangysel commentedWoops, sorry. When I first scanned over this issue I had the impression that it wasn't really needed anymore. I probably read over the comments too quickly.
Comment #12
cvangysel commentedAfter reviewing everything I don't necessarily agree with the approach taken in #1499538: Commerce Physical UI, for me it seems that the Field UI does a good enough job and the code contained in that sandbox only makes things more complicated.
Attached you can find a patch that implements the functionality requested in this issue. It's based upon a previous patch I wrote for this module: #1390190: hide shipping pane for non-shipping product. You first need to apply the patch in that issue before applying this one. The reason for this is that the previous patch already adds an admin UI to Commerce Physical.
Comment #13
zkrebs commentedIf I am selling a product that has two weights
1 oz product
2 oz packaging
How can I get it to accommodate both weights in shipping calculations?
Comment #14
johnvIMO this is solved via an alter hook since 2011.
See http://cgit.drupalcode.org/commerce_physical/commit/?id=ca64ce2
And the api.php file.
See also https://www.drupal.org/node/2403067
Comment #15
zkrebs commentedjohnv can you explain in simple lay person terms what that patch does on the second link?
Comment #16
johnvThe second link is just to inform you that you may encounter the problem of that issue in case you want to specify your field. I did not use or test any of both links.
But if the first link works, this issue is solved/a duplicate.
Comment #17
jharbert commentedSpeaking of multiple weights. Is there any way to make the Physical Weight Textfield be a List(Text) with Select Widget.
So for the Allowed Selections I would have
10|500 @ .25 each
100|5000 @ .20 each
So from the user's perspective they would be selecting product quantity but in the backend they would be choosing shipping weight. Ex. 10 lbs or 100lbs