Skip to main content

Shop

Shop settings

caution

This method is not available is standard netDecor build. It's enabled on client's demand and its paramaters may vary between customized netDecor builds.

NetDecor.Shop.SetShopInfo(shopInfo: string)
shopInfo: string - Content of JSON is client-dependant and will be customized for each NetDecor customization

Example

    NetDecor.Shop.SetShopInfo(JSON.stringify({ id: 12, code: '035', name: 'Wrocław' }));

Method can thorw an exception when not valid params/ params names in JSON.

Add to shop basket

This method is not available is standard netDecor build. It's enabled on client's demand and its paramaters may vary between customized netDecor builds.

NetDecor.Events.RegisterEventHandler(„AddToBasket”, function(items: string))
items : string – JSON with content of shopping cart in netDecor, Exact format of JSON is client-dependant and established individually per each netDecor customization.

Set prices (static API)

In order to set prices for sellable products netDecor exposes two methods:

NetDecor.Shop.SetPrices(PricesJsonFile: string)

and

NetDecor.Shop.SetPricesFileUrl(PricesFileUrl: string)

Both methods take string as argument -> SetPrices takes stringified Json file with prices while SetPricesFileUrl takes Url to such json file. Both methods can throw exceptions when data is corrupted or null.

Json file should be array of ShopItem objects, base implementation of ShopItem is:

  interface ShopItem
{
public ID : string; // Item reference ID
public Price : number; // Price
public Available : number; // Item availabilty. 1 - available, 0 - not available
public Description : string; // Item name. Displayed in documentation.
public UnitType : PriceUnitType;
}

where PriceUnitType should be typed as string, which can be of values: „Unknown”,”Pieces”, „Area”, „Length” or „Packages”.

Note: Descriptions of cupboards from kitchen database are generated dynamically using price data. For correct generation of descriptions either static or dynamic prices loading must be implemented.