Hey,

commerce_physical_order_height
commerce_physical_product_line_item_height
commerce_physical_order_length
commerce_physical_product_line_item_length
commerce_physical_order_width
commerce_physical_product_line_item_width
commerce_physical_product_line_item_dimensions

Are you perhaps accepting patches for these helper function? -- Errata .. I thought about it more it's probably too expensive to get the field data of dimensions individually.. might have to just do it with just one helper function of
commerce_physical_product_line_item_dimensions -- get an array and take it from there..

Comments

chriscalip’s picture

Issue summary: View changes

better desc.

chriscalip’s picture

Issue summary: View changes

better description

chriscalip’s picture

Issue summary: View changes

well total height , length, and width is probably dependent on shipping service.

chriscalip’s picture

As i go into the code more I kept on changing the request ..

This is possible with commerce_physical_product_line_item_weight

        // Multiply the weight value by the quantity of the line item.
        $weight['weight'] *= $line_item->quantity;

But probably not advisable with each element (width,height,length) of dimensions. Padding is probably required with each element depending on service. (Could use some feedback here). As it is.. i think the logic of just multiplying each element to the product quantity would not be advisable (i think).

chriscalip’s picture

Patch obsolete. Use #3 and #4 patch

ultimike’s picture

StatusFileSize
new4.66 KB

Chris,

Great minds think alike. Here's the rest of the patch we'll need to calculate the total volume of the order in order to calculate the number of packages.

Thanks,
-mike

chriscalip’s picture

Mike, Nice one!

Here's a patch that complements volumecalc-1295224-3.patch pretty much just additions to the commerce_physical.api.php file to describe volumecalc feature.

Please ignore dimensions-helper-functions-1295224-3.patch.

ultimike’s picture

Chris,

Sweet - now we just need to get Ryan's attention so he'll accept the patches!

Thanks,
-mike

rszrama’s picture

Status: Active » Fixed

Reviewing the code, I made a minor change in that the two base API functions to determine the dimensions of an entity / product line item are purely going to be returning dimensions. As the patch stood, you were converting a product line item's dimensions to inches and calculating a volume in an API function that's really just supposed to return a product's dimensions. Instead, the volume calculations should be limited to the commerce_physical_order_volume() function where we know what unit to convert the dimensions to before calculating volume anyways. The return value from this function remains the same, so I'm guessing it won't interfere with your usage in Commerce UPS at all, right? Let me know if I screwed something up.

I committed each patch separately to credit each of you with a different commit. Here's the final version of the API functions committed:

http://drupalcode.org/project/commerce_physical.git/commitdiff/ca64ce2

The hook documentation patch was committed as so:

http://drupalcode.org/project/commerce_physical.git/commitdiff/e2a8866

ultimike’s picture

Ryan,

In my initial test, it looks like any changes you made to the patch didn't affect Commerce UPS at all. Thanks for giving the patch a thorough review - much appreciated. I'll let you know if anything funky pops up.

Thanks,
-mike

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

initial request was too resource expensive.