Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Context

Store app properties are used to customize the level of information displayed on screen for a given entity. OneStock's basic display is like this:

...

                              

Image Added

Pop-inImage Modified

You can find this configuration in the configuration -> store_app -> pages section of your admin backoffice (https://admin.onestock-retail.com/cXXX/config/store_app/pages).

Advanced customization

Tip

To view the default properties, use the test command dumpConfig()

Multi parcel

In the case of pages that support multi-packaging (bag and pack), there is an entity called multi_order, which corresponds to the one used when the store app is configured for multi-packaging (options.create_multi_parcels key).

Popins

The information level of the various popins can also be configured.

Properties Formatting

Object properties often need to be formatted for aesthetic reasons.

It is possible to use one or more formatters with the following syntax property|formatter:option|formatter|formatter.

Tip

Examples:

  • to capitalize the first letter of the delivery type, use delivery.type|capitalize

  • to retrieve the 3rd element of an array (index 2), I'll use delivery.destination.address.lines|arrayelement:2

Parenthesis

A parenthesis syntax is available for the most complex expressions.

Properties that are nested within parentheses will be evaluated first. For example, the property parcels|forcount:line_item_ids|concatraw: / |concatraw: (line_items|length) will display 1 / 2.

In the absence of parentheses, formatters are applied from left to right.

All formatters availables

Name

Description

Option

Example → Render

arrayelement

Retrieves the element of an array with index.

Element index

types|arrayelement:0→ ffs

capitalize

Replace all letters with lower case, except the first, which is upper case.


features.name|capitalize → Summer dress

concat

Concatenates another property, without spaces.

Property to concatenate

carrier|concat:tracking_code → ups64477466854

concatraw

Concatenates a string.

Defined string

state|concatraw:from warehouse → dispatched from warehouse

currency

Formats a number into a currency, with a symbol defined in another property.

Property containing the currency

payment.price|currency:payment.currency -> 35,99 £

currencyraw

Formats a number into a currency, with a symbol defined in the expression.

The currency to use

payment.price|currencyraw:USD → 35,99 $

dateto

Status
colourYellow
title9.8

Format a date range.

Property corresponding to end date

eta_start|dateto:end_end → 27 - 30 september

divide_by

Divides a value of a property by an another.

Divisor property

order_item.pricing_details.price|divide_by:order_item.quantity → 3 (price = 6 and quantity = 2)

expirationcolor

Returns a date in the color sent if expired.

It is possible to pass a relative parameter (seconds to be subtracted from the expiry date).

The warning value to be subtracted from the current date for the calculation (in seconds)

The color to be set if the date has expired.

The value to be returned.

expiration_dates.client_collect.expiration|expirationcolor:86400,danger,(expiration_dates.client_collect.expiration|moment:DD/MM/YYYY|transcount:carry.reserved_till) → Reserved until 10-02-2023

filter

Scans an array and keeps the elements of this array whose property is worth one of the values provided.

Comma-separated list of values

line_items|filter:state=removed,mistaken|length|concatraw: items sont removed ou mistaken → 5 items sont removed ou mistaken

filterlength

Status
colourYellow
title5.5

Scans an array and counts the number of elements in the array whose property has one of the provided values.

Comma-separated list of values

line_items|filterlength:state=removed,mistaken|transcount:order.cancel_count → 5 canceled

forcount

Status
colourYellow
title5.5

Scans an array and counts the size of each property in the array.

Property

parcels|forcount:piece_ids|transcount:order.item_count → 5 items

hierarchicalchoose

Status
colourYellow
title10.0

Scans an array and returns the element with the lowest index in the array defined in option . If nothing matches, does nothing.

Comma-separated list of values

types|hierarchicalchoose:ois,ckc,ffs → ckc

index_ranges_quantity

Status
colourYellow
title11.8

Calculates the total quantity of indexes in the supplied index ranges.

parcel.line_item_index_ranges|index_ranges_quantity|transcount:order.item_count → 5 items

length

Returns the length attribute of an array or string.


piece_ids|length → 3

link

Formats the result as a link.

Property

delivery.carrier.name|link:delivery.carrier.tracking_url → <a href="colissimoURL">colissimo</a>

link_blank

Formats the result as a blank link.

Property

delivery.carrier.name|link:delivery.carrier.tracking_url → <a target="_blank" href="colissimoURL">colissimo</a>

lowercase

Replace all letters with lowercase letters.


features.name|lowercase → summer dress

moment

Format a timestamp using momentjs.

Date format

date|moment:DD/MM/YYYY → 29/03/2018

mutiply

Status
colourYellow
title11.5

Multiplies two values.

Can take optional features or constants.

You can limit the number of decimal places by adding a second argument separated by a comma. By default, results are limited to 2 digits after the decimal point.

payment.price|multiply:features.quantity → 17.97 (payment.price = 5.99 and features.quantity = 3)

payment.price|multiply:features.quantity,2 → 3.333333 (payment.price = 10 and features.quantity = 1/3)

prepend

Concatenates another property on the left.

Property

tracking_code|prepend:carrier → ups64477466854

prependraw

Concatenates a string on the left.

Defined string

state|prependraw:State is → State is dispatched

rawstring

Replaces the result with a string defined.

Defined string

|rawstring:units → units

sum

Scans an array and sum the given property in the array.

Property

line_items|sum:payment.price → 75.8

trackingcode

Displays tracking code if available, translates key passed in parameter otherwise.

Key to translate

tracking_code|trackingcode:parcel.no_tracking_information → XV265564654 or Missing tracking

trans

Translates the result (if the translation key exists).


|rawstring:states.|concat:state|trans → Dispatch

transcount

Takes a number as input and calls a translation with pluralization.

Key to translate

line_items|length|transcount:order.item_count → 3 items

transcountnotnull

Status
colourYellow
title10.0

Calls a translation with pluralization on the input. Displays nothing if !input is false in the javascript sense.

Key to translate

line_items|length|transcountnotnull:order.item_count

with line_items = [] :

unfilterlength

Status
colourYellow
title5.5

Scans an array and counts the number of elements whose property is not one of the provided values.

Comma-separated list of values

line_items|unfilterlength:state=removed,mistaken|concatraw: not canceled → 5 not canceled

uppercase

Replace all letters with capital letters.


features.name|uppercase → SUMMER DRESS

since

Status
colourYellow
title11.0

Takes a date as input and returns the difference from now in the site's lang.


date|since → since 1 hour