I have written a module to get a custom rate from one of my servers. This works as expected and I am saving a shipmentId from that request on the quote and it also saves on the order. Now, as I watch the process log and check the quote and order tables I noticed that Magento rates the shipments as the order is created and applies my shipmentId I saved on the quote to each order in the order table. My rate process returns a shipmentId each time it is called. So, when the quote is created a shipmentId is saved. When the orders are created each rate returns a shipmentId. What I need to do is figure out how to update the order with the shipmentId from the rate received during the order creation. Currently if it is Multiple Shipping Addresses I end up with the same shipmentId on all orders created. This is a problem because each order may contain different items. I use the shipmentId returned to create a shipment in our freight management system. So, I need to the correct shipmentId returned from rating for each order to be applied to the correct order.
I have googled to no avail on this. Maybe I am not asking google the correct question? Maybe this is not possible without writing my own order creation module?
Anyone have any insight into a solution?
Thanks in advance!
I think you might be going about this a bit wrong. You shouldn't save shipment rate information on the quote for the exact reason you mention. When using multiple shipping addreses you can't split it.
I assume what you created was actually a custom shipment module. With this you add available rates to the quote. These can be picked by the customer. You should use these to store the information you need to parse along to the order. This way you can access what shipment ID is used by getting what shipment method was selected for that given order.
I hope this helps :-)
Yes I created a shipment module. Maybe I wasn't completely clear. I noticed during the process of getting a quote and actually creating the order that Magento will rate each order and save it to the orders table. I need to capture data during the rating of each order and save the shipmentId I return at that point. I have not found an event that I can catch that point in the process. The shipmentId I return needs to correspond to the order being rated.