Getting TVs in a Resource is a bit more complex, since there are a possible unlimited # of TVs. However, you can do so in your loop:
foreach ($resources as $resource) {
$templateVars =& $resource->getMany('TemplateVars');
foreach ($templateVars as $tvId => $templateVar) {
$tvs[$templateVar->get('name')] = $templateVar->get('value');
}
$resourceArray = array_merge($resource->toArray(),$tvs);
$itemOutput .= $modx->getChunk($itemTemplate, $resourceArray);
}
If you want to process those TVs (ie, process any tags within them, but it takes up more processing time and memory), you can do:
$tvs[$templateVar->get('name')] = $templateVar->renderOutput($resource->get('id'));
instead. If the whole purpose of your snippet is to iterate over Resources, though, I’d recommend using the getResources Extra, as it’ll be far better and more up-to-date than most ad-hoc snippets.