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

    I'm using getresources to list a bunch of products in order of creation date. All fine.
    But I want to add a way that users can change the sorting - ie if they want it alphabetical Asc, or by a tv etc.
    I just wondered if anyone has a good way to achieve this.

    Thanks
    Andy
      • 48696
      • 41 Posts
      I use something like this

      News
      [[!getResources? &parents=`9` &limit=`3` &tpl=`newsTpl` &sortby=`createdon` &sortdir=`DESC` &includeTVs=`1`]]

      Archive
      [[!getResources? &parents=`9` &limit=`0` &tpl=`newsTpl` &sortby=`createdon` &sortdir=`DESC` &includeTVs=`1`]]
        • 51020
        • 670 Posts
        Quote from: savalo at Sep 06, 2016, 03:19 PM
        I use something like this

        News
        [[!getResources? &parents=`9` &limit=`3` &tpl=`newsTpl` &sortby=`createdon` &sortdir=`DESC` &includeTVs=`1`]]

        Archive
        [[!getResources? &parents=`9` &limit=`0` &tpl=`newsTpl` &sortby=`createdon` &sortdir=`DESC` &includeTVs=`1`]]

        Thanks but this is just two separate getResources calls.
        What I need is one call, with a select menu or something which allows the user to change the sorting. A bit like in eBay when you can sort the results by ending soon or by lowest price. All done on the fly.

        I hope this makes more sense.

        Thanks
        Andy
          • 52064
          • 120 Posts
          creates an html form with select to sort choice.
          using an extra (eg. getUrlParam) or your snippet to retrieve GET parameter
          Use the value to customize the options getResource
            FerX - Developer at Eracom s.r.l.
            • 51020
            • 670 Posts
            Quote from: ferx77 at Sep 07, 2016, 01:38 AM
            creates an html form with select to sort choice.
            using an extra (eg. getUrlParam) or your snippet to retrieve GET parameter
            Use the value to customize the options getResource

            Thanks for the pointer. I'm not really sure how to go about stitching all that together though.
              • 4172
              • 5,888 Posts
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!