This article describes how to hide product options from the options selector (usually dropdown list) if they are out of stock.
You will need to modify the code of ~\App_Code\CMSModules\Ecommerce\ProductOptionSelector.cs
file. The change is quite simple:
In the mentioned file, please find method private void LoadSKUOptions()
Here, at line #495 (version 4.0), please add a clause "SKUAvailableItems > 0
" to the where condition
passed to the GetOptionCategorySKUs()
method like shown below:
// Bind data
DataSet ds = SKUInfoProvider.GetOptionCategorySKUs(this.OptionCategoryId, "SKUEnabled = 1 AND SKUAvailableItems > 0");
Later you only need to ensure that initially all product options in stock have "inventory" available items set properly – greater than zero.
It is recommended to use "Sell only if items are available
" setting to ensure that the items count won't go into negative numbers when more users select the last option item concurrently.
Number of available items
Kentico CMS 4.0
Created on 8/7/2009 3:41:33 AM