We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    I have a client that wants a search function which shows results from different containers. The normal behavior is that all search results are shown as one list. What my clients wants is this:

    You searched for: keyword
    
    Results in Container a:
    
    1. result blablabla
    2. result blablabla
    3. result blablabla
    Show all results in container a
    
    Results in Container b:
    
    1. result blablabla
    2. result blablabla
    3. result blablabla
    Show all results in container b
    
    Results in Container c:
    
    1. result blablabla
    2. result blablabla
    3. result blablabla
    Show all results in container c
    


    How can I create something like this in MODx?
      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 5811
      • 1,717 Posts
      I am not sure to understand the request ... are they the same results in the différent containers ?

      because if you would like the same results in different containers, simply put several snippet call in the result page.

      For instance in the same result page you could write:

      [!AjaxSearch? &extract=`99` &parents=`11` &language=`english-utf8` &ajaxSearch=`0` &AS_showForm=`0`!]

      [!AjaxSearch? &extract=`99` &parents=`11` &language=`english-utf8` &ajaxSearch=`0` &AS_showForm=`0`!]

      and then you get the results twice.

      But keep care of the functions that you can define in your configuration file. Try to avoid redeclare functions error.
      For that use:
      if(!function_exists('functionName')) {
        function functionName(){ 
        • 16183
        • 1,390 Posts
        I think he means results filtered by category (container) - so if there are three containers, fruits, vegetables, meat and the user search for "pie", results will be returned from each of those categories and displayed on the page in 3 separate lists arranged according to category, i.e ++>

        Fruits:

        result (e.g. fruit pie)

        Vegetables

        result (e.g. curried vegetable pie)

        Meat

        result (eg. meat pie)

        Unless I misunderstood him too?

        cheers/k
          • 25483
          • 741 Posts
          I want to do separate searches on multiple containers in one page. So if I search for "animal" I want to show 3 results that are found from the different containers. Like in my example, I just want 3 results for every container.

          Could I just use multiple AjaxSearch calls that all display their results on one page?

          @kongondo: That is what I mean, I want to search in multiple containers, but don’t show the results as one list. Just like you say I want to see the results for every container!
            with regards,

            Ronald Lokers
            'Front-end developer' @ h2o Media

            • 5811
            • 1,717 Posts
            Could I just use multiple AjaxSearch calls that all display their results on one page?
            No. It’s not enought, because each search results should be restricted to each container.

            The subSearch parameter allows to restrict the search to a sub domain. See the subSearch démo.

            ---- &subSearch : [int, int | 5, 1] (optional)
            subSearch allow to use radio buttons to select sub-domains where to search
            Initialize the subSearch by defining the number of possible choices (radio-buttons)
            and choose the default checked selection

            But in your case, your request implies :
            1/ to manage several subdomains with one single search request
            2/ to manage the display of search results per each subdomain

            It isn’t possible today with the current release.