And whilst the page returns results, none of the placeholders in the chunk are returned. I have prefixed all the placeholders with advsearch. but still nothing comes back.
``
There is nothing in the error log to suggest the issue.
My snippet is:
``
*
* Query hook
*
*/
/*
Main class:
package - The name of the schema Package to add. e.g: dvd
packagePath - The path to the model/ directory where the package is located. Use {core_path} as generic variable.
class - The class name of the table you want to search. e.g: dvd
and optionally (these parameters could be passed thru the snippet call):
withFields - A comma-separated list of column names where to search.
fields - A comma-separated list of column names to display.
ids - A comma-separated list of primary keys to filter where the search should occurs.
where - criteria or Array of criteria. e.g: "studio IN ('20th Century Fox','DreamWorks Home Ent.','Warner Bros') "
sortby - csv list of couple 'columnName (ASC| DESC)'.
*/
$main = array(
'package' => 'lettings',
'packagePath' => '{core_path}components/lettings/model/',
'class' => 'Lettings',
'fields' => 'feature_image , street , town , county , price , bedrooms , property_type , heating , furnish , availability , status', // displayed
'withFields' => 'property_name , town , bedrooms , property_type , generic_property_type , bedrooms , price', // where we do the search
'where' => '(`Lettings`.`published` = 1)',
'sortby' => 'Lettings.price DESC',
'tablePrefix' => 'tls_'
);
$andConditions = array(
'Lettings.town:=' => 'town:request:all',
'Lettings.generic_property_type:=' => 'generic_property_type:request:all',
'Lettings.price:>=' => 'min-price:request:none',
'Lettings.price:<=' => 'max-price:request:none',
'Lettings.bedrooms:=' => 'bedrooms:request:all'
);
//$main['tablePrefix'] = 'modx_';
// set the query hook declaration
$qhDeclaration = array(
'qhVersion' => '1.2', // version of queryHook - to manage futures changes
'main' => $main,
'andConditions' => $andConditions
);
$hook->setQueryHook($qhDeclaration);
return true;``
Please could you suggest a resolution.
Well, I was just trying to help so you can submit readable ModX code segments in markdown, which in turn would help you to get meaningful answers.
Regarding your issue: I've had lot of problems with v2.0.0-beta2 around not handling extracts properly. I have lot of fixes in my local repo, but haven't got the time yet to make PRs for them. I'll take a look at some point and I may be able to help or at least to explain why is it not working.
Will keep an eye out for this ticket.
For reference:
Your snippet:
<?php
/**
* AdvSearch
*
* Copyright 2012 by Coroico <coroico@wangba.fr>
*
* Query hook
*
*/
/*
Main class:
package - The name of the schema Package to add. e.g: dvd
packagePath - The path to the model/ directory where the package is located. Use {core_path} as generic variable.
class - The class name of the table you want to search. e.g: dvd
and optionally (these parameters could be passed thru the snippet call):
withFields - A comma-separated list of column names where to search.
fields - A comma-separated list of column names to display.
ids - A comma-separated list of primary keys to filter where the search should occurs.
where - criteria or Array of criteria. e.g: "studio IN ('20th Century Fox','DreamWorks Home Ent.','Warner Bros') "
sortby - csv list of couple 'columnName (ASC| DESC)'.
*/
$main = array(
'package' => 'lettings',
'packagePath' => '{core_path}components/lettings/model/',
'class' => 'Lettings',
'fields' => 'feature_image , street , town , county , price , bedrooms , property_type , heating , furnish , availability , status', // displayed
'withFields' => 'property_name , town , bedrooms , property_type , generic_property_type , bedrooms , price', // where we do the search
'where' => '(`Lettings`.`published` = 1)',
'sortby' => 'Lettings.price DESC',
'tablePrefix' => 'tls_'
);
$andConditions = array(
'Lettings.town:=' => 'town:request:all',
'Lettings.generic_property_type:=' => 'generic_property_type:request:all',
'Lettings.price:>=' => 'min-price:request:none',
'Lettings.price:<=' => 'max-price:request:none',
'Lettings.bedrooms:=' => 'bedrooms:request:all'
);
//$main['tablePrefix'] = 'modx_';
// set the query hook declaration
$qhDeclaration = array(
'qhVersion' => '1.2', // version of queryHook - to manage futures changes
'main' => $main,
'andConditions' => $andConditions
);
$hook->setQueryHook($qhDeclaration);
return true;
Recently upgraded this extra and now I am not getting any results in my output.
Site is running on MODX 2.7.3, PHP 7.3 and Zend libraries included
I am using the following call on my results page:
[[!AdvSearch? &queryHook=`propertyQHook` &showExtract=`1:price` &containerTpl=`propertyAdvSearchResults` &tpl=`SearchResultTpl` &perPage=`5` ]]
And whilst the page returns results, none of the placeholders in the chunk are returned. I have prefixed all the placeholders with advsearch. but still nothing comes back.
Below is an extract from my chunk:
``
Property Type: [[+advsearch.property_type:ucwords]]
[[+advsearch.heating]]
[[+advsearch.furnish]]
Availability: [[+advsearch.availability:strtotime:date=`%e %b %Y`]]
Can you please wrap your code blocks in double or triple backtick, so they are readable?
So to display this:
[[!AdvSearch? &queryHook=`propertyQHook`...
type this:``` [[!AdvSearch? &queryHook=`propertyQHook`... ```
.It'd be easier to help if decoding of your code was not an issue. ;)
OK - I've updated it. Does that work? Or I can add a file instead
Could benefit the other two code sections too, since those are hard to read as well right now.
snippet.txt extract-from-chunk.txt
Well, I was just trying to help so you can submit readable ModX code segments in markdown, which in turn would help you to get meaningful answers.
Regarding your issue: I've had lot of problems with v2.0.0-beta2 around not handling extracts properly. I have lot of fixes in my local repo, but haven't got the time yet to make PRs for them. I'll take a look at some point and I may be able to help or at least to explain why is it not working.
Will keep an eye out for this ticket.
For reference: Your snippet:
And the extract from the chunk:
By the way, which chunk is it from?
The &tpl chunk
Ended up rolling back to version 1.0.1 as I need the chunk to render the results.