Function Description
date(date) Creates object DateTime on the basis of transmitted string, the format matches php function strtotime
Examples
date("2015-01-01")
date("1 day ago")
date("first day of this month 12:00") # if the time is not specified obviously, there will be used current time
time_interval(from, to, custom) Creates TimeInterval object based on transferred string values of time
When only parameter from is specified the interval with exact value of time will be created
It`s possible to specify only one interval limit
When parameter custom is transferred other parameters will be ignored and the interval will be with arbitrary string value
Examples
time_interval("18:00") # at 18:00
time_interval("16:00", "20:00") # from 16:00 to 20:00
time_interval("16:00", "") # from 16:00
time_interval("", "20:00") # to 20:00
time_interval("", "", "after 6 p.m") # arbitrary value in the form of the line
length(value) Returns length of transmitted string
Examples
length("string") # 6
unique(entity, field) Checks the uniqueness of the object by definite field
Example
unique(customer, "email")
custom_field(entity, code) deprecated Returns the typified value of customer field
entity_by_code(entityName, 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
Example
entity_by_code('DeliveryType', 'delivery-type-10')
entity_by_id(entityName, id, idField) 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(entityName, array ids, idField) 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
entities_by_ids('Product', ['100', '101', '102'], 'externalId')
order_contains(order, array items) Takes order and items/item groups list and returns true if any item or item of any group is in order
customer_looked(customer, items) Takes customer and items/item groups/order products list and returns true if customer has seen any item or item of any group
customer_looked_products_count(customer) Function returns total quantity of items seen by the customer
replace(subject, placeholders) Replaces all occurrences in the original subject string according to the placeholders array.
Examples
replace("+79261234567", {"+7": "8"}) # 89261234567
replace(order.phone, {" ": "", "(": "", ")": ""})