[!AjaxSearch? &landingPage=`6` &ajaxSearch=`0` &showResults=`0` &showIntro=`0` &addJscript=`0` &tplInput=`@FILE:assets/snippets/ajaxSearch/templates/custom/search-form-hdr.html` !]
[!AjaxSearch? &showInputForm=`0` &ajaxSearch=`0` &showIntro=`0` &pagingType=`0` &highlightResult=`0` &grabMax=`20` &rank=`pagetitle:50,alias:20` &filter=`template,9,2|template,7,2` &tplInput=`@FILE:assets/snippets/ajaxSearch/templates/custom/search-form-pg.html` &tplGrpResult=`@FILE:/assets/snippets/ajaxSearch/templates/custom/grpResult.html` &tplResult=`@FILE:/assets/snippets/ajaxSearch/templates/custom/result.html` &tplResults=`@FILE:/assets/snippets/ajaxSearch/templates/custom/results.html` &tplPaging0=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging0.html` &tplPaging1=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging1.html` &tplPaging2=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging2.html` !]
On one page I have an html table displaying 3 productsCould you check some things:
FDP16
FDPS16
FDPI19
Searching FDP16 and FDPI19 yield’s no results - whereas Searching FDPS16 works.
[!AjaxSearch? &landingPage=`6` &ajaxSearch=`0` &showResults=`0` &showIntro=`0` &addJscript=`0`Here, as the non-ajax mode is set, &addJscript=`0` is useless.
&tplInput=`@FILE:assets/snippets/ajaxSearch/templates/custom/search-form-hdr.html`
!]
[!AjaxSearch? &showInputForm=`0` &ajaxSearch=`0` &showIntro=`0` &pagingType=`0` &highlightResult=`0` &grabMax=`20`&tplPaging1=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging1.html`
&rank=`pagetitle:50,alias:20`
&filter=`template,9,2|template,7,2`
&tplInput=`@FILE:assets/snippets/ajaxSearch/templates/custom/search-form-pg.html`
&tplGrpResult=`@FILE:/assets/snippets/ajaxSearch/templates/custom/grpResult.html`
&tplResult=`@FILE:/assets/snippets/ajaxSearch/templates/custom/result.html`
&tplResults=`@FILE:/assets/snippets/ajaxSearch/templates/custom/results.html`
&tplPaging0=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging0.html`
&tplPaging1=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging1.html`
&tplPaging2=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging2.html`
!]
FDP16 and FDPI19 have the same template file as FDPS16Yes, all 3 product items have the same template.
these templates aren’t the template #7 or #9Well all 3 product items do use template #7 but they are not displayed on individual product pages - they are displayed collectively from a wayfinder menu call in an html table on their parent page which uses template #8 (as per this link
http://propipesupplies.com.au/products/pro-pipe/flexible-drain-pipe.html
the documents are searchable and published and publicYes, all 3 items are searchable and published - (show in menu is unchecked for all 3).
Well all 3 product items do use template #7 but they are not displayed on individual product pages
&filter=`template,9,2|template,7,2`By using &filter=`template,7,2` you exclude all the documents related with the template #7. So the search doesn’t occur in documents FDP16, FDPS16, FDPI19
Searching for info from their descriptions such as:I think that "Corrugated Flexible" and "Smooth Bore Flexible" works because you have the word "flexible" in the description of your parent page "Flexible Drain Pipe". The search doesn’t occur in the content of this page (the html table of products) but only in the pagetitle and/or description (default fields where the search occurs).
- "Corrugated" returns no results where as searching for "Corrugated Flexible" works
- "Smooth Bore" returns no results where as searching for "Smooth Bore Flexible" works
<?php $id = (isset($id)) ? $id : $modx->documentIdentifier; // get the id of the document $parent = $modx->getParent($id); // get the parent information $url = $modx->makeUrl($parent['id']); // make a link to the parent echo $url; // display the link ?>
<a class="[+as.resultLinkClass+]" href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
<a class="[+as.resultLinkClass+]" href="[[GetCategoryLink? &id=`[+as.id+]`]]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
[!AjaxSearch? &showInputForm=`0` &ajaxSearch=`0` &showIntro=`0` &pagingType=`0` &highlightResult=`0` &grabMax=`20` &rank=`pagetitle:50,alias:20` &tplInput=`@FILE:assets/snippets/ajaxSearch/templates/custom/search-form-pg.html` &tplGrpResult=`@FILE:/assets/snippets/ajaxSearch/templates/custom/grpResult.html` &tplResult=`@FILE:/assets/snippets/ajaxSearch/templates/custom/result.html` &tplResults=`@FILE:/assets/snippets/ajaxSearch/templates/custom/results.html` &tplPaging0=`@FILE:/assets/snippets/ajaxSearch/templates/custom/paging0.html` !]
« MODx Parse Error » MODx encountered the following error while attempting to parse the requested resource: « `` is not numeric and may not be passed to makeUrl() » Parser timing MySQL: 0.0388 s (8 Requests) PHP: 0.1438 s Total: 0.1825 s
<a href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
&withTvs=`+:xysearchlink` &withTvs=`xysearchlink`
<a href="[+xysearchlink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
[+phx:if=`[+xysearchlink+]`:isnot=``:then=`<a href="[+xysearchlink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>`:else=`<a href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>`+]
[+phx:if=`[+xysearchlink+]`:is=``:then=`<a href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>`:else=`<a href="[+xysearchlink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>`+]
<a href="[[Ditto? &documents=`[+as.id+]` &tpl=`ajaxsearch-link`]]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
Thank you so much - this sounds like a great solution but is throwing the following error whenApologies, the correct code should be:
<a href="[[GetCategoryLink? &id=`[+as.id+]`]]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
is in the custom result.html file
<?php $id = (isset($id)) ? $id : $modx->documentIdentifier; // get the id of the document $parent = $modx->getParent($id); // get the parent information $url = $modx->makeUrl($parent['id']); // make a link to the parent echo $url; // display the link ?>
At some point I obviously don’t want the child document to be linked to its parent, otherwise every page would link further up the chain wouldn’t it? See the attached image of the tree (it’s pretty deep and complex - some products are on their own page while some are combined with others).Ok I understand.
What I would like to do is only apply the "ppsearchlink" TV to docs with the Template 7 or 9, and to everything else (eg if the TV is empty / non existant) serve up:Rather to add a TV in each product may be it could be better to retreive the category document by an another way. What are the difference between the category product document and a product document ? May be the category product document use a specific template which is not the same used by the children documents ? If it is the case, by modifying the GetCategoryLink snippet, starting from any document, we could search a document in the upper hierarchy with this template number. If this document is found, the snippet return the link to the category otherwise run as usual and return the link to the current document. Is it possible to do this distinction between documents ?
Code:
<a href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>