Page Variables
In eCommerce, page variables are essential for creating a dynamic and personalized shopping experience. These variables are defined and managed in the backend using Flask and rendered on the front-end using Jinja2.
Global Variables
Because it's impossible to list all of the available variables, here is a short summary of the most used ones.
context
This is the global context, defined by Flask and extended by our backend.
| Key | Description |
|---|---|
| CMS_MODE | bool: Are you logged into the CMS? |
| CHECKOUT_V2 | bool: Is CHECKOUT_V2 active? |
| use_basic_basket_overview | bool: True => Use a basic version of the basket, without calculating sale totals. |
| semi_secure_endpoints | List: UNUSED |
| tags | List<Dict>: A list of all the active product tags |
| nav_items | List<Dict>: A list of all the available trees, in the correct structure. |
| page_nav_items | List<Dict>: A list of all the nested CMS pages. |
| auth | Dict: An object that contains information about order possibilities. |
| basket | Dict: An object that contains all the basket data. |
| outlets | List<Dict>: A list that contains all the configured outlets. |
| active_sale_count | int: An indication of how many sales the user has. |
| active_invoice_count | int: An indication of how many invoices the user has. |
| wishlist | List<Dict>: A list of products that the user has in their wishlist. |
| edit_mode | str: The ID of the sale that a supervisor is editing. |
| party_info | Dict: Contains all info of the party of the user. |
| ip_country | str: The country based on the user's IP address. |
| country_suggestion | Dict: Suggested country based on the user's IP address. |
| cookie_prefs | List<str>: A list of cookies accepted in the cookie consent. |
| cookies_accepted | str: UNUSED |
| is_mobile | bool: Is the UserAgent of the request a mobile device? |
| experimental | bool: UNUSED |
| request_mobile | bool: Does the cookie cs_mobile exist? |
| recent_products | List<Dict>: A list of recently viewed products. |
| js_translations | Dict: A fixed object with translations that can be used in JavaScript by using window.js_translations |
| first_available_delivery_date | str: First available delivery date. |
| delivery_days | List<int>: Index of days that are set as delivery days. |
| non_delivery_days | List<int>: Index of days that are not set as delivery days. |
| show_price_date_selector | bool: Is select_price_date checked in the shop settings? |
| available_payment_methods | List<Dict>: Payment methods linked to the shop's payment configuration. |
| price_date | Date: First available delivery date. |
| segments | List<Dict>: List of segments linked to CMS user. |
| active_segment | Dict: Active segment. |
| active_segment_groups | List<Dict>: List of grouped segments. |
| cloudflare | bool: Is CloudFlare active? |
| show_basket_cumulated_count | bool: Show the combined count of products? |
| favourite_order_template | str: ID of the favourite order template. |
g.context
| Key | Description |
|---|---|
| domain_identifier | str: The domain |
| unit_price_field | str: UNUSED |
| unique_search_attributes | List<int>: A list of IDs of uniquely searchable attributes. |
| shop | Dict: All information related to the current shop. |
| metadata | Dict: Information about SEO texts. |
| language | Dict: Language ID and Code. |
| available_languages | Dict: All available languages. |
| allowed_languages | List<Dict>: List of allowed languages. |
| language_groups | Dict: Languages grouped by language code. |
| language_code_map | Dict: Languages formatted as 2-code. |
| allowed_countries | Dict: All countries allowed for a shop. |
| language_catalog | Dict: Language-specific catalogs. |
| language_tree_root | Dict: Language-specific trees. |
| language_reference | Dict: Internal references for languages. |
| language_campaign | Dict: Language-specific campaigns. |
| fixed_delivery_outlets | bool: If True, then just the outlets are available for delivery addresses. |
| cms_variables | Dict: Language-specific variables. |
| meta_variables | Dict: Language-specific meta-variables. |
| locale | str: Locale code (nl_NL). |
| locale_code_short | str: Short locale code (nl). |
| locale_default | str: Default locale code. |
| locale_format | str: Date format in Python notation. |
| locale_format_indicator | str: Date format indicator. |
| datepicker_format | str: Date format in JS notation. |
| company | int: ID of the company related to the shop. |
| currency | Dict: Currency related to the company. |
| shop_currency | Dict: Currency related to the shop. |
| catalog | List<Dict>: List of catalogs before login. |
| exclude_catalogs | List<Dict>: List of excluded catalogs before login. |
| preorder_catalogs | List<Dict>: List of preorder catalogs. |
| exclusive_catalogs | List<Dict>: List of exclusive catalogs. |
| search_exclude_catalogs | List<Dict>: List of search excluded catalogs. |
| bundle_config | Dict: Bundle configuration for a product. |
| cs_party_origin | str: ID of the party_origin linked to the shop's company. |
| picture_upload | bool: Is the picture upload active? |
| settings | Dict: All shop-based settings. |
| party | Dict: Information related to the default party. |
| default_party_data | Dict: Pricing information related to the default party. |
| sale | Dict: Information about pricing settings. |
| auth | Dict: Information about the default user role. |
| features | List<str>: List of all active features: relevance, lateral_behaviour, rma, contracts, headless, sales_center, quotations, template_products |
| search | Dict: Search configuration. |
| api_profile | Dict: Information about external API configurations. |
| ga4_id | str: GA4 ID. |
| external_interface | Dict: Configuration for the External Price Interface. |
| email_campaign | Dict: Configuration for email campaigns. |
| payment_provider | Dict: The payment provider linked to the domain or shop. |
| default_stock_indication | int: The ID of the default stock indication. |
| stock_text | Dict: UNUSED |
| after_login_page | bool: If True, then a custom page or overlay will be presented after login. |
| enterprise_domain | Dict: Information about the enterprise domain. |
| testing | bool: Flag for using E2E tests. |
| nocache | bool: Flag for using E2E tests. |
g.user
| Key | Description |
|---|---|
| user_id | int: ID of the user. |
| user_name | str: Full name of the user. |
| user_first_name | str: First name of the user. |
| user_middle_name | str: Middle name of the user. |
| user_last_name | str: Last name of the user. |
| user_email | str: Email address of the user. |
| email_confirmed | bool: Has the user confirmed their email address? |
| user_date_of_birth | DateTime: The date of birth of the user. |
| account_active | bool: Is the user's account active? |
| login_popup | Dict: Login popup configuration. |
| login_popup_choice | str: Choice made in login popup. |
| punchout_user | bool: Is the user a punchout/OCI user? |
| punchout_user_type | str: Punchout type. |
| punchout_parameters | Dict: Punchout parameters. |
| language | Dict: Chosen language of the user. |
| locale | Dict: Chosen locale of the user based on the language. |
| locale_format | str: Locale format of the user in Python format. |
| locale_format_indicator | str: Locale format of the user in JavaScript format. |
| custom_index | bool: Does the customer have an external product index? |
| party_index | bool: Does the customer have an external party index? |
| category_index | bool: Does the customer have an external category index? |
| currency | Dict: Currency information of the user. |
| party | Dict: Information related to the user's party. |
| sale | Dict: Sale settings of the user. |
| catalog | List<Dict>: List of catalogs linked to the user. |
| exclude_catalogs | List<Dict>: List of excluded catalogs linked to the user. |
| allowed_catalogs | List<Dict>: List of allowed catalogs linked to the user. |
| supervised_catalogs | List<Dict>: List of supervised catalogs linked to the user. |
| select_supervised_catalogs | List<Dict>: List of selectable supervised catalogs linked to the user. |
| visible_supervised_catalogs | List<Dict>: List of visible supervised catalogs linked to the user. |
| no_supervision_catalogs | List<Dict>: List of catalogs linked to the user. |
| superuser | bool: Is the user a superuser? |
| select_sale_user | bool: Does the user need to select a user for a sale? |
| test_user | bool: Is the user a test user? |
| debug_access | bool: Allows access to debugging tools. |
| internal_user | bool: Internal users can use the Web-order module of the Web shop, while Web Portal Supplier users have access to that webshop module. |
| gender | str: The gender of the user (male or female). |
| web_order_type | str: Which type of orders are allowed during Web Order Entry. |
| supervisor | bool: Is the user a supervisor? |
| budget | int: ID of the user's budget. |
| autosave | int: Autosave database record ID. |
| registration_forms | Dict: Information about allowed registration forms. |
| features | Dict: Information about ordering: web_orders, superusers, budgets. |
| auth | Dict: UserRole settings. |
Other Variables
If you're looking for more specific variables that are maybe page-specific, you can easily find them by logging into the CMS and opening the page variables. This contains a list of all the available variables for that page.
Anonymized Information
Some information may be hidden, as it can contain sensitive data.