Working with data
| Name | Description |
|---|---|
date(date) | Creates object DateTime on the basis of transmitted string, the format matches php function strtotime |
time_interval(from, to, custom) | Creates TimeInterval object based on transferred string values of timeWhen only parameter from is specified the interval with exact value of time will be createdIt`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 |
length(value) | Returns length of transmitted string |
unique(entity, field) | Checks the uniqueness of the object by definite field |
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 |
entity_by_id(entityName, id, idField) | Returns content from the base by id For selecting there are available object types: User, Site, Product, ProductGroup, CustomerWhen selecting the content Product it is possible to specify the identification field. Allowed values: id, externalId, article |
entities_by_ids(entityName, array ids, idField) | Returns array of contents from the base by ids For selecting there are available object types: Product, ProductGroupWhen selecting the content Product it is possible to specify the identification field. Allowed values: id, externalId, article |
order_contains(Order 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 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 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. |
offer_inventories(Offer offer, Site site, Store|array stores) | Returns an array of inventories (array of Inventory objects) of the offer by storesAccepts parameters: Offer offer - offer objectSite|null site = null - store object, optional (only inventories for the store's warehouses will be returned)Store[]|Store|null store = null - warehouse object or array of warehouse objects, optional (only inventories for the specified warehouses will be returned) |
Auxiliary functions
| Name | Description |
|---|---|
user() | Returns current user |
user_status(User user) | Returns the user status (free, busy, dinner, break) |
user_online_status(User user) | Returns the user online status (true or false) |
hash(algo, data) | Executes a one-way hashing of data with usage of specified hash-function (md5, sha1, sha256). The value returns as hex-tring lower case. |
last_run(interval, triggerCode, findByEntity) | Returns information about the last start of trigger; if trigger starts for the first time the function returns null , more details. Available only in triggers. |
rand(min, max) | Returns random whole number of specified range [min, max] |
rand_string(length, alphabet) | Returns random symbols sequence of specified length, containing only symbols of the specified set (alphabet). By default there is used set containing only english letters lower case and numbers. |
local_time(source, default) | Local time according to current settings. Parameter source can be equals to CustomerAddress, CustomerPhone, OrderDeliveryAddress, StoreAddress or phone number as string. |
is_working_time(dateTime) | 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. |
round(value, precision, method) | Returns a rounded value with specified precision. The first value is the number to be rounded, the second is the rounding precision (0, if to the whole), the third is the rounding mode ( common is the usual mode, ceil always rounds up, floor always rounds down) |
is_valid_email(string email) | Checks validity of an e-mail address. Returns true or false. |