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

    Wayfinder seems to be sorting on document id not menu index. I am just using the basic [[Wayfinder? &startId=`0`]] call. I have also added an explicit &sortBy=`menuindex` and tried [!..!] calls with nothing changing the ordering of the menu items.

    Am I missing a step or a parameter somewhere?

    Thanks!
      • 30030
      • 22 Posts
      Hmmm 20 minutes later and the menu sorted itself... will have to keep an eye on it to see if anything changes.
        • 10525
        • 247 Posts
        I’m having exactly the same problem. I’m using a vertical menu and all was OK for a couple of days and then it suddenly started to order by document id instead of menuindex. I have been editing the call to Wayfinder, but I edited nothing that I thought might cause this (only the call to Wayfinder in my main template and the Wayfinder templates)..

        I have tried &sortBy=`menuindex` too, but to no avail.

        Does anyone know what the solution is to this?

        Timmer, did you find out what caused this, or have you had the problem recur?

        Cheers,

        Gav
          • 10525
          • 247 Posts
          I tried &sortBy=’menutitle’ in my Wayfinder call and got the following error instead of my webpage. Maybe this lends a clue as to the faulty query, if that is the culprit?

          (I have seen in other (~2006) postings that a faulty query was previously to blame for this problem. However my wayfinder.config.php file looked like it had been fixed).


          « 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 ’’menutitle’ ASC’ at line 1 »
          SQL: SELECT DISTINCT sc.id, sc.menutitle, sc.pagetitle, sc.introtext, sc.menuindex, sc.published, sc.hidemenu, sc.parent, sc.isfolder, sc.description, sc.alias, sc.longtitle, sc.type,if(sc.type=’reference’,sc.content,’’) as content, sc.template, sc.link_attributes FROM kane.`modx_site_content` sc LEFT JOIN kane.`modx_document_groups` dg ON dg.document = sc.id WHERE sc.published=1 AND sc.deleted=0 AND (sc.privateweb=0) AND sc.hidemenu=0 AND sc.id IN (48,49,1,50,7,52,51,4,6,39,42,43) GROUP BY sc.id ORDER BY sc.’menutitle’ ASC ;
          [Copy SQL to ClipBoard]

          Parser timing
          MySQL: 0.0024 s (4 Requests)
          PHP: 0.0401 s
          Total: 0.0425 s
          Error while inserting event log into database.

          Cheers,

          Gav

            • 30030
            • 22 Posts
            Hi Gav,

            Unfortunately, it hasn’t stopped sorting so I have no clue what caused it originally. I would say it was a caching issue but even the management view wasn’t sorting and now it is and has been since then.

            Sorry, that probably doesn’t help any.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The only thing I am aware of that can cause this is the buggy version of MySQL (5.0.51); it is possible that hosting companies upgraded to this version without any notification. I believe a certain upgrade to CPanel used that version, and hosts have been scrambling ever since to upgrade or downgrade the MySQL to a version that doesn’t have that bug (something to do with queries having both GROUP BY and ORDER BY).

              So your host may have upgraded, realized the problem, and either upgraded again or downgraded to get rid of it.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 10525
                • 247 Posts
                Thanks for your replies folks.

                I am indeed running MySQL version 5.0.51b-community-nt, so that may be the problem!

                I tried running the above query against the MODx database for my site and, as expected, it fails because of the quotes around ’menutitle’. Removing the quotes, the query returns the correct results but in the wrong order (ordered by id). Changing "menutitle" to "menuindex" brings back the same results, again ordered by id.

                If I then remove the "GROUP BY sc.id" line, I get the correct results - ordered by menuindex.

                I am going to look and see if it is feasible to alter this statement in the wayfinder.config.php file...

                If that doesn’t work I’ll try changing my MySQL version...

                Cheers

                Gav
                  • 22303 MODX Staff
                  • 10,725 Posts
                  The problem is MySQL 5.0.51, period. It’s a major bug and making that hack will work only if you do not have pages assigned to multiple document groups. In that case, removing the group by will cause you to get duplicate data.
                    • 10525
                    • 247 Posts
                    Thanks OpenGeek,

                    I think I will just go ahead and update my version of MySQL,

                    Gav

                      • 29525
                      • 388 Posts
                      I’ve just encountered this problem as well.

                      I recently installed wamp that has 5.0.51b and started working on a project. How to do I change the sql version? I tried to install wamp with sql 5.0.45 over the top of my existing install.

                      The wamp menu now shows two version of sql. However, when I select the down level version and try to bring up my site, I get a modx parse error, failed to select the database.

                      I have no clue how to approach this.

                      I appreciate any help. Thanks.

                      Terry
                        www.terrybarthdesign.com