addShopItemStatuses
addShopItemStatuses(statuses: ShopItemStatusParameters[])
Parameters
Description
This function adds or updates shop item status definitions. It validates the provided data, checking for proper color format and ensuring translations exist for all supported languages. If a status already exists in the system, its priority, color, and label will be updated with the specified values. If the status does not exist, it will be added as a new entry.
Status definitions should be added before adding the price list.
The priority value of a status determines which status will be displayed for objects consisting of multiple shop items with different statuses. Higher priority numbers indicate more important statuses.
By default, the system includes 3 predefined statuses:
- NONE (priority: -10)
- AVAILABLE (priority: 0)
- UNAVAILABLE (priority: 100)
You can add new custom statuses or override the existing ones as needed.
Examples
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 - Overriding 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 demonstrates how to override the default status values with custom settings.