Data type ShopCategoryData
Description:
Products are structured with a hierarchical tree. Each product can belong to as many tree nodes as you want, and thus, it is possible to provide different navigation and abstraction structures to the user. The nodes of the tree are called categories. They are saved in the data format ShopCategoryData. The data class implements a special logic to save hierarchical data in a database: so-called Nested Sets. The idea is as follows:
- Each node in the tree has a nodeLeft and a nodeRight attribute.
- In addition, each node has a nodeLevel attribute.
We are now counting first the nodeLeft attributes and then the nodeRight attributes in a deep-first approach.
The Nested sets data structure makes it possible to load the complete hierarchy with only one SQL request. This makes data management extremely efficient; updating the category structure is a bit more complex. However, the logic for that is wholly automatized using the REST API.
Attention
Please be aware: TYRIOS is an aspect-oriented system, and the concrete data structure depends on your system configuration. Especially in case you want to update existing data, please be aware of taking all available fields into account or using an update-specific API endpoint to avoid data loss.
General data structure
In general, a ShopCategoryData object has the following data structure:
{
"id": 2, // auto generated ID
"MediahelperFile": 96, // Mediahelper object or ID or null, if no image is given
"ProductData": null, // array of assigned products, typically not loaded via API
"visible": true, // specifies if the category is public
"useAccidentialProducts": false, // specifies if randon products should be presented
"useProductsFromChilds": false, // specifies if products from sub categories should be shown directly in this category
"updateTime": 1625662114, // unix timestamp for the last update
"sortingOption": "2",
"defaultSorting": "4",
"facetDefinitionMode": "2",
"FacetDefinition": null,
"ShopCategoryFilterDefinition": [ // possibility to specify additional filters for sidebar pannel using TYRIOS search facet support
{
"id": 1,
"sotField": "brand",
"sorting": "alphabetical",
"sortingDirection": "ASC",
"searchable": true,
"facetLimit": "-1",
"initiallyExpanded": true,
"facetFieldRenderer": "default",
"presentationName_de": "Marke",
"ShopCategoryData_ref_position": 0
},...
]
"showProducts": true, // specifies, if products should be shown directly within this category
"showCategorySidebar": true, // specifies if sub categories should be shown in the sidebar
"showCategoryList": true, // specifies if sub categories should be shown as list
"hideIfEmpty": true, // specifies if this category should be hidden if empty
"name_de": "Meine Kategorie", // specifies the name of the category, available for every language
"description_de": null, // specifies a description for this category, HTML is supported. This is shown at the beginning of the category
"innerDescription_de": null, // specifies an inner description, HTML is supported
"categoryHeader_de": null, // specifies an alternative category headline for category overview, this field is available for every language
"productHeader_de": null, // specifies an alternative product headline for category overview, available for every language
"keywords_de": null, // specifies meta keywords for German, available for every language
"metaDescription_de": null, // specifies meta description for German, available for every language
"alternateHtmlTitle_de": null, // specifies an alternativ HTML title attribute, available for every language
"nodeLeft": 2,
"nodeRight": 13,
"nodeLevel": 1,
"parentID": 1 //specifies the parent ShopCategoryData id for faster lookup
}
As you can see, there are a lot of languages depending on fields identified by a language token "_de." Depending on your system configuration, there might be additional language definitions.