gpt4 book ai didi

来自订单对象的 Magento 跟踪号

转载 作者:行者123 更新时间:2023-12-03 18:23:58 26 4
gpt4 key购买 nike

给定一个 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();
}

最佳答案

我也在这个问题上挣扎,返回空值。不过终于想通了。首先,如前所述,检索与给定订单关联的货件集合:

$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();
}

}

数组 $tracknums 现在将包含链接到此订单/发货的每个跟踪号。

关于来自订单对象的 Magento 跟踪号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5737276/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com