Get a 'Featured Resource' based on Selected resource

Hi All!

I have a site which has 20 products
On my home page I want to display the pagetitle, tv.image, introtext from a ‘featured product’.
So in my homepage template I want a singleselect TV which pulls in all the resources and then once selected and saved, the above fields for that resource are displayed on the home page.

When I started it felt like an easy one, but I can’t think how to put it together!

I have a TV in my homepage template which calls the product resources:

@SELECT `pagetitle`,`id` FROM `[[+PREFIX]]site_content` WHERE `parent` = 22 AND `published`= 1 ==`id`

I can print this TV in my template, and it gives me the resource ID, but not sure what Snippet to use to pull in the info I need form that ID?

One other slight issue is that using the above code, it doesn’t pull in any nested resources to my select box?

Thanks in advance for a steer!

Andy

getResources/pdoResources:

[[pdoResources?
   &parents=`-1`
   &resources=`[[*featured_products]]`
   &includeTVs=`image`
]]
1 Like

Now I feel really stupid.
So obvious. I couldn’t see the wood for the trees.
And I haven’t had enough sleep. Or Coffee.

Thanks Mark!

1 Like

Final part of the puzzle - my TVs input (below) only gives me the top level products, but some are nested within folders inside ID 22:

@SELECT `pagetitle`,`id` FROM `[[+PREFIX]]site_content` WHERE `parent` = 22 AND `published`= 1 ==`id`
```
Thanks
Andy
2 Likes

I thought I could leverage the template instead of the parent, but something’s not quite right here:

@SELECT `pagetitle`,`id` FROM `[[+PREFIX]]site_content` WHERE `template` = 11 AND `published`= 1

What ave a got wrong here?

Thanks
Andy

1 Like

It’s OK - it IS working. just a aching issue.

So this works if anyone else has the same issue

@SELECT `pagetitle`,`id` FROM `[[+PREFIX]]site_content` WHERE `template` = 11 AND `published`= 1
1 Like