Hi Paul,
What I am trying to do is have a dropdown that lists the categories and have achieved this via ditto. however is someone searches by ( for example )Heart of england it is still displaying all hotels across all locations and its driving me mad.
If I understand your request, you would like a dropdown menu with a list of location and when a location is selected, get the hotels of the location. Is it a correct understanding ?
If No. Apologies, I don’t undertsand
If yes, try to do as follow:
1/ create a TV named location
2/ for each document of a category initialize the location with the name of location. For instance "Heart of England"
3/ use &searchWordList=`locationList` &tplLayout=`optionMultipleList` &whereSearch=`content:NULL|tv` &config=`location`
Create a chunk optionMultipleList by copy/paste the template of templates/optionMultipleList/layout.inc.tpl
By using content:NULL|tv you search only in the tv. content fields are avoid.
4/ create a file configs/location.inc.php with:
<?php
if(!function_exists('locationList')) {
function locationList($p){
// get the location list from Dtto
$params['parents'] = 1; // set the root Id of your document tree
$params['depth'] = 1;
$list = $modx->runSnippet('Ditto', $params);
return $list;
}
?>or if your document tree hasn’t a unique id as root
<?php
if(!function_exists('locationList')) {
function locationList($p){
// get the location list from Dtto
$params['documents'] = '1,15,25,76'; // set here the Id list of location container
$list = modx->runSnippet('Ditto', $params);
return $list;
}
?>
I not sure of the ditto parameters, but this seems like that.
The nearest example on the demo site seems to be at :
http://www.modx.wangba.fr/index.php?id=259.