Skip to main content
With the $wsTestMode module, you can check whether test mode is active and control content accordingly. In test mode, you can test new functions, designs, or products without them being visible to regular visitors. In this section, you will learn how to query the test mode and display test-specific content.

Module overview

Example / excerpt of $wsTestMode
{{= $wsTestMode | json }}
JSON output
{
  "active": false,
  "debug": false
}
Variables overview
VariableTypeDescription
activeboolChecks whether test mode is enabled.
debugboolChecks whether debugging is enabled in test mode.

Templates

Using the template engine, certain content can be made specifically visible for test mode. This allows you to test special functions or designs without them being visible to regular visitors of the shop. A special view template is required for password entry to activate test mode. By default, the name is testMode.htm, which is located in the views directory. The template can be renamed. However, the new template name must then be stored in the configuration settings in the admin interface. The configuration option is located in the same place where the password for test mode can be stored and changed.

Variables

$wsTestMode.active

Returns whether test mode is enabled.
{{ if $wsTestMode.active }}
    // Test mode is active
{{ /if }}

$wsTestMode.debug

Returns true if extended debugging is enabled. In debug mode, additional information such as variable values or loading times is displayed.
{{ if $wsTestMode.debug }}
    // Debugging is active
{{ /if }}

Methods

No methods are available for $wsTestMode.

Actions

No actions are available for $wsTestMode.

Examples for using test mode

The link can be sent once you have informed the shop operator that changes have been integrated in test mode and that they can view them via the following link:
https://www.beispielshop.de/?wsvc=View&view=testMode.htm

Check whether test mode is active

{{ if $wsTestMode.active }}
   This content is only visible in test mode
  {{ else}}   
   This content is only visible in live mode   
{{ /if }}

Deactivating global test mode

An option to deactivate test mode can also be offered directly in the online shop in order to switch back to the online shop.
<form action="{{= $wsViews.current.url() }}" method="post">
  <input type="hidden" name="wscsrf" value="{{= $cActionTestModeOff.csrf }}">
  <input type="hidden" name="wsact" value="{{= $cActionTestModeOff.id }}">
  <input type="hidden" name="wstarget" value="/">
  <button name="wsact" value="{{= $cActionTestModeOff.id }}">Deactivate test mode</button>
</form>
More practical examples for implementing the test mode page can be found here:
Practical examples: test mode