We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33982 ☆ A M B ☆
    • 476 Posts
    How do I go about setting up Ditto (or any other snippet) giving the ability for the visitor to be able to sort documents by certain criteria?

    For example, I’m building an Ecommerce site and we’ve got a page selling belts. We need to set it so that the visitor can sort by belt size from a drop down menu. Curious how I should go about setting up the Template Variables and such to handle this request. And obviously how do I set it so that sorting is possible for the visitor to choose a belt size and have all those belts output? I know Reflect can handle something very similar by tagging documents, but I need to figure out a way so that if I have 10 belts that all have size 34’ waist, that 10 instances for the 34’ category don’t show up in the drop down menu. Hope that makes sense.
      Precision Web Development ... SmashStack.com
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      If I were you, I’d probably write my own SQL statements in a Snippet and perform the sorts in SQL, or alternatively, return the data in a table that you sort using Javascript (this has limitations, however).
        • 33982 ☆ A M B ☆
        • 476 Posts
        Hey Everett,

        Thanks for the response. I pretty much know very little programming (apart from CSS and XHTML), so that may be out of my skillset. I was hoping their was a snippet already for this or someone that had maybe pulled this off before and discussed it in the forums.
          Precision Web Development ... SmashStack.com
          • 26931
          • 2,314 Posts
            • 9207 ☆ A M B ☆
            • 2,475 Posts
            Ok, if you’re unable to do custom SQL queries, then a really simple implementation of this might be to create several pages that will display search results, each with a slightly different Snippet call -- the only thing that would change between them would be the "sort-by" attribute (whatever that parameter name is for the snippet you’re using).

            Would that work for you?
              • 33982 ☆ A M B ☆
              • 476 Posts
              Thanks for the advice Everett...that may be a bit difficult and time consuming to set up, but it is an idea nonetheless.
                Precision Web Development ... SmashStack.com
                • 9207 ☆ A M B ☆
                • 2,475 Posts
                Lol... I never said it was a GOOD idea. But simple in principle... haha.
                  • 33982 ☆ A M B ☆
                  • 476 Posts
                  HA! laugh

                  Yeh, it actually gave me a few ideas to work with...thanks so much!
                    Precision Web Development ... SmashStack.com
                    • 29635
                    • 361 Posts
                    Quote from: flinx at Feb 23, 2009, 07:11 PM

                    ...something very similar by tagging documents, but I need to figure out a way so that if I have 10 belts that all have size 34’ waist, that 10 instances for the 34’ category don’t show up in the drop down menu. Hope that makes sense.
                    Not that everybody else’s ideas aren’t good, but I think your answer is as simple as just using Ditto’s tagging capabilities.
                      Need MODx Ecommerce? Try FoxyCart!
                      • 7231
                      • 4,205 Posts
                      I think your answer is as simple as just using Ditto’s tagging capabilities.
                      And take that further using the request extender (or a wrapper snippet which is what I do, but the request extender works great for custom sorting/filters)
                        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                        Something is happening here, but you don't know what it is.
                        Do you, Mr. Jones? - [bob dylan]