@EVAL return $modx->runSnippet('listProducts',array('parent:IN' => array(2,76)));
$c = $modx->newQuery('modResource'); $parents = $modx->getOption('parents', $scriptProperties, '2,76', true); $parents = explode(',', $parents); $c->where(array( 'parent:IN' => $parents, )); $resArray = $modx->getCollection('modResource', $c); if (empty($resArray)) { return 'No products found'; } foreach($resArray as $res) { $resources[] = $res->get('pagetitle') . '==' . $res->get('id'); } $out = implode("||",$resources); return $out;
This question has been answered by cottoncreative. See the first response.
@EVAL return $modx->runSnippet('listProducts',array('parents' => '2,76', 'skip' => 3,22,43));
$c = $modx->newQuery('modResource'); $parents = $modx->getOption('parents', $scriptProperties, '2,76', true); $parents = explode(',', $parents); $skip = $modx->getOption('skip', $scriptProperties, '12,33,44', true); $skip = explode(',', $skip); $c->where(array( 'parent:IN' => $parents, )); $resArray = $modx->getCollection('modResource', $c); if (empty($resArray)) { return 'No products found'; } foreach($resArray as $res) { $docId = $res->get('id'); if (in_array($docId, $skip)) { continue; } $resources[] = $res->get('pagetitle') . '==' . $docId; } $out = implode("||",$resources); return $out;
@EVAL return $modx->runSnippet('listProducts',array('parent:IN' => array(2,76), 'skip:IN' =>array(12, 33, 44)));
$c = $modx->newQuery('modResource'); $parents = $modx->getOption('parents', $scriptProperties, '2,76', true); $parents = explode(',', $parents); $skip = $modx->getOption('skip', $scriptProperties, '12,33,44', true); $skip = explode(',', $parents); $c->where(array( 'parent:IN' => $parents, 'skip:IN' => $parents, )); $resArray = $modx->getCollection('modResource', $c); if (empty($resArray)) { return 'No products found'; } foreach($resArray as $res) { $resources[] = $res->get('pagetitle') . '==' . $res->get('id'); } $out = implode("||",$resources); return $out;
@EVAL return $modx->runSnippet('listProducts',array('parents' => '2,76', 'skip' => 3,22,43));
$c = $modx->newQuery('modResource'); $parents = $modx->getOption('parents', $scriptProperties, '2,76', true); $parents = explode(',', $parents); $skip = $modx->getOption('skip', $scriptProperties, '12,33,44', true); $skip = explode(',', $skip); $c->where(array( 'parent:IN' => $parents, )); $resArray = $modx->getCollection('modResource', $c); if (empty($resArray)) { return 'No products found'; } foreach($resArray as $res) { $docId = $res->get('id'); if (in_array($docId, $skip)) { continue; } $resources[] = $res->get('pagetitle') . '==' . $docId; } $out = implode("||",$resources); return $out;
$skip = explode(',', $parents);
$skip = explode(',', $skip);
$c = $modx->newQuery('modResource'); $parents = $modx->getOption('parents', $scriptProperties, '2,76', true); $parents = explode(',', $parents); $skip = $modx->getOption('skip', $scriptProperties, '12,33,44', true); $skip = explode(',', $skip); $c->where(array( 'parent:IN' => $parents, 'parent:NOT IN' => $skip, )); $resArray = $modx->getCollection('modResource', $c); if (empty($resArray)) { return 'No products found'; } $resources = array(); foreach($resArray as $res) { $docId = $res->get('id'); $resources[] = $res->get('pagetitle') . '==' . $docId; } $out = implode("||",$resources); return $out;
@EVAL return $modx->runSnippet('listProducts',array('parents' => '2,76', 'skip' => '166,71,74,98,73,75,76,77'));
$c = $modx->newQuery('modResource'); $parents = $modx->getOption('parents', $scriptProperties, '2', true); $parents = explode(',', $parents); $skip = $modx->getOption('skip', $scriptProperties, '77', true); $skip = explode(',', $skip); $c->where(array( 'parent:IN' => $parents, )); $resArray = $modx->getCollection('modResource', $c); if (empty($resArray)) { return 'No products found'; } foreach($resArray as $res) { $docId = $res->get('id'); if (in_array($docId, $skip)) { continue; } $resources[] = $res->get('pagetitle') . '==' . $docId; } $out = implode("||",$resources); return $out;
array( [0] => "77" )