module-shipper icon indicating copy to clipboard operation
module-shipper copied to clipboard

Method to pull Delivery Dates

Open pbaum83 opened this issue 5 years ago • 3 comments

What is the best way to pull the delivery/dispatch date from an order with the shipperhq module installed? Are there are any magic methods on the order interface or is helper that ships with the module to help with this? We have been using a SQL call to pull the values from the shipperhq_order_detail table which isn't ideal.

pbaum83 avatar Oct 05 '21 23:10 pbaum83

Hi @pbaum83 ,

Here's a link to a document in our KB which mentions the following function you can use to do this: https://docs.shipperhq.com/integrate-shipperhq-order-management-fulfillment-service-magento/#Magento_2

The function getOrderCarrierGroupInfo($orderId) will output the pieces of data from that array included in the attached screenshot. This function can be found in “ShipperHQ\Shipper\Helper\CarrierGroup”.

For example for the delivery date you should be able to use the following piece of code: $carrierGroupInfo = $this->carrierGroupHelper->getOrderCarrierGroupInfo($order->getId()); $deliveryDate = $carrierGroupInfo['deivery_date'];

wsadasmit avatar Oct 12 '21 16:10 wsadasmit

Thank you for the update! Much Appreciated.

pbaum83 avatar Oct 19 '21 15:10 pbaum83

Just in case anyone else uses this helper the return was an array when I implemented this code:

`$carrierGroupInfo = $this->carrierGroupHelper->getOrderCarrierGroupInfo($order->getId());

if (isset($carrierGroupInfo[0]['delivery_date']) === true) { $deliveryDate = $carrierGroupInfo[0]['delivery_date']; }`

pbaum83 avatar Oct 21 '21 02:10 pbaum83