问题描述:

I am looking for a snippet that will give me the length, width, and height of the packaging to ship the items currently in the cart.

I am creating a shipping rates module and this is the last piece of the puzzle.

Any information is greatly appreciated!

Jeff

网友答案:

Take a look @ Create Shipping Method Module

In collectRates(Mage_Shipping_Model_Rate_Request $request) you can get all items using

 $request->getAllItems()

See /app/code/core/Mage/Shipping/Model/Rate/Request.php

So you could Loop through each item to get their dimension

foreach($request->getAllItems() as $item){
    //do you logic per item
     $item->getLength();
     $item->getWidth();
     $item->getHeight();
}
相关阅读:
Top