Shop
Shop settings
This method is not available in the standard netDecor build. It's enabled upon client request, and its parameters may vary between customized netDecor implementations.
NetDecor.Shop.SetShopInfo(shopInfo: string)
shopInfo: string - Content of JSON is client-specific and will be customized for each netDecor implementation
Example
NetDecor.Shop.SetShopInfo(JSON.stringify({ id: 12, code: '035', name: 'Wrocław' }));
This method may throw an exception when invalid parameters or parameter names are provided in the JSON.
Add to shop basket
This method is not available in the standard netDecor build. It's enabled upon client request, and its parameters may vary between customized netDecor implementations.
NetDecor.Events.RegisterEventHandler("AddToBasket", function(items: string))
items: string – JSON containing the shopping cart content in netDecor. The exact format of the JSON is client-specific and established individually for each netDecor customization.
Set prices (static API)
netDecor exposes two methods to set prices for sellable products:
NetDecor.Shop.SetPrices(PricesJsonFile: string)
and
NetDecor.Shop.SetPricesFileUrl(PricesFileUrl: string)
Both methods take a string as an argument: SetPrices accepts a stringified JSON file with prices, while SetPricesFileUrl takes a URL to such a JSON file. Both methods can throw exceptions when the data is corrupted or null.
The JSON file should contain an array of ShopItem objects. The base implementation of ShopItem is:
interface ShopItem
{
public ID: string; // Item reference ID
public Price: number; // Price
public Available: number; // Item availability. 1 - available, 0 - not available
public Description: string; // Item name. Displayed in documentation.
public UnitType: PriceUnitType;
}
where PriceUnitType should be typed as a string, which can have the following values: "Unknown", "Pieces", "Area", "Length", or "Packages".
Note: Descriptions of cupboards from the kitchen database are generated dynamically using price data. For correct generation of descriptions, either static or dynamic prices loading must be implemented.