Announcement

Collapse
No announcement yet.

Sorting Facet Results

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sorting Facet Results

    Is there a way to sort the results under particular facets? (For example, under “Size,” have the results sorted in the order: XS, S, M, L, XL, XXL, 3X)
    Psydde Delicious
    Delicious Boutique & Corseterie
    Philadelphia, PA
    www.DeliciousBoutique.com
    www.DeliciousCorsets.com

    #2
    To clarify, I'm not trying to sort the filtered product results, but rather sort the selectable "options" that appear the facet. I'd like the options to appear in a more logical order instead of alphabetically sorted.. Sort the size facet options in the order XS, S, M, L, XL, XXL, 3X.
    Last edited by delcorsets; 07-16-18, 06:37 AM.
    Psydde Delicious
    Delicious Boutique & Corseterie
    Philadelphia, PA
    www.DeliciousBoutique.com
    www.DeliciousCorsets.com

    Comment


      #3
      I don't see anything built-in that would sort the facets themselves. You can copy the facet items into another array and then sort that array and display them sorted the way you want. I did an array sorting thing a while back and there is the answer near the bottom of the page: https://www.miva.com/forums/forum/de...quicksortarray
      Hope that helps. Yes, it would be cool to have a sorting option built-in wouldn't it? I guess it's pretty complicated as it stands so adding more features just makes that 'worse'. Miva is cool though since we CAN do more, like a custom variable array to sort, if we want.
      Colin Puttick
      Miva Web Developer @ Glendale Designs

      Comment


        #4
        As a workaround until Miva offers the ability to custom-order the facet values, I've used a <span> tag within the custom field values.

        So, for example, instead of the following values in a "size" custom field, which will display in the following (default alphabetical) order in the facets section:
        L
        M
        S
        XL
        XS

        I use the following values, which will then display in the desired order:
        <span style="display:none;">01</span>XS
        <span style="display:none;">02</span>S
        <span style="display:none;">03</span>M
        <span style="display:none;">04</span>L
        <span style="display:none;">05</span>XL

        It looks a bit clunky on the back end, but doesn't cause any display or facet/filtering issues on any of our pages.

        Comment


          #5
          We have s similar problem where offering computers with RAM options they are sorted like:

          16RB RAM
          4GB RAM
          8GB RAM

          Of course we would rather it read 4, 8, 16.

          If the solution offered by Fisher is a good idea I don't see how to make that work or where to make the adjustment in Miva.

          Facets are display on category pages and we have 5 facets on the page so how would I change just one facet to include the Fisher solution?

          Fisher says "used a <span> tag within the custom field values" and I don't know what that means.

          My Custom Field for RAM is a text field - how do I use a <span> tag within the custom field values?

          Is the CTGY page the one to be adjusted, somewhere in the ReadyTheme, Settings, Facet layout, Custom Fields?

          How do you fix just one facet layout?

          I don't see where to make the adjustment if I wanted to.

          I just don't know enough about this to see how to make that work or some details might be missing.

          Comment


            #6
            joseibarra We were able to do something similar to what Fisher said but with less bloat. You put something machine sort able before your value and then you use miva template code where it displays that value to the user to strip out the sort code.

            Example using your data.

            The value of your custom field would be this. It's not too hard to manage in your admin.

            {01}4GB RAM
            {02}8GB RAM
            {03}16RB RAM

            Then on all the displays to the user you have to strip out the {} part and you can use Miva's gettoken function easily to break the value into 2 and then show just the second part.
            Colin Puttick
            Miva Web Developer @ Glendale Designs

            Comment


              #7
              I went with the suggestion from Fisher since it does not involve figuring out just where in the Miva template code to strip out any sort code or how to use the gettoken function - which may be obvious and easy for some but not for a noob like me:

              Now the RAM facet custom fields looks like this for those part numbers and things display in the desired order.

              PRODUCT MEMORY_(RAM)
              E935572 <span style="display:none;">01</span>4GB RAM
              E935367 <span style="display:none;">01</span>4GB RAM
              E935967 <span style="display:none;">01</span>4GB RAM
              E935775 <span style="display:none;">01</span>4GB RAM
              E936953 <span style="display:none;">01</span>4GB RAM
              E937154 <span style="display:none;">01</span>4GB RAM
              E937340 <span style="display:none;">01</span>4GB RAM
              E937523 <span style="display:none;">01</span>4GB RAM
              E938297 <span style="display:none;">02</span>8GB RAM
              E937919 <span style="display:none;">02</span>8GB RAM
              E937720 <span style="display:none;">02</span>8GB RAM
              E936365 <span style="display:none;">02</span>8GB RAM
              E936163 <span style="display:none;">02</span>8GB RAM
              E936750 <span style="display:none;">02</span>8GB RAM
              E936556 <span style="display:none;">02</span>8GB RAM
              E939305 <span style="display:none;">03</span>16GB RAM
              E939498 <span style="display:none;">03</span>16GB RAM
              E938113 <span style="display:none;">03</span>16GB RAM

              Thanks for the suggestions.

              Comment


                #8
                I just tried this and it's showing the 01, 02, 03 etc in the facet list for some reason even though it's a display none span. Does this work in the latest Shadows templates?

                Comment


                  #9
                  Since this thread goes back to 2018, I am wondering if there is an easier fix for this problem - we need to sort the values for a facet differently?

                  Comment


                    #10
                    Originally posted by afiumano View Post
                    Since this thread goes back to 2018, I am wondering if there is an easier fix for this problem - we need to sort the values for a facet differently?
                    There is a feature request for this functionality to be built in but currently we do not have an ETA.

                    The methods that are described in this post are still the easiest to implement.

                    In what way to you need to sort the facet values?
                    Nicholas Adkins
                    Technical Training Specialist / Miva, Inc.
                    [email protected]
                    https://www.miva.com/mivalearn

                    Comment


                      #11
                      I created a custom field for "Hardiness Zone" as a Multi-Text field. We imported each product's respective zones via csv. Values range from 2-11. In the dropdown for the filter the order is appearing as: 10, 11, 2, 3, 4, etc. Of course this needs to be: 2, 3, 4....11. I was able to 'fix' it by using the 'display:none" spans inside EVERY custom field for EVERY product in one category.

                      Is that the most efficient fix? That is going to be quite time consuming to add to ALL fields. I don't understand how to implement the fix mentioned by 'dreamingdigital' but is that easier if we were able to get sample code?

                      Comment

                      Working...
                      X