Page 1 of 1

Manually attach ShipGateway to a tracking number.

Posted: Fri Apr 22, 2016 3:57 am
by dandersonMLT
Our client wants a single screen where they can import tracking numbers for all shipping companies.
We already have the logic to parse the file and load the list of tracking numbers on the orders.

However, the tracking numbers do not show clickable in the admin section or emails because the ShipGateway is never set, so it cannot get the tracking number link from the ShipGateway.

How can I manually assign a ShipGateway to a tracking number?
I'd like to auto determine the shipping company by tracking number, but if not I can just make the user choose the shipping company from a drop down when loading their custom tracking number file.


Thanks in advance

Re: Manually attach ShipGateway to a tracking number.

Posted: Fri Apr 22, 2016 5:17 am
by mazhar
When saving tracking number if you are associating them with their shipments then you can easily get shipping gateway from shipment's ship method.

Code: Select all

var shipGateway = shipment.ShipMethod.ShipGateway
trackingNumber.ShipGateway  = shipGateway;

Re: Manually attach ShipGateway to a tracking number.

Posted: Fri Apr 22, 2016 11:02 am
by dandersonMLT
Thank you.

But what if the ShipMethod.ShipGateway is null?
Is there a way to instantiate a specific ShipGateway?