Magento – Shipping Attributes

product-attributeshippingshipping-methods

As you all know, Magento comes packaged with the Fedex rate quoting extension built-in. What this extension does not do is ask for dimensions. Therefore, the shippping rates returned are based solely on weight and nothing else.

For $299 I can get the super fancy WebShoppeApp, but I'm trying to avoid paying for that when all I lack is a few lines in, for example, this file…

 app/code/core/Mage/Usa/Model/Shipping/**Fedex.php**

Inside this file, I can clearly see that an XML request is being created.

Line 315
        $r = $this->_rawRequest;
        $ratesRequest = array(
            'WebAuthenticationDetail' => array(

.....
                'RateRequestTypes' => 'LIST',
                'PackageCount'     => '1',
                'PackageDetail'    => 'INDIVIDUAL_PACKAGES',
                'RequestedPackageLineItems' => array(
                    '0' => array(
                        'Weight' => array(
                            'Value' => (float)$r->getWeight(),
                            'Units' => $this->getConfigData('unit_of_measure')
                        ),
                        'GroupPackageCount' => 1,
                    )
                )

As you can see, there is no defining of dimensions here. This makes it very difficult to ship something that is 12 ft long, or longer.

My first instinct, being a relatively advanced PHP programmer, was to add the Dimension key to the above XML Request… and insert custom attributes from the product into this.

            'RequestedPackageLineItems' => array(
                '0' => array(
                    'Weight' => array(
                        'Value' => (float)$r->getWeight(),
                        'Units' => $this->getConfigData('unit_of_measure')
                    ),
                    'Dimensions' => array(
                         'Width' => ?,
                         'Height' => ?,
                         'Length' => ?
                    ),
                    'GroupPackageCount' => 1,
                )

Then, it occurred to me that I have no clue how this works with the products, especially multiple ones. In other words, I'm not exactly sure how to go about grabbing those custom attributes and knowing that a shopping cart full of differently sized products will be requested accordingly, accurately, appropriately.

To me, this look like one single package item. It has been hard-coded in.

Besides dropping $300 for an extension, is there a solution to my problem?

Best Answer

I wrote the WSA Dimensional Shipping extension, and its something that has taken me nearly 4 years on/off working on it for days on end to get it so that its useful.

As discussed you can just put in the dimensions to Fedex but this only works if you have all your products shipping in their own box or of you box everything in the 1 same box.

You do anything more than that you are in need of complex algorithms to manage it. We are still working on Dimensional Shipping and constantly improving it and adding in new features. It's not a magic bullet as bin packing is a np-hard issue. But I know thro experience we can get the rates much more accurate than anything else out there. There is always an investment of effort.

Sometimes tho writing your own on this can be worthwhile, you would need to get the FedEx API and then write an algorithm that meets your needs to do the bin packing. As our extension is sold to many people we have features in there that you may not need so writing yourself can be useful. Just bear in mind it could take a while, and you would definitely need TDD if you are doing anything but very simple calculations.

Related Topic