当前位置: 动力学知识库 > 问答 > 编程问答 >

How do I get the package length, width, and height in Magento for a shipping estimate?

问题描述:

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();
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: