Created
December 24, 2013 08:47
-
-
Save goldsky/8110511 to your computer and use it in GitHub Desktop.
Count how many resources which have specified TV that has specified value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$name = $modx->getOption('name', $scriptProperties); | |
$value = $modx->getOption('value', $scriptProperties); | |
if (empty($tvName) || empty($value)) { | |
return; | |
} | |
$tvObj = $modx->getObject('modTemplateVar', array( | |
'name' => $name | |
)); | |
if (!$tvObj) { | |
return; | |
} | |
$tv2Res = $tvObj->getMany('TemplateVarResources', array( | |
'value:LIKE' => "%$value%" | |
)); | |
return count($tv2Res); |
Unfortunately I can't get this working - how have you setup your TV?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[[tvCounter? &name=
product-category&value=
accessories]]