I need to integrate this module with the Physical Fields (http://drupal.org/project/physical) module. I noticed that when installing the Commerce Australia Post module that it uses Physical Fields to enter the dimensions and weight data. I am capturing this info myself, which would require the user to enter this info twice. This is not ideal.

CommentFileSizeAuthor
#2 commerce_tnt-physical-1961950-2.patch16.14 KBmarji

Comments

marji’s picture

I can see your module provides "Number of Packages", while the Lenght, Width and Weight say they are total sizes (of all packages of that product).
The Physical Fields IMHO does not have the concept of "Number of Packages".
I suspect - based on your code - that TNT cares about how many packages you want to ship, but wants total sizes.
Am I right here? If so, did you have an idea of how to overcome this "Number of Packages" with the Physical Fields module?

Thanks,
Marji

marji’s picture

StatusFileSize
new16.14 KB

I'm attaching a patch which uses the Physical Fields for the dimensions and weight.
I'm making the assumption there is only one package for each product, the same way the Commerce Australia Post module does it.

I have not provided an update_hook as this is a potentially tricky thing as it would require each product bundle that has at least one product with TNT shipping activated to have the physical fields attached.
If the fields were already there, I'd have to decide whether to update the physical fileds values with the values from the commerce_tnt table on not (for example, a user can have both Commerce TNT and the Commerce Australia Post module enabled and have the dimension / weight info stored twice - are they exacly the same?).
That means, I'm not dropping the commerce_tnt table, thought it is not used anymore.

I'm happy to put together the update_hook if desired. In yes, please elaborate on the best approach of doing so. Thanks!

jbloomfield’s picture

Hi Martin,

Apologies for the late reply. I will apply the patch this week (at work) and let you know how I go but casting my memory back when I wrote this module, the Number of Packages was pretty important within the TNT API. Although, in saying that, I can't see why it can't be just one packages with a total size and weight.

Will report back on how I go and look forward to implementing the changes into the module.

Thanks again for the patch.

John.

murrayw’s picture

Issue summary: View changes

Hi John, Martin and I work for the same company. We were using Martin's patch for a while but have now moved back to your way of storing shipping data since the release of alpha4. If you wish to close this ticket you can do so without fear of us being offended. There is probably no one using this code in the wild now, although we did use it fine for a year or so.

jbloomfield’s picture

Hi Murray,

Thanks for the comment but I will leave the issue open as a reminder to myself to implement Physical Fields at some point. There are elements of the module that could do with a rewrite when I find some spare time.

Thanks
John.

radimklaska’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev

Hi John,
first of all, I work with Martin and Murray. :-) We went back to using this patch again. I reported few more issues while using clean alpha3 and alpha4. Most of them are solved by using this patch.

murrayw’s picture

Hi John, after taking a look at the new alpha4 we ended up going back to the Physical Fields approach contained in the above patch.

There remains a pretty bad bug in commerce_tnt.xml.inc (line 31) where orders with multiple products will have all but the last product ignored. The info needed to be added to an array, not a plain variable, ie add the data to an array item using, $shipping_info[]... We should have raised a bug with this one, however, I believe that it was fixed with the above patch.

Using the Physical code with save around 330 lines of code and make it much simpler.

So we have gone back to our old way with this patch. In the light of this, we would still be interested in a refactored version somewhere down the line.

  • jbloomfield committed 404e392 on 7.x-1.x
    Issue #1961950 by marji, murrayw, radimklaska: Implemented Physical...
jbloomfield’s picture

Status: Active » Needs review

Should be fixed by applying the patch in https://www.drupal.org/node/1961950#comment-7991447