We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30911
    • 10 Posts
    I am sort of new to Wayfinder, but i have managed to setup ModX with the standard template and added multiple pages.

    I am using [[Wayfinder? &startId=`0`]] (the most simplistic way, as ive understood it).

    The Website is displaying the following menu, in this order(which is also the order of creation). now the funny thing is that the menu index order is different, and from what i understand is that the default sort method is by menuindex.

    * Home
    * Maatwerk
    * Workshops
    * Contact
    * Foto Gallery
    * Groepsarrangementen

    the actual menu index order:
    0 - Home
    1 - Maatwerk
    2 - Workshops
    3 - Foto Gallery
    4 - Groepsarrangementen
    5 - Contact


    Now i would like to know how to make my menu order by menuindex. It could be worth telling you that i have tried [[Wayfinder? &startId=`0` &sortBy=`menuindex`]]
      • 3749
      • 24,544 Posts
      Could it be that your version of MySQL is 5.0.51? There’s a bug in that version that causes Wayfinder to ignoe the menuindex.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 30911
        • 10 Posts
        that is very possible yes shocked, is there a solution or workaround?
          • 3749
          • 24,544 Posts
          Quote from: Tyranox at Nov 04, 2009, 12:37 PM

          that is very possible yes shocked, is there a solution or workaround?

          If that’s it, the best option is getting the host to upgrade to a newer MySQL version. That one has a number of serious bugs.

          I believe there are some solutions in this thread (http://modxcms.com/forums/index.php?topic=26742.0), but really, updating MySQL is by far the best way to go.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 30911
            • 10 Posts
            I’ve checked the version, and it is indeed 5.0.51a, send a request to my host. hope it gets heard.

            If they won’t, ill have to find something else. sad
              • 30911
              • 10 Posts
              Basicly i managed to find a solution for now...

              and i guess this will only work if you do not make use of ’Document Groups’ (whatever they are).

              the standard SQL Query for Wayfinder is:

              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 `<yourDatabaseName>`.`modx_site_content` sc 
              LEFT JOIN `<yourDatabaseName>`.`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 (1,2,3,4,5,7,8,6)
              GROUP BY sc.id
              ORDER BY menuindex ASC ;


              Now, if you make no use of Document Groups the join in this query makes little to no sense at all, it joins, and does nothing with it.

              So the query that would make more sense for me, would be:
              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 `<yourDatabaseName>`.`modx_site_content` sc 
              WHERE sc.published=1 AND sc.deleted=0 AND (sc.privateweb=0) AND sc.hidemenu=0 AND sc.id IN (1,2,3,4,5,7,8,6)
              ORDER BY menuindex ASC ;

              As you can see this is alot simpeler. This makes it work for ’me’.


              What i did is comment out the following line:
              $sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published=1 AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY sc.{$sort} {$this->_config['sortOrder']} {$sqlLimit};";

              This line of code should be around line 352 in the wayfinder.inc.php file.

              And replace it with:
              $sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc WHERE sc.published=1 AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") ORDER BY sc.{$sort} {$this->_config['sortOrder']} {$sqlLimit};";



              I hope i help someone with this. This isn’t a very pretty solution, but it works for ’me’. I suspect this will not work if you make use of ’Document Groups’, what ever they are.