Showing dynamic content blocks category

  • 21 April 2022
  • 2 replies

Badge +2


I’m trying to create a product block only to show when a person has recently browsed the homeware section of our site. It is a homeware and clothing store so it doesn’t make much sense to show clothing as recommended items when they’ve browsed homeware and vice versa.

I’m going into the preview mode and seeing that {{ event.Categories.5 }} is ‘homeware’ so i’m trying to show a dynamic product block based on that, but it doesn’t work, it just keeps on still showing clothing items. 

I’ve successfully managed to just show blocks based on the person’s sex using the person|lookup:'Sex' = 'Female' variable, but for some reason just can’t get this homeware category to work. Something i’ve also noticed is that the category number sometimes changes depending on the preview, it was 5 in one preview and then in another the category 5 was Trousers. So do I need to put the text homeware in rather than the category number? The store has multiple iterations of homeware, like homeware candles for instance, so I also need to know how to add multiple variables in.

Any help appreciated!


Best answer by Dov 21 April 2022, 19:52

View original

2 replies

Badge +2

Great, thank you! That’s working now :)

Userlevel 7
Badge +61

Hi @Fransal,

Thanks for sharing this question with us.

You’ll want to just use just the “base” of the tag (event.Categories) rather than the base and the array index (the .5 part). That will tell the tag to include all items in the array more “generally”. So that would be just event.Categories. So the statement would look like the following:

"NAME OF CATEGORY" in event.Categories

Then turn the hide/show block on as explained in How to Show or Hide Template Blocks Based on Dynamic Variables.

Hope that is helpful!