Skip to main content
Modules are global modules provided by WEBSALE (e.g. $wsAccount). They expose variables (properties) and methods. In development, they are sometimes also referred to as view modules, since they are primarily used for output (the read side). These modules make shop data available for template output, e.g. about products, categories, or customer data. Custom modules cannot be created or extended.

Notation & access

  • Notation: $ws<ModuleName> (e.g. $wsAccount, $wsBasket, $wsProduct)
  • Modules contain variables (properties) and methods
  • Access is via the dot operator (.), e.g. on properties or methods of a module
  • Data fields and functions are accessed uniformly via .
Syntax example
$ws<ModuleName>.<Method> ???
For more information, see data access.

Variables & methods

A module usually provides both:
  • Variables (properties)
  • Methods

Variables (properties)

Through variables, the module directly returns the value, which can be read out directly. Example - Indicates whether the user is logged in
{{ = $wsAccount.isLoggedIn }}

Methods

Methods perform the call for the module (e.g. loading data) and return a result. Example - Loads the address with the specified id
{{ = $wsAccount.loadAddress(addressId) }}
Many modules return structured data (e.g. “maps”/objects). The clearest way to access their fields is via user-defined variables that are assigned once in the template. Example - Loading the data of the product with ID 123456
{{ var $myVariable = $wsProducts.load(productId) }}
Using the user-defined variable $myVariable, individual properties are accessed via $myVariable.<field>:
{{ = $myVariable.name }}
{{ = $myVariable.descr }}
Variable and method calls cannot be chained arbitrarily. The following call is therefore not possible:
{{ $wsAccount.loadAddress(addressId).isLoggedIn }}

Available modules

Here is an overview of all modules that are generally available in the WEBSALE shop:

Actions $wsActions

In parallel to the modules, there are actions that begin with $wsActions. While modules display/read out states and data, actions are the opposite direction: they are used to create, change, or delete data – typically triggered by a user interaction (e.g. link, button, form). For more information, see referenceactions