# Objects
Objects available in the system allow you to easily build and customize themes. These objects come with methods and/or properties that facilitate handling settings, managing currencies, handling images, querying general system information, and accessing various routes. Below you'll find detailed descriptions of each object and how to use them.
These objects are globally accessible in every template file.
# config
# Description
Object representing the settings available in the admin interface.
# get() method
# Syntax
config.get(configName)
# Argument
configName: String representing the name of the configuration setting to retrieve.
# Return Value
Can return various types such as String, Boolean, or Integer. Returns NULL if the setting doesn't exist.
# Example Code:
| Code: | Output: |
| |
# currency
# Description
Contains information about currencies set in the online shop.
# Properties
| Property | Description | Type |
|---|---|---|
| currencyId | current currency ID, e.g., 4 | String |
| currencyCode | current currency code, e.g., HUF | String |
| currencyTitle | current currency title, e.g., Hungarian Forint | String |
# Usage
The Currency object can be accessed via the shop object through the currentCurrency and availableCurrencies properties.
# Example
Retrieve the title of the first active currency (HUF in this example):
| Code: | Output: |
| |
# image
Used for handling images, the Image object currently only has an src property which stores the image source (URL). The src property is of type string. Available only in templates where passed.
# Example:
Accessing an image object within the content variable in news.tpl:
| Code: | Output: |
| |
# page
The page object is a global object used for querying general system information.
# methods
| Name | Description | Type |
|---|---|---|
| getRoute() | Returns the current request route, returns an empty string if not available. | String |
| getUrl() | Returns the full URL of the current request. | String |
# Example Code for Product Page
Retrieve the current route on a product page:
| Code: | Output: |
| |
# routes
The routes object is an associative array where keys are route names and values are URLs associated with those routes. Always of string type.
# Example
| Code: | Output: |
| |
# Full list
| Key: | Value: |
| account_url | /index.php?route=account/account |
| account_edit_url | /index.php?route=account/edit |
| account_insert_url | /index.php?route=account/address/insert |
| account_password_url | /index.php?route=account/password |
| account_address_url | /index.php?route=account/address |
| account_waitinglist_url | /index.php?route=account/waitinglist |
| account_history_url | /index.php?route=account/history |
| account_invoice_url | /index.php?route=account/invoice |
| account_download_url | /index.php?route=account/download |
| account_newsletter_url | /index.php?route=account/newsletter |
| account_registration_contribution_url | /index.php?route=account/registration_contribution |
| account_affiliate_url | /index.php?route=account/aaffiliate |
| account_affiliate_commissions_all_url | /index.php?route=account/aaffiliate_commissions/all |
| account_affiliate_commissions_month_url | /index.php?route=account/aaffiliate_commissions/month |
| cart_url | /cart |
| cartpresent_url | /index.php?route=checkout/cartchildren/cartpresent |
| checkout_url | /checkout |
| contact_url | /index.php?route=information/contact |
| forgotten_url | /index.php?route=account/forgotten |
| login_url | /customer/login |
| logout_url | /index.php?route=account/logout |
| personaldata_url | /index.php?route=information/personaldata |
| register_url | /customer/register |
| manufacturer_list_url | /index.php?route=product/manufacturers |
| search_url | /index.php?route=product/list |
| sitemap_url | /index.php?route=information/sitemap |
| style_guide_url | /index.php?route=information/style_guide |
| wishlist_url | /index.php?route=wishlist/wishlist |
| checkout_cart_url | index.php?route=checkout/cart |
🔴 Avoid hardcoding system routes directly in templates. Use the routes object instead.
# settings
Used for managing color settings defined in config.data.json for themes.
# get() method
# Usage
{{ settings.get('key', 'default_value') }}
Returns the value of the setting named key if it exists. If key doesn't exist, returns default_value. Returns as a string.
# Example
Retrieve the "global-color" setting from config.data.json:
| Code: | Output: |
| |
# shop
The shop object can be used to request general information about the online store.
# Properties
| Property name | Description | Type |
|---|---|---|
| name | Returns the name of the shop | Sztring |
| title | Returns the title of the shop. | Sztring |
| needCountdown | Returns a Boolean indicating whether there's a countdown active on the page. | Boolean |
| currency | aReturns the current currency of the shop, its properties can be found in the currency object | Currency |
| availableCurrencies | Returns a list of currencies available in the shop. | Array |
# Example
Output the name of the shop:
| Code: | Output: |
| |
# viewHelper
# viewHelper.loadModule()
Used to insert enabled or dynamic modules. If a module is assigned to a position and is also pulled in using viewHelper.loadModule, it will appear both in its assigned position and where loadModule is used.
# Szintaxis
viewHelper.loadModule(moduleRoute)
# Argumentok
moduleRoute: The module path as referenced in the admin interface.
# Return Value
Returns the HTML code of the referenced module.
| Code: | Output: |
| |
| |
# viewHelper.loadPosition()
Displays all modules enabled for a given position. Positions are defined in the theme's config/settings.json file.
# Syntax
viewHelper.loadPosition(positionName)
# Arguments
positionName: Name of the position to load.
# Return Value
Returns the HTML of all modules that can appear in the specified position.
Example:
| Code: | Output: |
| |
# viewHelper.isPositionEmpty()
Checks if a given position has any modules assigned to it.
# Syntax
viewHelper.loadPosition(positionName)
# Arguments
positionName: Name of the position to check.
# Return Value
Returns a Boolean: true or false.
Example:
| Code: | Output: |
| |