@cbaone
Yes this is intentional, the relationship between two documents is based on the document ID rather than the pagetitle. The reason is that, when using tagging, if the pagetitle is changed then any links to it could potentially be lost. But why go to the bother in this instance which seems simple? Well, imagine you want to output a list of all products that have been tagged with size ’small’, or all products which are size ’large’ and color ’blue’ - either in the Manager as a TV or as part of some custom search filter on the front end. This is tagging, and so you should use be using Related to make sure that when the client wants to change ’blue’ to ’aquamarine’ and small to ’S’, the code doesn’t break.
One solution would be to use a Ditto call for each of the tvs, something like this:
[!Ditto? &documents=`[*size*]` &depth=`1` &display=`all` &sortBy=`pagetitle` &sortDir=`ASC`&tpl=`RowTpl`!]
However, that sucks because you’d need 4 Ditto calls. Typically if I was doing this I’d write a quick snippet to run a single Ditto call and loop through the returned values, grabbing the pagetitle using the GetField snippet. However, I appreciate this isn’t easy for everyone to do.
Another solution would be to use PHX to modify the tv values in the Ditto row template with a custom modifier, eg:
<tr>
<td>[+size:getPagetitle+]</td>
<td>[+color:getPagetitle+]</td>
<td>[+shape:getPagetitle+]</td>
<td>[+texture:getPagetitle+]</td>
</tr>
The phx custom modifier, (a snippet which I’d call phx:getPagetitle) would look something like this:
<?php
$pagetitle= $modx->runSnippet('GetField', array("docid"=>$output)); // GetField returns pagetitle by default
return $pagetitle;
?>
You’d need to add this to your Ditto call for phx to work insdie the Ditto template:
&hiddenFields=`size,color,shape,texture`
Want to give it a shot, see how it works? Or - do you think I should offer a wrapper for Ditto built into Related that does this automatically?
Mark