Dear senior Magento developers,
I’m new to Magento 2 and wanted to develop a custom shipping module for my company,
I’m working for a courier/shipping company where they want to develop custom extensions and modules for few available E commerce platforms.
One of such is Magento 2.
I have studied how to create custom modules for Magento 2. And I also have followed few tutorials on how to develop custom shipping modules. So far I have managed to create one for the company.
But the thing I got stuck on is how to create shipments from my module to our company system through SOAP. My company maintain a WSDL to create shipments.
I have implemented required methods (getAllowedMethods() and collectRates()) as those tutorials which I followed before. It works fine.
I managed to create an observer for the event of ‘sales_order_shipment_save_after’ and when that event occurs I call my model class method to execute to send SOAP request. It works fine with dummy data.
But the issue is I do not know how to get and send shipping related information when that event Is occurred for that particular order.
This is where I need your guidelines to solve it.
Kindly guide me on how to do this.
Thanks in advance
Roshan Ruzaik
Solved! Go to Solution.
Ok,
After some more experiments and research I have figured out how to implement this.
I first created an observer for ‘sales_order_shipment_save_after’ event.
And in my observer class I invoke my custom function by passing observer object as a parameter.
In my function I using the observer object I get and assign required shipment information which then forms and sends SOAP requests with order information.
I used Magento’s Zend SOAP client for this.
I hope this steps would help someone who are also facing the same issue.
Ok,
After some more experiments and research I have figured out how to implement this.
I first created an observer for ‘sales_order_shipment_save_after’ event.
And in my observer class I invoke my custom function by passing observer object as a parameter.
In my function I using the observer object I get and assign required shipment information which then forms and sends SOAP requests with order information.
I used Magento’s Zend SOAP client for this.
I hope this steps would help someone who are also facing the same issue.