Skip to main content

addShopItemStatuses

addShopItemStatuses(statuses: ShopItemStatusParameters[])

Parameters

NameTypeDescription
statusesShopItemStatusParametersParameters of the added shop items

Description

This function adds or updates shop item status definitions. It also checks the correctness of data passed as an argument, such as the correct color format and the presence of translations for all supported languages. If the status already exists, its priority, color, and label are changed to the specified values. If the status does not exist, it is added to the system.

caution

Add status definitions before adding the price list.

The priority of the status determines the status of an object that consists of several shop items with different statuses, the higher the number, the more important the status.

By default, the program has 3 statuses:

  • NONE (priority: -10)
  • AVAILABLE (priority: 0)
  • UNAVAILABLE (priority: 100)

You can add new statuses and if you need to, you can overwrite existing ones.

Example

Example 1 - adding a new status:

NetDecor.v3.shop.addShopItemStatuses(
[
{
status: "MIN",
priority: 90,
label:
{
pl: "Niski stan magazynowy",
en: "Low stock"
},
color: "#f5ad42"//orange
},
]
);

Example 2 - overwriting existing statuses:

NetDecor.v3.shop.addShopItemStatuses(
[
{
status: "NONE",
priority: -10,
label:
{
pl: "Produkt poglądowy",
en: "Reference product",
hu: "Referencia termék",
sk: "Referenčný tovar",
cs: "Produkt doplňkový",
de: "Ergänztes produkt",
ru: "стандартная модель",
ua: "стандартна модель",
},
color: "#C0C0C0"//grey
},
{
status: "AVAILABLE",
priority: 0,
label:
{
pl: "Produkt dostępny",
en: "Product available",
hu: "Termék elérhető",
sk: "Dostupný produkt",
cs: "Dostupný produkt",
de: "Produkt verfügbar",
ru: "Продукт доступен",
ua: "Продукт доступний",
},
color: "#0B9F15"//green
},
{
status: "UNAVAILABLE",
priority: 100,
label:
{
pl: "Produkt niedostępny",
en: "Product unavailable",
hu: "A termék nem elérhető",
sk: "Tovar nie je k dispozícii",
cs: "Produkt není dostupný",
de: "Das produkt ist nicht verfügbar",
ru: "Продукт доступен",
ua: "Продукт доступний",
},
color: "#BE1300"//red
}
]
);

Example 2 includes the original initial values of the statuses.