We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8425
    • 159 Posts
    Hi,
    I'm using MODx Rev 2.1.5. I'm having a problem using queryHook.
    Here is my code snippet
    [[!AdvSearch? 
         &queryHook=`testFilterHook` 
         &ids=`[[!GetIds? &ids=`c35`]]` 
         &includeTVs=`image, available, name, topics, eventTypes, fees, location`        
         &withTVs=`topics, eventTypes, fees, location` 
         &highlightTag=`strong` 
         &tpl=`itemTpl` 
         &sortby=`name` 
         &withFields=``
    ]]

    The queryHook looks like
    $andConditions = array(
           'tv.topics:LIKE'      => 'topic:request:all',
           'tv.eventTypes:LIKE'  => 'event:request:all',
           'tv.location:LIKE'    => 'location:request:all'
        );
    
    $qhDeclaration = array(
           'qhVersion'     => '1.1',
           'andConditions' => $andConditions
        );
    
    $hook->setQueryHook($qhDeclaration);
    
    return true;

    The problem is that the TV topics is a textArea and if the contents is not exactly the same as the request parameter sent over via the form the search doesn't work.
    I need to do a LIKE search but I can't get it to work unless the string are identical. I need also the same behavior for lists.
    I tried the following but to no avail. What am i doing wrong?
    Thanks for your help.
    $topic = strip_tags($_REQUEST['topics']);
    $andConditions = array(
           'tv.topics:LIKE'      => '%'.$topic.'%:string',
    
    [ed. note: eclipseTalk last edited this post 14 years, 8 months ago.]
      • 8425
      • 159 Posts
      I had a few emails exchange with Coroico. He's been extremely useful in helping me out.
      The AdvSearch 1.0.0 pl is now released and it fixed my issues by using the queryHook 1.2.
      Thanks again Coroico for your great work!