On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Yes, my ajax search (non-ajax mode) is not showing results in other page, it’s doing it right where the search box is. I feel a little frustrated because I have been trying for two days, looking in the forum, wikis, codingpad, etc. and I’m not sure what I’m doing wrong.

    1. I’m using MODx 1.0, WinXP, WampServer, Apache 2.2.11 and PHP 5.2.11
    2. My snippet [!AjaxSearch? &ajaxSearch=`0` &AS_landing=`6`!] is in a chunk I created for my main template
    3. And [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0`!] is in my Search Results page, id=6

    Am I missing something? Thanks. undecided
      I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
    • I’m using MODx 1.0, WinXP, WampServer, Apache 2.2.11 and PHP 5.2.11
      If you use MODx 1.0.2 or higher you should try :

      [!AjaxSearch? &ajaxSearch=`0` &landingPage=`6`!]
      and
      [!AjaxSearch? &ajaxSearch=`0` &showInputForm=`0`!]
      

      Some parameters have been renamed since the release 1.9.0 of AjaxSearch. See this post for more informations.

      You can also find lot of demos like this one on my site.
      • Thank you so very much Coroico! Yes, in assets\snippets\ajaxSearch there is a doc. called ajaxSearch_version_190.txt which have all the renamed parameters. Again, Thanks. grin
          I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
        • By the way, how do I change the status of this post as solved?
            I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
          • Actually, I too am having the same problem. When using a landing page for the search results, I get the desired results under the search form where I placed it in my template file, but in the actual body of the content, I am getting results for all the documents containing the search term. How did you fix this?

            My snippet code for search box - [! AjaxSearch?&ajaxSearch=`0` &landingPage=`27` &showIntro=`0` &parents=`in:24` &depth=`1` !]
            and for the search results page - [!AjaxSearch? &ajaxSearch=`0` &showInputForm=`0` &pagingType=`0`!]

            This is what I’m getting (see attached img)


            Your help is much appreciated!!
            • Hey, you need to go to assets\snippets\ajaxSearch and look for a doc. called ajaxSearch_version_190.txt (assuming you have version 190) to see if your parameters are correct.
                I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
              • Thanks, I got it working. I needed to put the snippet call on the landing page!I have yet another issue

                Here’s my snippet call on the landing page

                [! AjaxSearch? &ajaxSearch=`0` &showInputForm=`0` &pagingType=`0` &parents=`in:24` &advSearch=`exactphrase` &withTvs=`+:business-name` !]

                I am getting a sql error:

                « MODx Parse Error »
                MODx encountered the following error while attempting to parse the requested resource:
                « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’-name FROM `modx_site_content` sc LEFT JOIN( SELECT DISTINCT tv.id, tv.value, tv’ at line 1 »
                SQL: SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.template, sc.menutitle, sc.content, sc.publishedon, GROUP_CONCAT( DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id, GROUP_CONCAT( DISTINCT ntv.value SEPARATOR "," ) AS tv_value, ntv1.value AS business-name FROM `modx_site_content` sc LEFT JOIN( SELECT DISTINCT tv.id, tv.value, tv.contentid FROM `modx_site_tmplvar_contentvalues` tv ) AS ntv ON sc.id = ntv.contentid LEFT JOIN( SELECT DISTINCT tv1.contentid , tv1.value FROM `modx_site_tmplvar_contentvalues` tv1 WHERE tv1.tmplvarid = ’18’ ) AS ntv1 ON sc.id = ntv1.contentid WHERE ((sc.id IN (46,48,49,50,47,45,26,25,44,43,41,40,39,38,42,36,28,29,30,31,32,33,34,35,37)) AND (sc.published=1) AND (sc.searchable=1) AND (sc.deleted=0) AND (sc.privateweb=0)) GROUP BY sc.id HAVING (((sc.pagetitle REGEXP ’[[:<:]]pardon[[:>:]]’) OR (sc.longtitle REGEXP ’[[:<:]]pardon[[:>:]]’) OR (sc.description REGEXP ’[[:<:]]pardon[[:>:]]’) OR (sc.alias REGEXP ’[[:<:]]pardon[[:>:]]’) OR (sc.introtext REGEXP ’[[:<:]]pardon[[:>:]]’) OR (sc.menutitle REGEXP ’[[:<:]]pardon[[:>:]]’) OR (sc.content REGEXP ’[[:<:]]pardon[[:>:]]’) OR (tv_value REGEXP ’[[:<:]]pardon[[:>:]]’) OR (business-name REGEXP ’[[:<:]]pardon[[:>:]]’))) ORDER BY sc.publishedon,sc.pagetitle


                tv1 WHERE tv1.tmplvarid = ’18’ - this is the id of the tv - "business-name"

                Please help!

                thanks!

                • See this post : http://modxcms.com/forums/index.php/topic,31830.msg193322.html#msg193322

                  If you don’t search in Tvs, simply add &whereSearch=`content`
                  • Thanks so much coroico for getting back to me. Unfortunately, I created a template solely based on TVs. What I actually want to do is exclude some of the TV values from displaying in the search results. I have tried using &withTvs=`-:tv-name` but get an error

                    SNIPPET
                    [! AjaxSearch? &ajaxSearch=`0` &showInputForm=`0` &pagingType=`0` &parents=`in:24` &advSearch=`exactphrase` &withTvs=`-:color` !]

                    ERROR:

                    some massive MODx parse error with Sql

                    embarrassed
                    • @jwong73 Which version of MySql do you have ?

                      If SQL issue comes from the use of the GROUP_CONCAT order, don’t use whereSearch with tvs. So try this order to do a search in content table & business-name Tv:

                      [! AjaxSearch? &ajaxSearch=`0` &showInputForm=`0` &pagingType=`0` &parents=`in:24` &advSearch=`exactphrase` &withTvs=`+:business-name` &whereSearch=`content`!]