-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I am using the following queryHook to get custom search results:
$main = array(
'package' => 'modx',
'packagePath' => '{core_path}model/',
'class' => 'modResource',
'fields' => 'pagetitle',
'withFields' => 'pagetitle',
'sortby' => 'scProductMeta.price DESC',
'tablePrefix' => 'hsx_'
);
$joined = array(
array(
'package' => 'simplecartresource',
'packagePath' => '{core_path}components/simplecart/model/',
'class' => 'scProductMeta',
'withFields' => 'price,image',
'fields' => 'price,image',
'joinCriteria' => 'modResource.id = scProductMeta.resource',
'tablePrefix' => 'hsx_'
)
);
$andConditions = array(
'modResource.class_key:=' => 'scProductResource'
);
// set the query hook declaration
$qhDeclaration = array(
'qhVersion' => '1.3', // version of queryHook - to manage futures changes
'main' => $main,
'joined' => $joined,
'andConditions' => $andConditions
);
$hook->setQueryHook($qhDeclaration);
return true;
Debugging information show that it is returning the correct search results with the joined fields scProductMeta_image and scProductMeta_price. However in my resultsTpl the placeholders are empty:
[[+advsearch.scProductMeta_image]] - [[+advsearch.scProductMeta_price]]
Investigating further where the fields are dropped, the debugging information shows
advsearchresults.class.php : 556: [AdvSearch] Config parameters after checking in class AdvSearchResults: Array (
...
[fields] => pagetitle,
[withFields] => pagetitle
...
)
Any ideas, why the joined fields are getting dropped although the query returns the correct results?
MODx 2.5.0
Metadata
Metadata
Assignees
Labels
No labels