Why order is important in items.xml?

We need to follow an order in items.xml, when we declare item types in items.xml. Below are the reasons for it.

  • Each items.xml is parsed in single pass. This means, more specific types are dependent on general types. In such case they should have been defined before we use them. For example,

items

Here we see that, item type product is using other item types, like catalog. To make this file successfully, it is mandatory that catalog exist before product is declared. We must defines types in order of inheritance.

Please note that impex files are parsed in multiple pass, so order is not important there.

  • Each xml file is validated against a items.xsd during build. If the xml file does not conforms to xsd file, build will fail.

How to split an order into multiple consignment

While fulfilling an order, some time it is necessary for business to split the order into multiple orders.

For instance, a customer orders two items A and B, now A has delivery window of 2 days, while B can be delivered in minimum 5 days. Now business has the option to either ship both items in 5 days. But what if item A is fresh, and will get destroyed in 5 days. There may be a case, where customer wants a mandatory delivery of item A within 2 days. In such situations, if business house doesn’t want to loose customer, it has no choice but to split order and ship it multiple times. This is the case of split consignment.

Now there may be various conditions, which may call for splitting the order into multiple consignments. Above example is just one of them. For example, we may want to split consignment, based on warehouse from where item will be picked up. We may want to split consignment, based on product type (fresh or ambient) etc. These situations which decides the business logic to be a case for splitting the consignments, are known as splitting strategies. We can have as many as strategy to split, as we want.

By default, hybris creates only one consignment for an order. This is done by following service.

split

As you can see, that theĀ orderSplittingService accepts a list of strategies, we can create many strategies, and split our order. The actual business logic for splitting will go into strategy class.