订单对象中的 Magento 追踪号码
给定一个 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();
}
Given a magento order object how can I find the tracking number associated with that order?
$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();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我也为这个问题苦苦挣扎,返回空值。终于想通了。首先,如前所述,检索与给定订单关联的发货集合:
数组 $tracknums 现在将包含链接到该订单/发货的每个跟踪号码。
I struggled over this one too, returning null values. Finally figured it out though. First, as previously noted, retrieve the shipment collection associated with the given order:
The array $tracknums will now contain each of the tracking numbers linked to this order/shipment.
尝试下面的代码:但它尚未经过测试。
Try the code below: Its not tested though.
你可以简单地这样做:
You can simply do this:
使用
use
应该是
It should be