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

    I was wondering if I can sort my mnenu items in wayfinder in a custom way. This is the problem. I have a homepage menu that requires a set of menu items then in the interior pages I need a different set of menu items.

    For example:

    Home Page:

    home | about | contact us

    Interior Page:

    contact us | about | where to buy | teachings

    Any help would do. I’m thinking if i’m able to just give the menu certain id’s of the resources then that would make building my menu’s easier.


      • 29979
      • 21 Posts
      Okay so let me try again. I have two wayfinder calls one in the home page template and one on the interior template.

      They both are using &startid=`0`.

      Now the second interior menu is currently in this order:
      home | about | contact us | programs

      I would like to have this menu in a custom sort like so:

      home | programs | about | contact us

      Now it’s emulating the doc tree which is fine because the docs are in the correct order for the menu on the home page to feed off of.

      The interior menu has also a &includedocs=`` call which allowed me to filter out other menu items but now I would like them sorted like the example i gave.

      I just need to know if this is possible?



        • 16183
        • 1,390 Posts
        Hi Matt,

        Please don’t double post, thx.

        So, the Home page menu looks like:

        home | about | contact us | programs

        And you want the interior pages one look like:

        home | programs | about | contact us

        is that correct? I don’t think it is possible unless you use some "trickery"

        The &sortBy parameter allows you to sort using any of the following...

        [ id | menutitle | pagetitle | introtext | menuindex | published | hidemenu | parent | isfolder | description | alias | longtitle | type | template | random ]

        So, for the home page menu, you can probably sort by menuindex.

        Then for the interior pages, you can sort by another field. Some form of alphabetical sorting will not work for you because the output you want for this menu is not alphabetical. So, you are left with either (i) using the "id" as the sort criteria - but you probably don’t have control over the ids assigned to the docs by MODx. So, and here comes the trickery, you could use the description document field to do your sorting. But, you would have to make sure these are in the order you want. So, maybe, in the description fields for the respective docs:

        Page Title
        Description (field)

        home 1_home
        programs 2_programs
        about 3_about
        contact us 4_contact us

        First WF call add &sortBy=`menuindex` make sure you assign menu indexes correctly
        Second WF call add &sortBy=`description`

        Now, this is not elegant but I can’t think of any other way to achieve what you want...or maybe am just tired and cannot think straight grin


          • 29979
          • 21 Posts

          Man I’m sorry for the double or triple post I lost track of where I posted. This is a fine solution and I think will work for what I need done. Again sorry for all the posts Cheers!

            • 16183
            • 1,390 Posts
            No problem smiley

            All the best with your project!

            • Or, just keep the default &sortBy setting, you can manage the menuindex order with Doc Manager.
                Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                MODx is great, but knowing how to use it well makes it perfect!


                Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                Maintainter/contributor of Babel

                Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                • 16183
                • 1,390 Posts
                Quote from: goldsky at Sep 16, 2009, 01:34 AM

                Or, just keep the default &sortBy setting, you can manage the menuindex order with Doc Manager.

                He wants to sort two menus, basically made up of the same documents but using two different criteria. If he were to alter the menuindex both menus would be affected and would look the same. He wanted a custom sort for the second menu in a way which did not lend itself to an alphabetical listing criteria.

                • The way I’ve done this is to add a TV to the documents to use as sort order for one of the menus, and use the ’real’ menuindex for the other. It’s painful to reorder the TV based one, but it works smiley
                    MAPLEDESIGN MODX development and MODX web design and custom development. Proud to serve UK and International clients!
                    • 7153
                    • 2 Posts
                    I have a solution that might be worth posting. I created a new unpublished resource. Within this resource I created new weblinks one for each of the pages in my primary navigation. Make the weblinks link directly to the corresponding pages in the main navigation.

                    I can call wayfinder with the &startId= targeting my new group of weblinks. And I have the freedom to rearrange the weblinks using the menu index numbers.
                      • 53213
                      • 5 Posts
                      It can be done
                      if (!empty($this->_config['contexts'])) {
                      $c->where(array('modResource.context_key:IN' => explode(',',$this->_config['contexts'])));

                      You can change the Wayfinder snippet
                      (in core/components/wayfinder/wayfinder.class.php)
                      For those who are searching