1. $resourceId = id ресурса
$q = $modx->newQuery('modTemplateVarResource');
$q->leftJoin('modTemplateVar','modTemplateVar',array("modTemplateVar.id = tmplvarid"));
$q->where(array('contentid'=>$resourceId));
$q->select($modx->getSelectColumns('modTemplateVarResource','modTemplateVarResource','',array('id','tmplvarid','contentid','value')));
$q->select($modx->getSelectColumns('modTemplateVar','modTemplateVar','',array('name')));
$tvObjects = $modx->getCollection('modTemplateVarResource',$q);
$out = [];
foreach ($tvObjects as $item) {
$tvArray = $item->toArray();
$out[$tvArray['name']] = $tvArray['value'];
}
echo "<pre>";
print_r($out);
echo "</pre>";