Splio gives you the opportunity to enrich messages with sequences of information about, among other things, products and stores.
Products loops
Use products loops to display information about selected products.
You can access shortcuts to loops from the "functions" menu in the editor.
Now, click to insert predefined empty loops.
Loops for specific products
To loop over specific products, list them by their product IDs.
Explanation:
For each product in the list of IDs (orange), Splio will include all the product fields (blue) found between the beginning and the end of the loop in the message to send.
The "{SPLIO ENDFOREACH}" line ends the loop.
Loops for products in a filter
You can loop over all products in a filter indicated by its numeric ID.
Explanation:
The line which begins the loop contains the "SEGMENT" keyword followed by the ID of the segment (orange). Splio will go over the loop once for each product in this segment.
The ID you are looking for is in the "About" of the filter and is called "Designer ID".
All the product fields (blue) are included in the HTML message, but for "$product.img_url$" Splio checks if it is not empty (does not equal "", or an empty string). If the condition is met, Splio inserts an image. If not, it writes "No image to display".
The loop then continues until all items are shown.
Options for the loops
Options allow you to limit the number of products shown by the loop and sort them.
- LIMIT="n" sets the maximum number of repetitions to "n"
- ORDERBY="field" tells Splio to sort the products by the "field" before doing the loop. It works only selecting "price" as field.
- DIRECTION="ASC|DESC" determines if the products are sorted in ASCending or DESCending order.
Explanation:
First, Splio creates a list of items from segment 316, ordered by name (ORDERBY="price"), from Z to A (DIRECTION="DESC"). Then it goes over the loop 4 times (LIMIT="4"), once for each element from the top of the list.
All the product fields (blue) are included in the product HTML code. The condition, same as above, shows an image only if the $product.img_url$ is not empty.
The loop continues until all 4 items are shown.
Separators in product loops
Splio can automatically include a predefined separator at regular intervals.
- SEPARATOR="-----" defines the text (or HTML code, between the quotation marks) inserted as the separator
- EVERY="n" is the number of loop repetitions after which the separator gets inserted.
Explanation:
The example produces table rows of 3 cells each. Each time the loop is run, it creates a cell with information on a single product and an image (all based on product fields, in blue). The separator is a small chunk of HTML, which closes the current table row and opens a new one.
Loop over custom field content
You can use a database field containing a list of products (e.g., favorites) to loop over. To do so, place the name of the field after the "IN" keyword.
Explanation:
For each product whose ID is found in the $favorites$ field, the product fields will be included in the produced message.
The loop ends once all product IDs in the field are exhausted.
To find the custom fields in your Splio universe, go to DATA > Fields, as in the image below.
Loop over products linked to web behavior
If you are tracking the behavior of your clients online, you can access and display products linked to their activities using the "VISITS" keyword.
Explanation:
In this example, Splio queries the database for products associated with the client's visits online, orders it alphabetically from A to Z, then goes through the loop for the first 4 products at the top of the list. For each of these 4 products, all information found in the fields (blue) is displayed.
Limit web behavior loops according to visit time
You can define a timeframe for the tracked behavior using the following keywords:
- AFTER=" T minus " sets the starting point, only user's behavior after this time will count
- BEFORE=" T minus " sets the end point for behavior.
The time takes the "T minus" form: the letter "T" is followed by the minus sign, then the number of days (e.g., "3D" for 3 days) and hours ("12H"). The timeframe is always calculated in relation.
Explanation:
Splio will go over the loop once for each product linked to the contact's behavior which took place no more than 7 days before sending ("T-7D") and no less than a day and a half ("T-1D12H") before sending. Each passage of the loop will use the field values (blue) for the current product.
Store loops
With store loops you can display information about stores roughly in the same way as for products. To do so, you need to replace the "PRODUCT" keyword with "STORE" in the "SPLIO FOREACH" syntax.
The examples below demonstrate how to do it using additional attributes (commands) to regulate the loop, just like with products.
Stores by ID
List store IDs in quotation marks to make Splio loop over them.
Explanation:
For each store in the list (orange, between quotation marks), the content of store fields (blue) will be included in the output.
In this case, the output for each store is formatted as a single item in an HTML list.
Sorted stores
Just like products, stores can be sorted accordings to the content of a field.
- ORDERBY="field" indicates the "field" used for sorting. It works only selecting "price" as field.
- DIRECTION="ASC|DESC" determines the sort direction: ASCending or DESCending.
Explanation:
For each store in the list (orange, between quotation marks), ordered by name in ascending order (A-Z), Splio will include the contents of the store fields (blue) in the output.
This loop is almost identical as in the previous example, except that the stores are sorted alphabetically.
Loop over stores in custom field
Include the name of a field containing a list of stores after the "IN" keyword to loop over the IDs in the field.
Explanation:
For each store ID found in the $Favorite_Stores$ field, Splio includes the store fields (blue) in the output.
The loop is repeated for all stores listed in the field.
Stores from a segment
Use the "SEGMENT" keyword followed by segment ID to loop over all stores it contains.
Explanation:
For each of the first four stores found in the segment whose ID equals 217, Splio will include the values of store fields (blue) in the output message.
The loop will only be repeated up to 4 times because the LIMIT="4" keyword was used.
For ready to use product & stores' loops, go to the Intro & Tutorial section > Ready to use blocks & loops > products loop & stores loop.