<![CDATA[ RELATED PAGES TV DISPLAY IMAGES??? - MODX Community Forums]]> https://forums.modx.com/thread/?thread=70087 <![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=3#dis-post-534485 Thank you very much for a clever solutions.
I see already a lot of improvments for my installations using migx.]]>
murias Nov 17, 2015, 07:55 AM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=3#dis-post-534485
<![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-534480
@CHUNK inputoptionsProducts

in that chunk 'inputoptionsProducts':


Bruno17 Nov 17, 2015, 05:45 AM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-534480
<![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-534478 I have the same challenge as Cotton.
How can I show several parents in the listProducts snippet?

Was this question ever answered? If so, I really would like to know.

Thanks in advance.
murias Nov 17, 2015, 05:13 AM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-534478
<![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-526796
I'm also using the tutorial and have the same problems as the OP. Following this thread I've been able to get the TVs from various resources to be pulled in but cannot get the checkbox list to show multiple parents. I noticed Zorba had the same problem and resolved it by
Got it! The list of check boxes is back - I found the wrong ID being referenced in the listMyResources snippet.
but I can only seem to get one of three parents I wish to use to show. I'm sure it'll be something very simple but I can't see what I'm missing?

I realise I'm only calling one parent in the listProducts snippet but thought that was just a fallback if it can't find the children of other parents. When I change that parent ID to 4, 5 or 6 the checklist shows the corresponding children but not all three parents together. Does that need to be an array too?

Here are my pieces of code:

ListProducts Snippet
$parent = $modx->getOption('parent',$scriptProperties,5);
$parentObj = $modx->getObject('modResource',$parent);
if (!($parentObj instanceof modResource)) { return ''; }
$resArray = $parentObj->getMany('Children');
$resources = array();
foreach($resArray as $res) {
  if ($res instanceof modResource) {
    $resources[] = $res->get('pagetitle') . '==' . $res->get('id');
$out = implode("||",$resources);
return $out;

RelatedProducts snippet
if (empty($input)) { return 'This article is so unique, that we couldn\'t find anything related to it!'; }
$tpl = $modx->getOption('tpl',$scriptProperties,'relatedProductsTpl');
if ($modx->getChunk($tpl) == '') { return 'We found some related pages, but don\'t know how to present it.'; }
$ids = explode('||', $input);
$output = array();
foreach ($ids as $key => $value) {
  $resource = $modx->getObject('modResource',array(
    'published' => 1,
    'id' => $value));
  if ($resource instanceof modResource) {
    $ta = $resource->toArray();
    $tvs = $resource->getTemplateVars();
    foreach ($tvs as $tv) {
       $ta[$tv->get('name')] = $tv->get('value');
    $output[] = $modx->getChunk($tpl,$ta);
return implode('',$output);

relatedProducts TV input
@EVAL return $modx->runSnippet('listProducts',array('parent:IN' => array(4,5,6)));

Template snippet
[[relatedProducts? &input=`[[*relatedProducts]]` &tpl=`relatedProductsTpl`]]

relatedProductTpl chunk
<div class="productSliderItem" style="background: url('[[+productBackgroundImage]]') no-repeat; background-size:auto 100%;">
    <a href="[[~[[+id]]]]" title="[[+pagetitle]]">
        <div class="shake shake-slow">
            <img src="[[+productPack]]" />
        <div class="productSliderTitle">

Thanks in advance]]>
cottoncreative Jun 11, 2015, 08:50 AM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-526796
<![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-440893
hopefully there is a neat solution - "BabelResourceIdArray" that could be applied in conjunction with getresources


nickyz Oct 20, 2012, 03:37 PM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-440893
<![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-440880
@EVAL return $modx->runSnippet('getResources',array('parent' => 18));

I would like to make it work like this:

[[BabelTranslation? &resourceId=`18` &contextKey=`[[*context_key]]`]]

So I would like to take linked-translated parent '18'

any clues?]]>
nickyz Oct 20, 2012, 01:05 PM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-440880
<![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405973
You can't easily change the sort the way it's been coded now (or rather 3 months ago).. alternative method would be to instead of looping over the $ids var, to get a collection of objects (using $modx->getCollection) and using the sortby method on an xPDOQuery.

Bit too tired to do that now though, sorry tongue

If you're somewhat good with PHP you can figure it out using this doc: http://rtfm.modx.com/display/xPDO20/Retrieving+Objects (the getCollection and xPDOQuery ones mainly).]]>
markh Jan 05, 2012, 07:46 PM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405973
<![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405972 zorba2011 Jan 05, 2012, 07:24 PM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405972 <![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405971 I tried re-ordering the resources themselves but it made no difference to the output...I guess it's outputting them as it finds them in the database.]]> zorba2011 Jan 05, 2012, 07:23 PM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405971 <![CDATA[Re: RELATED PAGES TV DISPLAY IMAGES???]]> https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405968
Any idea why the publish check is being ignored when compiling the list of related pages? I tried changing

'published' => 1,

'published' => true,

'published' = '1',

...but it made no difference.

zorba2011 Jan 05, 2012, 07:01 PM https://forums.modx.com/thread/70087/related-pages-tv-display-images?page=2#dis-post-405968