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

    I'm totally new to MODX and have been tasked with helping a new client finalize their site which were built in MODX Revo. I'm not new to to CMS's and I'm trying to learn how it functions.

    My current issue is adding a site search. I've installed SimpleSearch and added this code:

    [[!SimpleSearchForm? &landing=`181`]] to the sites topnav Chunk and this code:

    [[!SimpleSearch]] to the results Resource page.

    This setup only produces results on the actual results page(id=181).
    If I search from any other page containing the search form, it redirects to the results page correctly but gives this message:

    There were no search results for the search "". Please try using more general terms to get more results.

    I'm clearly missing something in the setup and was hoping someone could be kind enough to get me moving in the right direction.

    Thanks for your help

    This question has been answered by treigh. See the first response.

      • 5430
      • 247 Posts
      As a test, I'd try injecting these tags directly into your template instead of inside a chunk and see if the results are the same. I suspect you may have a problem with the cache sequence.
      • discuss.answer
        • 30585
        • 833 Posts
        @msjetboy, in your SimpleSimple snippet call, make sure that the name used for your search input is properly identified.

        If this was your SimpleSearchForm tpl,
        <form id="my_id" action="[[~[[+landing:default=`[[*id]]`]]]]" method="[[+method:default=`get`]]">
                // Reference the name of this search input field in your SimpleSearch snippet call.
                <input id="searchField" class="my_class" type="text" name="my_custom_search_field" value="[[+searchValue:default=`Search the site`]]">
                <input id="searchIcon" class="utilityButton" type="image" alt="Search" src="/assets/templates/my/images/searchButton.png">
                <input type="hidden" name="id" value="[[+landing:default=[[*id]]]]">
        </form>

        Then, your SimpleSearch Snippet call should look like this:
        [[!SimpleSearch? &searchIndex=`my_custom_search_field`]]

        The my_custom_search_field of the SimpleSearchForm tpl is also identified in the SimpleSearch Snippet call using the &searchIndex property.
          A MODx Fanatic
          • 49646
          • 25 Posts
          Thank you claytonk and treigh for the suggestions. I appreciate the quick responses from the forum. I think treigh's suggestion may be my problem. I installed the extra and just added the search codes but did not really look at the snippets or reference a search field. I assumed I just needed to install it and place the code. I'll give this a try over the weekend and report back.

          Thank you again!
            • 49646
            • 25 Posts
            OK the basic setup I was using was almost correct. Apparently I need a '?' in this tag: [[!SimpleSearch]] on my results page as [[!SimpleSearch?]]

            I've read some stuff about creating tpl files etc but in all honesty, with just 1 week on MODX under my belt, the methodology of installing snippets and creating chunks and tpls is a little baffling. But since I accidentally got this working while attempting your solutions I will stop there. Client will be happy since we are up against a clock. At least this will give me time to review some videos etc to get my sea legs.

            Again thank you guys so much for your feedback and assistance. I'm sure I'll be back with more questions. smiley
              • 30585
              • 833 Posts
              Glad you got it working. You don't really need the '?' unless you're modifying the default properties. Just post your snippet calls here when you have some time so we can have a closer look.
                A MODx Fanatic
                • 49646
                • 25 Posts
                This is the call in the nav chunck that appears in every header section : [[!SimpleSearchForm? &landing=`181`]]

                This is call on the results page: [[!SimpleSearch?]]

                Without the '?' this only worked on the results page itself.

                I have not modified the default properties of the snippets nor did I created any new form templates or anything else. This is just "straight out of the box" so to speak.