Hello everyone,
I’ve got a getResources call whose template uses two TVs. I’ve run into strange behavior when one of the TVs is called from a chunk inside the template.
I’m wondering if there’s some problem I’ve uncovered. My non-working code looks like this:
<div class="catalog-item [[+idx:mod:isequalto=`1`:then=`odd`:else=``]]">
[[$bookStatusGR]]
<a href="[[~[[+id]]]]"><h2 class="hyphenate">[[+longtitle]]</h2></a>
<p>[[Gallery? &album=`[[+tv.bookGalleryID]]` &thumbTpl=`bookCatalogThumbnail` &thumbWidth=`110` &thumbZoomCrop=`0` &itemCls=`book-thumb` &limit=`1`]]
[[+introtext:shorten=`390`:default=`no introtext`]]
[[+introtext:length:if:lessthan=`390`:then=`<a href="[[+id]]"> more … </a>`:else=``]]</p>
</div>
[[+idx:mod:isequalto=`0`:then=`<div class="clear"></div>`:else``]]
where the chunk bookStatusGR looks like this:
<div class="book-status [[+tv.bookStatus]]">
[[+tv.bookStatus : if=`[[+tv.bookStatus]]`:eq=`inProgress`:then=`<p class="book-status-text">Volume in production</p>`:else=``]]
[[+tv.bookStatus : if=`[[+tv.bookStatus]]`:eq=`proposed`:then=`<p class="book-status-text">Proposed volume</p>`:else=``]]
[[+tv.bookStatus : if=`[[+tv.bookStatus]]`:eq=`soon`:then=`<p class="book-status-text">Available Soon</p>`:else=``]]
[[+tv.bookStatus : if=`[[+tv.bookStatus]]`:eq=`preOrder`:then=`<p class="book-status-text">Pre-order now</p>`:else=``]]
[[+tv.bookStatus : if=`[[+tv.bookStatus]]`:eq=`available`:then=`<p class="book-status-text">Now available</p>`:else=``]]
[[+tv.bookStatus : if=`[[+tv.bookStatus]]`:eq=`outOfPrint`:then=`<p class="book-status-text">Out of Print</p>`:else=``]]
</div>
If I replace the bookStatusGR chunk call in the template with the chunk code, everything works. Otherwise, when I’m calling the bookStatus TV using the chunk call, I get only the TV value of the first resource, and that is repeated for all other resources returned by getResources. Weird, huh?
ModX 2.0.8-pl
getResources 1.3.0