Bla*_*ake 4 magento magento-1.4
给定magento订单对象,如何找到与该订单关联的跟踪编号?
$order = Mage::getModel('sales/order')->loadByIncrementId(100000064);
$shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
->setOrderFilter($order)
->load();
foreach ($shipmentCollection as $shipment){
// This will give me the shipment IncrementId, but not the actual tracking information.
$shipment->getData();
}
Run Code Online (Sandbox Code Playgroud)
小智 9
我也在努力克服这个问题,返回空值.终于想通了.首先,如前所述,检索与给定订单关联的货件集合:
$shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
->setOrderFilter($order)
->load();
foreach ($shipmentCollection as $shipment){
// This will give me the shipment IncrementId, but not the actual tracking information.
foreach($shipment->getAllTracks() as $tracknum)
{
$tracknums[]=$tracknum->getNumber();
}
}
Run Code Online (Sandbox Code Playgroud)
数组$ tracknums现在将包含链接到此订单/货件的每个跟踪号.
| 归档时间: |
|
| 查看次数: |
20262 次 |
| 最近记录: |