Delivery providers
This section introduces delivery providers, which are used to manage the delivery processes.
Merchants who sell products need to manage the delivery process, the physical transfer of goods from their warehouses to the end customers.
After a confirmed order has been created (e.g. in the checkout flow), the merchant has to ship the goods to the delivery address. The whole set of tasks and procedures, from picking goods at the warehouse to the delivery at the delivery address, is usually called the "delivery process".
Since the delivery process is not part of the e-commerce, Litium does not support the management of the delivery process by default. However, two vital extensions are provided.
- Management of delivery states:
The merchant can keep track of the state of a delivery for a specific order. For example, to know whether a particular delivery is Init (not started yet), Delivered, Failed or Returned.
This is done by a delivery state machine. A simple delivery state machine is provided by default, which the implementation projects can customise and extend. In simple scenarios there might not be any need for modifications of the default implementation provided!
Default delivery states
- Integration of delivery providers:
A third party delivery provider is easily integrated in Litium. With integrations, the merchant can initiate the delivery process for a certain delivery from Litium back office, or even automate it. Also, once the delivery process is complete, that is when the goods are delivered, Litium can be automated to collect the payment for a reserved transaction automatically.
Creating a delivery provider
The component that communicates with the delivery management system is called a "delivery provider". The delivery provider is connected to a delivery method and implements how a delivery will be processed. The business logic for contacting third party delivery providers to initiate a delivery process has to be coded into an .ascx file. The .ascx file will not contain any user interface elements, only the logic needed to initiate the delivery process. To create a delivery provider:
- Create a web user control that implements the interface Litium.Studio.UI.ECommerce.IDeliveryProviderControl.
- Place the webcontrol in the directory wwwroot\Site\ECommerce\DeliveryProviders.
- Configure Litium to use the provider by adding it in back office Settings > Sales > Delivery providers > New delivery provider.
- Enter a name for the custom provider in the Delivery provider name field, and the name of the user control you created in the field Path for delivery provider settings panel.
You are totally free in the design and the functionality of the web user control.
Adding delivery methods
Once you have added the delivery provider, go to back office Settings > Sales > Delivery methods and edit the delivery methods. Select the delivery provider you created for each delivery method in the Delivery provider drop-down.
To initiate the delivery process, go to the deliveries view in the Sales area, select one or several orders and click Send to distributor.
This will load the web user control, display it in SendToDeliveryProvider.aspx (if the property IsInteractiveMode returns true in your implementation) and use the interface methods to process the delivery.
Calculating the delivery cost
For a simple fixed delivery cost, simply specify the delivery method cost in back office Settings > Sales > Delivery methods. For advanced calculations, the implementation project needs to customise the pricing rules plugins, specifically the DeliveryCostCalculator. Usually, the third party delivery management system or the ERP system needs to be called from the DeliveryCostCalculator to find out how much a delivery will cost for the end-customer.
In simple scenarios, where the calculation doesn't require third-party systems, the implementation project can use their own logic here.