We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21980
    • 6 Posts
    Hi,
    I'm facing a little problem with AdvSerach and Modx 2.2

    I've upgraded my Modx install 2.1.4 to 2.2.0.
    But now, all my Advsearch calls don't work.
    It's all the same chunks, snippets.
    I send the data with a GET method, and I call the results with :
    [[!AdvSearch? 
    &ids=`[[!GetIds? &ids=`c3,c4`]]` 
    &withFields=`` 
    &queryHook=`Query2hook` 
    &withTVs=`Prix,Type,Departement,Transaction,img_principal` 
    &includeTVs=`Prix,Type,Departement,Transaction,img_principal` 
    &perPage=`200` 
    &minChars=`2` 
    &hideContainers=`1`
    &method=`GET` ]]
    


    The Hook used is
    <?php
    $andConditions = array(
        'tv.Transaction:=' => 'transact:request:all', 
        'tv.Type:=' => 'type_bien:request:all',
        'tv.Departement:=' => 'departement:request:all',
        'tv.Prix:>=' => 'prixmin:request:none', 
        'tv.Prix:<=' => 'prixmax:request:none' 
    ); 
    $qhDeclaration = array( 
     'qhVersion' => '1.1',
     'andConditions' => $andConditions 
    ); 
    $hook->setQueryHook($qhDeclaration); 
    return true;
    


    With modx 2.1.4, it worked perfectly, but now with 2.2.0, it tells me that there's no results. I've tried to clear the cache, nothing happen

    Is it a bug or something changed in 2.2 ?

    PS : sorry for my bad english
      • 21980
      • 6 Posts
      So, after a little talk with Coroico, the man behind AdvSearch, The problem is solved.

      It wasn't a Advsearch problem, but Modx.

      After upgrading to 2.2.0, all the values of a certain tv were empty.
        • 12410
        • 353 Posts
        Hi Guys,
        Trying to get advsearch working in Modx2.2 and it must be down to a loss of vital brain cells on my part.

        I install advsearch via package management and did:
        go to the Zend Framework download page at http://framework.zend.com/download/current/
        register you and download the free Zend Framework. Minimal release is enough.
        if you haven’t a folder for libraries under assets/ create a folder libraries/ under assets/
        unzip you Zend package under the assets/libraries/ folder. This should create a subdirectory named "Zend" (assets/libraries/Zend)
        in this directory only the "search" directory and the "Exception.php" files are required. You could remove all the others files and directories.
        at the end you should have only the "Search" folder and the "Exception.php" file.

        and..

        MODx Revolution 2.0.8 or later***2.2
        PHP5 or later***yes
        UTF-8 charset**instyalled db at utf8 and any references to to latin1 in resultant database I alsochanged to utf8 (does utf general or utf unicode matter for advsearch?)
        php multi-bytes setting ON***yes "enabled"
        Zend Search class from Zend library (See installation chapter)**Yep
        Jquery 1.5.1 (provided with AdvSearch) **1.7.1


        ...so Zend is at [siteroot]/assets/libraries/Zend

        But no matter what demo I use at http://www.revo.wangba.fr/same-page.html I just cant get search results.

        [[!AdvSearchForm]]
        
        [[!AdvSearch? 
          &ids=`[[!GetIds? &ids=`c1`]]` 
          &perPage=`5`
        ]]
        


        Is there some other part of the procedure.

        Appreciate any help.
        THANKS!
          • 5811
          • 1,717 Posts
          The two snippet calls are correct.

          if the zend library is correctly installed
          if the GetIds snippet is installed
          if the document id has document children
          then this should work.

          If you already use a jquery library add &addJQuery=`0` in the advSearchForm snippet call.

          Check that you haven't a weird character between the parameters inside the snippet call. [ed. note: coroico last edited this post 12 years, 2 months ago.]
            • 12410
            • 353 Posts
            Yep was mising getIDs - Thanks. Works great...
              • 12410
              • 353 Posts
              Hi guys/coroico!

              Quick question! I have a multi language site with multiple language contexts en,fr,de,ru etc...On my search results page I try to use a condition with advsearch but it just doesn't work wrapped in a conditional:

              This works standalone:
              [[!AdvSearch? 
                &ids=`[[!GetIds? &ids=`c147`]]` 
                &tpl=`salesSearchResult`
               &contexts=`web` 
               &perPage=`10` 
              &pagingType=`2`
                &queryHook=`sales-hook` 
                &withTVs=`property_type,bedrooms` 
                &includeTVs=`property_area,property_price,service_type,property_ref,property_p_image,bathrooms,sq_ft`
                &sortby=`bedrooms` 
              ]]


              Trying to get this working i.e. different search results based on context:

              [[!If?
                 &subject=`[[*context_key]]`
                 &operator=`EQ`
                 &operand=`web`
                 &then=`
              
              [[!AdvSearch? 
                &ids=`[[!GetIds? &ids=`c147`]]` 
                &tpl=`salesSearchResult`
               &contexts=`web` 
               &perPage=`10` 
              &pagingType=`2`
                &queryHook=`sales-hook` 
                &withTVs=`property_type,bedrooms` 
                &includeTVs=`property_area,property_price,service_type,property_ref,property_p_image,bathrooms,sq_ft`
                &sortby=`bedrooms` 
              ]]
              `]]
              
              [[!If?
                 &subject=`[[*context_key]]`
                 &operator=`EQ`
                 &operand=`ru`
                 &then=`
              
              [[!AdvSearch? 
                &ids=`[[!GetIds? &ids=`c318`]]` 
                &tpl=`salesSearchResult`
               &contexts=`ru` 
               &perPage=`10` 
              &pagingType=`2`
                &queryHook=`sales-hook` 
                &withTVs=`property_type,bedrooms` 
                &includeTVs=`property_area,property_price,service_type,property_ref,property_p_image,bathrooms,sq_ft`
                &sortby=`bedrooms` 
              ]]
              `]]


              I have search results pages like:

              www.xyz.com/results
              www.xyz.com/fr/results
              www.xyz.com/ru/results...

              each one with different results as they are in different languages and hence different containers in modx.

              I also tried using output modifiers in case the IF extra was the cause. Any ideas please how to use advsearch in conditionals. Both work fine standalone.

              THANKS!
              [ed. note: howster last edited this post 12 years, 2 months ago.]
                • 5811
                • 1,717 Posts
                I added a demonstration with babel and multi-languages.
                Look after: http://www.revo.wangba.fr/multi-languages.html

                [[!AdvSearchForm? &tpl=`mlSearchForm`]]
                By default the current is used inside mlSearchForm. So by using:
                [[%select_category? &namespace=`wangba` &topic=`default`]]
                you get the correct label before the list box. Here the options of the listbox are not linked with the current context. wangba is a namespace for all the labels of the site. Look after the files mlSearchForm and mlSearchResult.

                For the results :
                &ids=`[[!GetIds? &ids=`c38,c39`]]` 
                You need to specify all the id notes whatever the language used.

                c38 => english documents under the "web" context
                c39 => french documents under the "french" context

                As for mlSearchForm, mlSearchResult use the current context to set up the appropriate labels:
                    <div><span class="flash">[[%category? &namespace=`wangba` &topic=`default`]]:</span> [[+articleCategory]]</div>
                    <div><span class="flash">[[%tags? &namespace=`wangba` &topic=`default`]]:</span><ul> [[+articleTags]]</ul></div>
                    <div><span class="flash">[[%mark? &namespace=`wangba` &topic=`default`]]:</span> [[+articleMark]]</div>


                &contexts=`french` 

                I don't know why (for the moment) but you need to specify &contexts=`french` with the french search to search only inside the french documents (below c39). I thought that it was by default the current context. I need to check why this is not the case.

                Hope this demo help you. [ed. note: coroico last edited this post 12 years, 2 months ago.]
                  • 12410
                  • 353 Posts
                  Thanks very much!
                    • 38676
                    • 2 Posts
                    Hi Guys,I have a problem...
                    I install:
                    AdvSearch 1.0.0 pl2
                    GetIds 1.0 pl
                    Zend 1.11
                    jquery-1.7.1.min.js
                    UTF-8 charset

                    on MODX Revolution 2.2.0-pl2 (traditional)

                    but AdvSearch request with &withAjax=`1` don`t work.
                    Simple request ( &withAjax=`0`) - it worked perfectly.

                    All I see when requesting withAjax=1, is waiting for the animation.Then nothing happens.
                    My code
                    [[!AdvSearchForm? 
                      &withAjax=`1`
                      &ajaxResultsId=`5`
                      &addJQuery=`0` //connection separately
                    ]]
                    [[!AdvSearch? 
                      &ids=`[[!GetIds? &ids=`c5`]]`  
                      &perPage=`10`
                      &withTVs=`tags` 
                      &includeTVs=`tags`
                      &tpl=`myAdvSearchResult`
                      &withFields=``
                      &fields=`pagetitle,longtitle,link,id`
                      &withAjax=`1`
                    ]]
                      • 43774
                      • 3 Posts
                      hi coroico

                      i have a problem with the tpl-parameters. if i use this little call everything is fine:

                      [[!AdvSearchForm? 
                      &help=`0`
                      &addJs = `0`
                      &addCSS = `0`
                      &addJQuery = `0`
                      ]]
                      
                      [[!AdvSearch?
                      &pagingType=`2`]]


                      but when i add my own chunk for the results or for the extract the page don't displays any results. even if my chunks are a simple copy of the default.

                      [[!AdvSearch?
                      &pagingType=`2`
                      &tpl=`chunk.SearchResults`
                      &extractTpl=`chunk.Extract`]]


                      did you ever had problems like this?

                      thx,
                      hhm