Split OrderItems into new individual Orders?

Adam Steffes asked on October 29, 2014 23:23

I have a requirement to manage the status of an order by line item, or in Kentico terminology, by OrderItem.

In other words each OrderItem requires its own unique status for shipping and processing.

My approach will be to manually break each Order into multiple orders based on the number of line items. In this way each Order will have one item and one status.

I'm curious as to whether there anything in Kentico already available, or perhaps as a third-party plugin, that could help support such a configuration? Perhaps some sort of "Composite Order" concept?

Thanks in advance for any suggestions.

Correct Answer

Brenden Kehren answered on October 31, 2014 12:18

I like the "Custom Data" idea although I think its less clear for anyone maintaining it and could add a lot of extra, custom code. As you mentioned my last idea allows for a lot of OOTB functionality AFTER the items are split into orders. The nice part about that is you can still interact with another API simply by using all the regular Kentico API vs. some custom code to get and process the "Custom Data" field.

Good luck!

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on October 30, 2014 12:49

Out of the box, there isn't anything. I'm working through this right now and I've used a custom table to do this mainly because we are integrating with a 3rd party system that will be updating the Kentico db and it requires a new work order for every order item and each work order (order item) has their own status. So just typing that out I wonder if things are over complicated now...

I'd think you could make a slight modification to the Order Item class in the e-commerce module and add that status and status date properties. Then in a global handler add a couple events to capture when an order is placed set the order line values initially. And when an order line is updated to set the status values.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 30, 2014 12:53

OR you could create a global handler for when the order is placed to take each line item, create a new parent order with that one line item, remove that line item from the initial order and move to the next record.

0 votesVote for this answer Mark as a Correct answer

Adam Steffes answered on October 30, 2014 19:10

Thanks Brenden. We're thinking alike.

Another approach we're discussing is utilizing the 'Custom Data' column inside an order to store custom statuses associated with order items, possibly persisted as JSON.

However, this approach will of course eliminate a bunch of the Kentico Out-of-the-box (OOTB) order editing functionality. We'd have to go custom from there, but it might be sufficient for interacting with partners via API.

Thanks again for your thoughts. Right now I'm leaning towards your last idea regarding global handler to split items into multiple orders. That will hopefully help retain the most OOTB functionality. Then we'll have to deal with explaining to the user why their one order turned into 12, managing processing individually, and just generally giving a clear overall message.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.