$wsNavigation module, you can read out and display the customer’s current navigation path (breadcrumb) in the shop. The breadcrumb shows the customer where they are in the category structure and enables easy navigation to parent categories.
Module overview
Example / excerpt of$wsNavigation
| Variable | Type | Description |
|---|---|---|
path | array | Path in the category tree, indicating where you have navigated in the shop. |
[$i].type | string | Type of the corresponding position in the path. |
[$i].object | map | Category or product map. |
Note: The properties of
object depend on the type:- For type
category, all properties from$wsCategoriesare available. - For type
product, all properties from$wsProductsare available. - Only the last element in the path can be of type
product.
Templates
By default, the breadcrumb is loaded in a separate file breadcrumb.htm so that the same breadcrumb can be displayed everywhere in the shop. This file is typically included in the layout template.Variables
$wsNavigation.path
List of navigation elements (breadcrumb) from the home page to the current position.i].type
Returns the type of the position in the path:"category" or "product".
i].object
Returns the category or product map. For categories, this corresponds to the category map; for products, the product map. You can thus access properties such asname, id, or custom.
Methods
No methods are available for$wsNavigation.
Actions
No actions are available for$wsNavigation.
Examples for using the navigation data
Breadcrumb navigation
To view the available data of the breadcrumb navigation, you can have it output in a JSON-like format. This is helpful to understand the structure and contents of the breadcrumb navigation or to debug errors.Example for displaying the breadcrumb
In this example, the$wsNavigation module is used to display the current position of the shop customer in the menu structure of the page they are visiting.
