in a resource directly, you need [*...........*] instead of [+..........+]. And yes, this works then only, if you have phx installed, without ditto.
So you have several ways to do it now.
1. Use Ditto to list the content of your main-resource. So you can use the same chunk.
[!Ditto? &documents=`[*id*]` &tpl=`.....` ..........!]
2. install phx and use two different chunks for ditto and normal content.
3. install phx and use one chunk for both in some way like that:
<div class="product_data">
[+content:isnot=``:then=`[+content+]`:else=`[*content*]`+]
[+size:isnot=``:then=`<h6>Size: </h6>[+size+]`+]
[*size:isnot=``:then=`<h6>Size: </h6>[*size*]`*]
[+weight:isnot=``:then=`<h6>Weight: </h6>[+weight+]`+]
[*weight:isnot=``:then=`<h6>Weight: </h6>[*weight*]`*]
</div>
4. use your snippet and two different chunks:
$tv = $modx->getTemplateVarOutput(array('size','weight'));
$output='';
if (!empty($tv['size'])) {
$output.= "<h6>Size: </h6>" . $tv['size'];
}
if (!empty($tv['weight'])) {
$output.= "<h6>Weight: </h6>" . $tv['weight'];
}
return $output;
of course there are a lot of more ways to get there.