This section explains the unit price for an article that is being published in the sellers site. The end customer see the unit prices of products that they can buy.
There are two main catagories of prices a end customer may see.
- Ordnary Price (Unit List Price): The ordinary price is the normal price of a product. This is usually what a verndor may print in his sales material, price lists or as 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 vendor want to highlight to the end customer, and show that it is more benefitial to buy this product at this time, because it has a reduced special price. Therefore, seller want to show both normal price, as well as the special price, to make the end customer tempted to buy the product. Usually this special price is shown in a highlighted color.
Price of an article presented to the user will depend on following factors:
- Article itself.
- Price List in which the article is in.
A given article can be in several price lists. The correct price list to pick the list price is determined by:
- Currency of the order should be same as the currency to whith 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 are more than one price list that full fill above four tests, the minimum price among them will 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 web shop, 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 pricelist contains a "List Price" for each article being sold. The price list additionaly 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.
- For 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 seperate 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 a an article, and a product published in a website. Note how the IPriceCalculator implementation is used to get the price.
using Litium.Foundation;
using Litium.Foundation.Currencies;
using Litium.Foundation.Languages;
using Litium.Foundation.Modules.ProductCatalog.Articles;
using Litium.Foundation.Modules.ProductCatalog.Plugins.PriceCalculator;
using Litium.Foundation.Modules.ProductCatalog.Products;
using Litium.Foundation.Security;
using System;
using System.Collections.Generic;
namespace Litium.Studio.KC.Samples.ProductCatalog
{
/// <summary>
/// Pricing
/// </summary>
public class Pricing
{
/// <summary>
/// Gets a formatted list of list prices for the <paramref name="articleNumber"/>
/// </summary>
/// <param name="articleNumber">The article number.</param>
/// <param name="token">The token.</param>
/// <returns></returns>
public static List<string> GetListPrices(string articleNumber, SecurityToken token)
{
List<string> listPrices = new List<string>();
Article article = null;
if (!Article.TryGet(articleNumber, out article, token))
{
return null;
}
//find prices for each currency and add to list.
foreach (var currency in Solution.Instance.Currencies)
{
var listPriceResult = GetListPrice(currency, null, article, null, Guid.Empty, token);
if(listPriceResult != null)
listPrices.Add(currency.Format(listPriceResult.ListPriceWithVAT, Solution.Instance.Languages.DefaultLanguage.Culture));
}
return listPrices;
}
/// <summary>
/// Gets the price for given product.
/// </summary>
/// <param name="currency">The currency.</param>
/// <param name="product">The product.</param>
/// <param name="article">The article.</param>
/// <param name="language">The language.</param>
/// <param name="websiteId">The website id.</param>
/// <param name="token">The token.</param>
/// <returns></returns>
public static ListPriceResult GetListPrice(Currency currency,
Product product, Article article, Language language, Guid websiteId, SecurityToken token)
{
//validate.
if (currency == null || article == null)
return null;
ListPriceResult listPrice = null;
// get price from price calculator.
var priceCalculatorArgs = new PriceCalculatorArgs
{
ArticleID = article.ID,
AssortmentID = (product != null) ? product.AssortmentID : Guid.Empty,
CurrencyID = currency.ID,
Date = DateTime.Now,
LanguageID = (language != null) ? language.ID : Solution.Instance.Languages.DefaultLanguageID,
ProductID = (product != null) ? product.ID : Guid.Empty,
Quantity = 1,
SecurityToken = token,
SourceIdentifier = string.Empty, //this parameter should be sent in if price calculator is overriden and uses this value.
UserID = token.UserID,
WebSiteID = websiteId
};
var priceCalculator = IoC.Resolve<IPriceCalculator>();
priceCalculator.GetListPrices(priceCalculatorArgs).TryGetValue(priceCalculatorArgs.ArticleID, out listPrice);
return listPrice;
}
}
}
Obtaining Campaign prices
The campaign price for an article is determined by the campaign engine. IPriceCalculator.GetCampaignPrices() method returns the campaign prices for a set of articles. The usage is similar to the example presented above.
Showing Prices to end customers
In 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>