2011-04-20 5 views
3

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

http://stackoverflow.com/questions/3155671/magento-cronjob-outside-magento-to-update-shipment-status합니다. – B00MER

+0

이것에 대한 인터넷 검색을 도와 준 답변 : http://stackoverflow.com/questions/9433627/ –

답변

4

아래 코드를 시도해보십시오. 내가 null 값을 반환도이 일을 통해 고투

$order->getTrackingNumbers() 
0

이 사용

Mage::getResourceModel('sales/order_shipment_collection') 
    ->setOrderFilter($order) 
    ->load(); 
+1

좋은 지적입니다. 일치시킬 질문을 수정했습니다. – clockworkgeek

2

해야한다. 마침내 그것을 알아 냈다.

$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 지금이 주문/배송에 링크 된 추적 번호를 각각 포함됩니다 : 첫째, 앞서 언급 한 바와 같이, 주어진 순서와 관련된 선적 수집을 검색 할 수 있습니다.

9

$shipment->getAllTracks(); 
2

당신은 단순히이 작업을 수행 할 수 있습니다 몇 가지 관련 코드 여기

$order = Mage::getModel('sales/order')->loadByIncrementId(100000064); 
$trackNumber = array(); 
foreach ($order->getTracksCollection() as $track){ 
    $trackNumber[] = $track->getNumber(); 
}