The unit price for an article that is being published on the seller's site.
The end customer sees the unit prices of products that they can buy. There are two main categories of prices an end customer may see.
- Ordinary Price (Unit List Price): The ordinary price is the normal price of a product. This is usually what a vendor may print in his sales material, price lists, or what some businesses call 'price catalog'. In Litium studio, list prices are kept in Price Lists (see below).
- Special Price (Unit Campaign Price): A special price is usually a reduced price. that a vendor wants to highlight to the end customer, and show that it is more beneficial to buy this product at this time. Here, the seller will want to show both normal price, as well as the special price, to highlight the difference. Normally, the special price is shown in a highlighted color.
The price of an article presented to the user will depend on the following factors:
- The Article itself.
- The Price List in which the Article is in.
Any given Article can be in several price lists. The correct price list for picking the list price is determined by:
- Currency of the order should be the same as the currency to which the price list is defined.
- Current Date should be within valid time interval for the price list in concern.
- User group of the customer should be within the user groups to which the price list is defined.
- Assortment in which article is present should be within the assortments to which the price list is defined.
If there is more than one price list that fulfills the above four tests, the minimum price among them will be selected.
- Whether any special campaign prices (Unit Campaign Price) can be determined for the article
Price Lists: The list of Unit List Prices
In a webshop, each article displayed will have a price, which is shown to the user. The vendor maintains a list of prices for the articles that are being sold, which is called a price list. Therefore, a price list contains a "List Price" for each article being sold. The price list also contains the VAT percentage applicable for each article.
A price list is constrained by (or in other words, is defined for)
- A particular currency.
- A valid time period.
- A particular user group(s) (or all users).
- For a particular product catalog(s) (or all product catalogs).
A given article can be in several pricelists. If you plan to sell in more than one currency, you will need a separate price list for each currency, and all your articles will have to be priced in both currencies.
How to obtain list price for an article:
Following methods obtain the list price of an article and a product published on a website. Note how the IPriceCalculator implementation is used to get the price.
using System;
using System.Collections.Generic;
using System.Globalization;
using Litium.Globalization;
using Litium.Products;
using Litium.Products.PriceCalculator;
using Litium.Security;
namespace Litium.Studio.KC.Samples.ProductCatalog
{
/// <summary>
/// Pricing
/// </summary>
public class Pricing
{
private readonly IPriceCalculator _priceCalculator;
private readonly SecurityContextService _securityContextService;
public Pricing(IPriceCalculator priceCalculator, SecurityContextService securityContextService)
{
_priceCalculator = priceCalculator;
_securityContextService = securityContextService;
}
/// <summary>
/// Gets the list prices for <paramref name="variant"/>
/// </summary>
/// <param name="variant">The variant.</param>
/// <param name="quantity">The quantity</param>
/// <param name="currency">The currency</param>
/// <param name="channel">The channel.</param>
/// <param name="country">The country.</param>
/// <returns>List<string></returns>
public List<string> GetListPrices(Variant variant, decimal quantity, Currency currency, Channel channel, Country country)
{
List<string> listPrices = new List<string>();
var priceCalculatorArgs = new PriceCalculatorArgs
{
CurrencySystemId = currency.SystemId,
DateTimeUtc = DateTimeOffset.UtcNow,
UserSystemId = _securityContextService.GetIdentityUserSystemId().GetValueOrDefault(),
ChannelSystemId = channel.SystemId,
CountrySystemId = country.SystemId
};
var priceCalculatorItemArgs = new PriceCalculatorItemArgs
{
VariantSystemId = variant.SystemId,
Quantity = quantity
};
if (_priceCalculator.GetListPrices(priceCalculatorArgs, priceCalculatorItemArgs).TryGetValue(priceCalculatorItemArgs.VariantSystemId, out PriceCalculatorResult priceListResult)
&& priceListResult is not null)
{
listPrices.Add(currency.Format(priceListResult.PriceExcludingVat, false, CultureInfo.CurrentUICulture));
}
return listPrices;
}
/// <summary>
/// Gets the price lists.
/// </summary>
/// <param name="currency">The currency.</param>
/// <param name="channel">The channel.</param>
/// <param name="country">The country</param>
/// <returns>IDictionary<Guid, PriceCalculatorResult></returns>
public IDictionary<Guid, PriceCalculatorResult> GetListPrice(Currency currency, Channel channel, Country country)
{
// get price from price calculator.
var priceCalculatorArgs = new PriceCalculatorArgs
{
CurrencySystemId = currency.SystemId,
DateTimeUtc = DateTimeOffset.UtcNow,
UserSystemId = _securityContextService.GetIdentityUserSystemId().GetValueOrDefault(),
ChannelSystemId = channel.SystemId,
CountrySystemId = country.SystemId
};
return _priceCalculator.GetListPrices(priceCalculatorArgs);
}
}
}
Obtaining Campaign prices
The campaign price for an article is determined by the price engine also. IPriceCalculator.GetListPrices() method returns the campaign prices for a set of articles. The usage is similar to the example presented above.
Showing Prices to end customers
On your public site, you can use ArticlePrice webcontrol to display the prices to end users. It shows the list price of the product.
<PC:ArticlePrice runat="server" DisplayCurrencySymbol="true"></PC:ArticlePrice>