- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2017
11:45 PM
08-23-2017
11:45 PM
Add Tracking Number with Soap
Hi
I want to add the tracking number for my orders with soap.
Where can I find information how to do this?
Thank you in advance
Regards
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017
02:30 AM
08-24-2017
02:30 AM
Re: Add Tracking Number with Soap
User below code sample to get the tacking information by order_id
Table name : sales_shipment_track
use Magento\Sales\Model\Order\Shipment; use Magento\Sales\Model\ResourceModel\Order\Shipment\Track\CollectionFactory as TrackCollectionFactory; class FindTackingInfo { /** @var \Magento\Sales\Model\ResourceModel\Order\Shipment\Track\Collection */ protected $trackingCollection; public function __construct(TrackCollectionFactory $collectionFactory) { $this->trackingCollection = $collectionFactory->create(); } public function getShipmentDetailsFromOrderId($orderId) { try { $this->trackingCollection ->addFieldToFilter('order_id', $orderId); //123 is the order id /** @var Shipment\Track $tracking */ $tracking = $this->trackingCollection->getFirstItem(); /** @var Shipment $shipment */ $shipment = $tracking->getShipment(); return $shipment->getData(); } catch (\Magento\Framework\Exception\LocalizedException $e) {} return null; } }
if issue solved, Click Kudos/Accept as solutions.
Suman Kar(suman.jis@gmail.com) Magento Certified Developer Plus Skype: sumanphptech Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.