We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3943
    • 8 Posts
    Hi,

    I'm playing with queryHook and cannot get past the problem of filtering the results inside Articles container.

    How should I approach this problem?

    Advsearch is searching just fine with getIds snippet inside the mentioned container.
    • Can you post your hook code?
        MODX Ambassador (NL) & Professional MODX developer
        Follow me on Twitter | Visit my page on Facebook | View my code on Github | View my script posts
        MODX e-commerce solution SimpleCart
        • 3943
        • 8 Posts
        $andConditions = array(
          'modResource.id:=' => 'category:request:all',
          //'tv.story-details-manufacturer:=' => 'manufacturer:request:all',
          //'tv.story-details-model:=' => 'model:request:all',
          //'tv.story-details-country:=' => 'country:request:all',
          //'tv.story-details-country:MATCH' => 'country:request:all',
          //'tv.story-details-city:=' => 'city:request:all',
          //'tv.story-details-spotter:LIKE' => '%spotter%:request'
          //'modResource.publishedon' => 'timeadded:request'
        );
        
        $sortby = 'sort';
        
        $qhDeclaration = array(
          'qhVersion' => '1.2',
          'andConditions' => $andConditions,
          'sortby' => $sortby,
        );
        
        $hook->setQueryHook($qhDeclaration);
        return true;
        


        What's strange, it doesn't even work when I put constant value like
        'modResource.id:=' => '9:numeric'
        .

        My resource tree is defined as:
        - Home
        - Story (simple hidden resource container)
        - Events (ArticleContainer)
        - Spots (ArticleContainer)
        - Photoshoots (ArticleContainer)
        - Others (ArticleContainer)
        • Shouldn't that be:
          'modResource.id:=' => 9