Hi Bruno many thanks for the reply.
As I'm still getting to grips with ModX I'm a little unsure what the above is doing.
I've created the snippet and changed the 'tvname' in the first line:
<?php
$tvname = $modx->getOption('stockists', $scriptProperties, '');
$docid = $modx->getOption('docid', $scriptProperties, $modx->rescource->get('id'));
$value = '';
$classname = 'modTemplateVar';
if ($object = $modx->getObject($classname, array('name' => $tvname))) {
$tvid = $object->get('id');
$classname = 'modTemplateVarResource';
if ($object = $modx->getObject($classname, array('contentid' => $docid, 'tmplvarid' => $tvid))) {
$value = $object->get('value');
}
}
$values = !empty($value) ? explode('||',$value) : array();
return count($values);
and am calling it in a chunk (productBoxStockist):
<div class="stockistListBox">
[[count_options:is=`1`:then=`<p>insert text:</p>`:else=`<p>insert this text</p>`? &docid=`[[+id]]` &tvname=`stockists`]]
<ul>
[[+tv.stockists]]
</ul>
</div>
which is then called in the resource as a getResource:
[[!getResources? &parents=`2` &depth=`1` &limit=`0` &tpl=`productBoxStockist` &includeContent=`1` &includeTVs=`1` &processTVs=`1` &showHidden=`1` &sortby=`menuindex` &sortDIR=`DESC`]]
It currently shows nothing on the page, even removes the all the page content but I don't really know where to begin to look as there aren't an errors being shown in the snippet code.
If you could either give me some more hints or point me in the direction of what I should research to help me figure it out I'd be most appreciative.