[[!solr?&fabricant_facet=`XYZ`& product_type =`HPLC`&rows=`500`]]
This question has been answered by BobRay. See the first response.
[[!ShowSolr]]
/* ShowSolr Snippet */ $doc = $modx->resource; $thisParent = '##'; // Set this here. maybe borrowing the code from the other snippet // that used to set the placeholder $fields = array( 'fabricant_facet' => $doc->get('pagetitle'), 'product_type' => $thisParent, 'rows' => `500`, ); return $modx->runSnippet('solr', $fields);
Make sure the snippet that sets the +thisParent placeholder is above the solr snippet tag on the page.
It sounds like you're nesting pretty deeply there, which is always risky.
You could try something like this. If it works it would I think it would be faster.
Replace your solr tag with this:
[[!ShowSolr]]
Then create a snippet called ShowSolr with this code:
<?php /* ShowSolr Snippet */ // on récupère $rows comme paramètre passé à cette fction $doc = $modx->resource; $id = $modx->resource->get('id'); $parentsIds = $modx->getParentIds($id, 2); $thisParentID = $parentsIds[0]; /* Get the parent object */ $thisParentObj = $modx->getObject('modResource', $thisParentID); /* If we have the parent, get and return the pagetitle */ if ($thisParentObj) { $output = $thisParentObj->get('pagetitle'); $thisParent = $output; $modx->setPlaceholder('thisParent',$output); } $thisGDParent = $parentsIds[1]; $thisGDParentObj = $modx->getObject('modResource', $thisGDParent); if ($thisGDParentObj) { $output = $thisGDParentObj->get('pagetitle'); $modx->setPlaceholder('thisGDParent',$output); } // $thisParent = '##'; Set this here. maybe borrowing the code from the other snippet // that used to set the placeholder $fields = array( 'fabricant_facet' => $doc->get('pagetitle'), 'product_type' => $thisParent, 'rows' => $rows, //'rows' => `$rows`, ); return $modx->runSnippet('solr', $fields);
We are in the magic area where coding is no more an exact science.