Function Description
attribute Function is used for an access to "dynamic" object properties
cycle Function cycle passes in cycle the array of values
random Function allows to get the random value
range Returns the arithmetic progression of integers in the specified range
price_symbol Displays the symbol of current currency
preview_image_tag Generates tag <img/> for item image of the specified size
Examples
{{ preview_image_tag(op.offer.imageUrl, '100x100') }} # Preview of item image 100x100. It will be cutted if necessary.
{{ preview_image_tag(op.offer.imageUrl, '100x-', { alt: op.offer.displayName }) }} # Preview of image will have the width 100, and the height will be calculated proportionally.
min Finds the minimum value in the set or array of numbers
max Finds the maximum value in the set or array of numbers
crm_settings_get Allows to get value of defined system setting
products_by_ids DEPRECATED Use entities_by_ids instead
new_products Returns array of items with mark "New".
Accepts the parameters:
groups - groups, of which the items are selected
count - maximum quantity of selected items (20 by default)
properties - filter by item properties
Example
# Gets items with mark "New" and size "XL"
{% set products = new_products(properties={size: 'XL'}) %}
best_selling_products Returns array of the best selling items
Accepts the parameters:
groups - groups, of which the items are selected
count - maximum quantity of selected items (20 by default)
exclude - items excluded of selection
from - filter by date
to - filter by date
margin - minimum threshold of margin in absolute or relative values, items with lower margin will not be included in selection
properties - filter by item properties
customer - filter by customer
Example
# Gets five the best selling items for the first quarter with margin higher than 10%
{% set products = best_selling_products(from='2016-01-01', to='2016-03-31', count=5, margin='10%') %}
most_visited_products Returns array of the most viewed items
Accepts the parameters:
groups - groups, of which the items are selected
count - maximum quantity of selected items (20 by default)
exclude - items excluded of selection
from - filter by date
to - filter by date
margin - minimum threshold of margin in absolute or relative values, items with lower margin will not be included in selection
properties - filter by item properties
customer - filter by customer
Example
# Gets five the most viewed items
{% set products = most_visited_products(count=5, exclude=[23, 34, 45]) %}
most_long_viewed_products Returns array of the most long-viewed items
Accepts the parameters:
groups - groups, of which the items are selected
count - maximum quantity of selected items (20 by default)
exclude - items excluded of selection
from - filter by date
to - filter by date
margin - minimum threshold of margin in absolute or relative values, items with lower margin will not be included in selection
properties - filter by item properties
customer - filter by customer
Example
# Gets five the most long-viewed items for January
{% set products = most_long_viewed_products(count=5, from='2016-01-01', to='2016-01-31') %}
product_groups Returns the item groups array of the specified store up to a specified level of nesting (1 level by default). If the level value more than 3 is transmitted, then returns 3 levels. Array elements are sorted hierarchically
entity_by_code Returns value of reference book by symbolic code
For selecting there are available object types: DeliveryType, DeliveryService, OrderMethod, OrderProductStatus, OrderType, PaymentStatus, PaymentType, Site, Status, StatusGroup, Store , LegalEntity
Example
{{ entity_by_code('DeliveryType', 'delivery-type-10') }}
entity_by_id Returns content from the base by id
For selecting there are available object types: User, Site, Product, ProductGroup, Customer
When selecting the content Product it is possible to specify the identification field. Allowed values: id, externalId, article
Example
{{ entity_by_id('User', 4) }}
entities_by_ids Returns array of contents from the base by ids
For selecting there are available object types: Product, ProductGroup
When selecting the content Product it is possible to specify the identification field. Allowed values: id, externalId, article
Example
{% set products = entities_by_ids('Product', ['100', '101', '102'], 'externalId') %}
is_working_time Function checks whether the dateTime value is working time and returns result (true or false). As a dateTime the function can take DteTime object or string, whose format corresponds to php format of strtotime function. By default the current date and time is used.
Example
is_working_time()
is_working_time('2015-01-01 10:00:00')
is_working_time(date('2015-01-01 10:00:00'))
is_working_time(order.getCreatedAt())
hash Executes a one-way hashing of data with usage of specified hash-function (md5, sha1. The value returns as hex-tring lower case.
Example
hash("md5", "test") # 098f6bcd4621d373cade4e832627b4f6
yandex_maps_api Generates a link to load API of Yandex.Maps
Accepts parameters:
version - Version
parameters - Array of additional parameters
Example
{{ yandex_maps_api('2.0', { load: 'package.full', lang: 'en_US' }) }}
payment_link Returns a link to pay an invoice of integration payment
To use the function, an integration payment type must be added in order
Accepts the parameters:
order - order with integration payment which use for creating payment invoice link
or
payment - integration payment which use for creating payment invoice link
Examples
# Gets a link to pay an invoice of first integration payment from order
{{ payment_link(order) }}
# Gets a link to pay an invoice of integration payment by the code of the type of integration payment
{% set integrationPayment = null %}
{% for payment in order.payments if integrationPayment is null %}
    {% if payment.type.code == 'yandex_kassa_shop1' %}
        {% set integrationPayment = payment %}
    {% endif %}
{% endfor %}

{% if integrationPayment is not null %}
    Your payment link: {{ payment_link(integrationPayment) }}
{% endif %}
user Returns the current user
user_status Returns the status of the user (the object of the User type) passed as an argument to the function.
Returns the status of the current user when called without arguments.
Example
{{ user_status(order.manager) }} # free
user_online_status Returns the online status of the user (the object of the User type) passed as an argument to the function (true or false).
Returns the online status of the current user when called without arguments.
Example
user_online_status(order.manager) # true
loyalty_account_info Returns information about the bonus account of the participation in the Loyalty Program passed as an argument of the function
Returns an object of the LoyaltyAccountInfo type
Example:
loyalty_account_info(account).getWaitingActivationAmount()
loyalty_account_info(order.loyaltyAccount).getActiveAmount()
loyalty_account_info(customer.loyaltyAccountBySiteCode('test')).getBurnSoonAmount(10)