Hello,
Is there a way to include the “recently viewed items” code snippet in a flow, as listed here :
But to limited the number of products shown ? I’d like to tell the flow to show “at most 4 last viewed items” by the contact.
Thanks
Stephen
Hello,
Is there a way to include the “recently viewed items” code snippet in a flow, as listed here :
But to limited the number of products shown ? I’d like to tell the flow to show “at most 4 last viewed items” by the contact.
Thanks
Stephen
Best answer by retention
{% for item in person.ViewedItems %}
{% if forloop.counter <= 4 %}
<table style="display:inline-block; margin-left:auto; margin-right:auto">
<tbody>
<tr>
<td style="padding-right:15px;padding-left:18px; width:50px"><img src="{{ item.ImageThumbnailUrl }}" style="margin: 1px; max-width: 150px; height: auto;" /></td>
</tr>
<tr>
<td style="padding-right: 15px;padding-left:18px; text-align: center; font-size:13px; width:50px; font-weight:800">{{ item.Title }}</td>
</tr>
<tr>
<td style="padding-right: 15px;padding-left:18px; text-align: center;font-size:12px; width:50px"><em>{{ item.Metadata.Price|striptags }}</em></td>
</tr>
</tbody>
</table>
{% endif %}
{% endfor %}
I added the {% if forloop.counter <= 4 %}
and the closing {% endif %}
so that if a person has more than 4 items, it will stop at the 4th item. You may want to adjust the rest of the code for it to fit your template in terms of the table size, images size, other item properties, etc.
Hope this helps!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.