Model for category functionality.
module:models/CategoryModel
The category class
Classes
Methods
(inner) CategoryModel/get(parameter) → {module:models/CategoryModel~CategoryModel}
Gets a new instance of a given category.
Parameters:
Name | Type | Description |
---|---|---|
parameter |
dw.catalog.Category | String |
The category object to enhance/wrap or the category ID of the category object. |
Returns:
A new CategoryModel instance.
(inner) CategoryModel/getMenuCategories(renderAllCategories) → {Array}
Gets a list of online categories that have the showInMenu attribute set to true. The showInMenu attribute is a custom attribute for SiteGenesis that determines whether a category is shown in the site navigation.
Parameters:
Name | Type | Description |
---|---|---|
renderAllCategories |
Boolean |
Returns all online subcategories if true. |
Returns:
Subcategories for menu.
- Type
- Array
(inner) CategoryModel/getTopLevelCategories() → {Collection|ArrayList}
Returns top level online categories list if it exists, otherwise returns sibling online categories list if it exists. If neither exist, it returns an empty list.
Returns:
Returns a collection of online subcategories or an empty list if there are no top level categories.
- Type
- Collection | ArrayList
(inner) CategoryModel/getTopLevelCategory() → {dw.catalog.Category}
Returns the root category from the site catalog.
Returns:
The root catalog category.
- Type
- dw.catalog.Category
(inner) CategoryModel/getUrl() → {dw.web.URL}
Prints out the category's alternative URL if maintained in a custom attribute.
Uses custom attribute of type MarkupText to be able to maintain URLUtil-styled URLs, such as $url('GiftCert-Purchase')$
Returns:
URL for the Search controller Show function with the category ID.
-
Type
-
dw.web.URL