Quote from: damonwilliams at Mar 27, 2013, 12:31 PMHello Bruno,
Thanks for the reply. My issue basically revolves around how to go about implementing this groupResources technique with getPage so that I can use it in conjunction with paginated resources.
Reference my original post about it https://forums.modx.com/thread/69754/getresources---group-results?page=2#dis-post-459550. If you have any further questions on it from me or any additional code please do not hesitate to ask and I shall get back to you asap as I'd really like to find a solution.
Thanks in advance!
This might help, I modified one of the snippets poster earlier to make this one. It will let you run any snippet and group its output for every nth child.
Here is the snippet code
<?php
$output = '';
$groupTag = $scriptProperties['groupTag'];
$snip = $scriptProperties['snippet'];
if(!isset($scriptProperties['outputSeparator'])) {
$scriptProperties['outputSeparator'] = '||';
}
if(!isset($groupTag)) {
$groupTag = 'ul';
}
if(isset($scriptProperties['groupClass'])) {
$markupOpen = $groupTag.' class="'.$scriptProperties['groupClass'].'"';
} else {
$markupOpen = $groupTag;
}
$rows = $modx->runSnippet($snip, $scriptProperties);
$rows = explode($scriptProperties['outputSeparator'],$rows);
$numItems = count($rows);
foreach ($rows as $i => $row) {
$output .= $row;
if ($i == 0){
echo '<'.$markupOpen.'>';
}
if (($i + 1) % $scriptProperties['group'] == 0) {
if($i != $numItems-1) {
$output .= "\n</".$groupTag.">\n<".$markupOpen.">\n";
} else {
$output .= "\n</".$groupTag.">\n";
}
}
}
return $output;
This is the snippet call
[[!GroupSeperator? &groupTag=`div` &groupClass=`row` &group=`3` &snippet=`getPage` &...getpage properties...]]
so i guess your snippet call should look something like this.
[[!GroupSeperator?
&groupTag=`div`
&groupClass=`row`
&snippet=`getPage`
&elementClass=`modSnippet`
&element=`getResources`
&parents=`[[*id]]`
&limit=`32`
&sortby=`RAND()`
&includeContent=`0`
&includeTVs=`1`
&showHidden=`1`
&hideContainers=`1`
&tpl=`shopRowTpl`
]]
[[!+page.nav:notempty=`<div class="paging"><div class="page-list">[[!+page.nav]]</div></div>`]]
I may not be of much use if it throws a bnch of nonsense at you but I have it running on a getpage call and also using minishop, and it works just fine.