Hiya,
I have created a TV called "offer-categories", this TV outputs checkboxes that are assigned to a template used to create venue homepages. Each venue can belong to more than one offer category.
I need a snippet that can grab values from TV’s on the venue template. So I need to grab [*offer-categories*], the logo path from [*venue-logo*] and the value from the first offer [*venue-offer-1*] and also the page ID for the venue in Modx.
I then need to output these values on an offers index page thus:
<h2>Category: Dining</h2>
<ul>
<li>
<a href="[~id~]"><img src="[*venue-logo*]" alt="[*pagetitle*]" /></a>
<h3><a href="[~id~]">[*pagetitle*]</a></h3>
<p>[*venue-offer-1*]</p>
</li>
</ul>
There are about 70 venues and they are all assigned to one or more of 5 offer categories.
So the logic is:
Where Ultimate Parent id = 15 > (venue category container) search through child items (venue pages) + where offer-categories TV = Dining
Grab the above mentioned TV values and output each record set in formatted html
Elseif offer=categories = Food To Go
Grab TV values....
I’ve had a look at the getTV function though I’m struggling to adapt it for my needs.
Could anyone lend a helping hand?
I think you can use Ditto together with the getField-snippet
If you have a TV in your ultimateparent ’category’
use Ditto with something like that:
&filter=`offer-categories,Dining,1`
together with getField which should return the category of the ultimateparent:
[!Ditto? &parents=`venue-container`&display=`all`&filter=`offer-categories,[[getField? &parent=`1` &parentLevel=`0` &field=`category`]],1`&tpl=`your-ditto-tpl`!]
I’m not sure if this works, but something like that should do it.
Bruno