We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36575
    • 104 Posts
    I have AdvSearch working on my default context (Revolution 2.2.4) - works great. I just tried to set it up on a second context. It worked fine while it was a subfolder of the original domain (which we were using for development/content loading/testing) but now it's sitting on it's own domain, it doesn't work.

    The url doesn't load the query string (so what should be url/searchresults.html?id=1920&asId=as0&search=maggie&sub=search is simply url/searchresults.html)

    I then tried to set it up as Simple Search, and now I am getting the result "There were no search results for the search "". Please try using more general terms to get more results." Again, the search string is not being included in the URL.

    Am I missing something in context settings to get this working? I have other sites with multiple contexts and search working fine, so I am not sure what's going on... any ideas?

    Site is: http://www.thebridaloutlet.co.nz

    Just trying to get the php/MySQL info now
      • 36575
      • 104 Posts
      PHP: 5.3.6-6 dotdeb
      MySQL: 5.1.57
        • 42562
        • 1,145 Posts
        What do you use to call SimpleSearch? Do yo have the Form in one page and the Search results in another? Are these located in the context you wish to search? Are you searching cross contexts?

        Try this (uncached!!!!)
        Place both in the same search.html for now, and in whatever context
        [[!SimpleSearchForm]]
        [[!SimpleSearch? &contexts=`web,myweb2,myweb3` &highlightTag=`strong` &tpl=`tpl`]]
          TinymceWrapper: Complete back/frontend content solution.
          Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
          5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
          • 36575
          • 104 Posts
          hi donshakespeare,

          I hid the search, as the site is live. It was in one page, with the results in another, and my calls are:

          in the header:

          [[!SimpleSearchForm? &landing=`2014` &tpl=`astraboSearchFormSimpleSearch` &searchIndex=`custom_search_field` &method=`POST`]]


          in the landing page (2014)

          [[!SimpleSearch]]


          I've just set up another (live, but hidden) page with the search box and results on the one page, and included the code you've indicated above, except with context="bridaloutlet" which is the name of the context. I still have the issue that it's not adding the query string onto the url.

          http://www.thebridaloutlet.co.nz/search-test.html
            • 36575
            • 104 Posts
            I've also just set this page up, to show what I am trying to do
            http://www.thebridaloutlet.co.nz/search-test-2.html

            It has the same code as above, except the landing page is different, and the method is get.
              • 36575
              • 104 Posts
              If I manually add a query strong (that I got from the other context), then the search works. Somehow, the search query strong is not being added, so the search thinks it's looking for nothing

              eg

              http://www.thebridaloutlet.co.nz/search-test-2.html?id=1920&asId=as0&search=maggie&sub=search

              with this, I get results.

              Any ideas?
                • 42562
                • 1,145 Posts
                This is why stuff does not show up in your URLQuote from: almighty-internet
                The fundamental differences between "GET" and "POST"
                The HTML specifications technically define the difference between "GET" and "POST" so that the former means that the form data is to be encoded (by a browser) into a URL while the latter means that the form data is to appear within a message body...
                Quote from: rachelmarama1
                If I manually add a query strong (that I got from the other context), ...
                You lost me there thoroughly.
                Note! I am not sure this is the problem, but it is contexts=`bridaloutlet` and not context="bridaloutlet"
                Your landing page at http://www.thebridaloutlet.co.nz/search-test-2.html?id=1920&asId=as0&search=maggie&sub=search
                works..but maybe you need to provide some working form for us to test this thing out
                  TinymceWrapper: Complete back/frontend content solution.
                  Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                  5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                  • 36575
                  • 104 Posts
                  ok, sorry if I am confusing the issue. I was just trying out &method=`POST` and &method=`get` to see if it made any difference - it didn't. I've removed this from the code.

                  I have two test pages set up, where you can enter a search term in, and see that the search is not working:
                  http://www.thebridaloutlet.co.nz/search-test-2.html
                  http://www.thebridaloutlet.co.nz/search-test.html

                  if you enter a search term into either of those pages, you will see that it returns no results, AND THE URL DOES NOT CHANGE (if it were searching correctly, I believe it should add a query string to the URL, because that's what it does for every other instance I've used it on.

                  Does that make sense?
                    • 42562
                    • 1,145 Posts
                    Yea, it makes sense.

                    The problem, I think is with your form action or/and Friendly URl.
                    For both pages you gave links to
                    Your current code translates to
                    <form class="sisea-search-form" action="index.php?id=2536" ....
                    I see no reason the action should have that value, albeit that is the id of the landing page.
                    1. Once I changed it to action="search-test-2.html" for the first page, it worked. Browser URL changed, but no result for words like, home or dress -- I think there is a problem with your configuration in the custom form you have there.

                    2. The second page works perfectly with action="search-test.html", showing results for words like home and dress.


                    Did you manually put this in index.php?id=2536" ? otherwise, why is your MODx not changing it, because it seems to be the problem for now.

                    Your custom Simple Search Form Tpl could resemble
                    <form id="my_id" action="[[~[[+landing:default=`[[*id]]`]]]]" method="[[+method:default=`get`]]">
                    <input id="searchField" style="width:110px;" 
                    class="my_class" type="text" name="[[+searchIndex]]"
                    value="[[+searchValue:default=`search this site..`]]"
                    onfocus="if(this.value=='search this site..'){this.value='';this.style.color='#000';}else{this.select();}"  
                    onblur="if(this.value==''){this.value='search this site..';this.style.color='#b3b3b3';}" />
                    <input type="hidden" name="id" value="[[+landing:default=[[*id]]]]" />
                    </form>
                      TinymceWrapper: Complete back/frontend content solution.
                      Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                      5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                      • 36575
                      • 104 Posts
                      Ok, you have definitely identified where the issue is - if I change the action, then I now get results.

                      This is from my tpl and it looks exactly the same as your example, so maybe there is an issue with friendly urls. Maybe I need to explicitly set friendly urls in the context - I will try that. Thanks for all the help!

                      <form class="sisea-search-form" id="my_id" action="[[~[[+landing:default=`[[*id]]`]]]]" method="[[+method:default=`get`]]">