Price lists and calculations

This article explains the Litium pricing model. It introduces concepts behind pricing in Litium. It also include the order in which price calculations are done, and when they should be done.

Introduction

Pricing is a central concept in any E-Commerce site. Pricing in Litium can be devided to two main branches for explanation & education purposes.

  1. Pricing of products sold
  2. Order Grand Total Calculation

Pricing of Products Sold

When products are displayed for end customers to buy, the price of the product is shown. This price is for a single unit of item, such as "one mobile phone", or "one litre of oil", and is called "Unit List Price". This price is contained in a "Price List" in the Product Catalog module. 

The price shown to the user may also be a special price, which is different from the ordinary price, called a "Unit Campaign Price". There are other campaigns as well, which do not affect the unit price but the overall order grand total such as "free shipping".

Default implementation for calculating the prices is using the price lists inside Litium will return the lowest price for the price lists with highest priority that is accessible for the website and user.

If two price lists exists

  • a) Priority 10; price 100
  • b) Priority 1; price 1000

the price (1000) from second price list (b) will be used because of the higher priority.

Order Grand Total Calculation

When user click the "buy" button, those products are added to his shopping cart, and a overall price of his order is calculated. The final order price calculated may include discounts comming from campaigns, as well as additional costs such as VAT and shipping costs. All the calculations are implemented in the Pricing Rules Plugin.

Examples

Get list price:

using System;
using System.Linq;
using Litium.Products.PriceCalculator;

namespace Litium.Samples.Products
{
    public class Price
    {
        public decimal GetListPrice(IPriceCalculator priceCalculator, Guid variantSystemId, Guid currencySystemId, Guid userId, Guid webSiteId)
        {
            var priceCalculatorArgs = new PriceCalculatorArgs
            {
                CurrencySystemId = currencySystemId,
                // If used in request get timestamp of Litium.Foundation.Modules.CMS.Routing.RoutePath
                DateTimeUtc = DateTime.UtcNow,
                UserSystemId = userId,
                WebSiteSystemId = webSiteId
            };

            var calculatorItemArgs = new PriceCalculatorItemArgs
            {
                VariantSystemId = variantSystemId,
                Quantity = 1
            };

            var listPrice = priceCalculator.GetListPrices(priceCalculatorArgs, calculatorItemArgs);
            return listPrice.FirstOrDefault(p => p.Key == variantSystemId).Value.ListPrice;
        }
    }
}

 

 

 

 

Is this page helpful?
Thank you for your feedback!