Announcement

Collapse
No announcement yet.

Combination facets - Year Make Model and results sorting

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

    Combination facets - Year Make Model and results sorting

    We've implemented the combination Facets for a Year Make Model selection and have two sorting issues we haven't been able to resolve.

    https://www.pfyc.com/mgp-caliper-covers.html

    1. In the first drop down for model year, the selections are in ascending order (smallest to largest). Most companies (ours included) would prefer the model year to go in descending order (largest to smallest) vs ascending order. I did not see any option for this.

    2. When we elected to include Universal Products (other products) for this Combination Facet, the results after making the year make model selections showed those other universal products first before the vehicle specific products but we would like the vehicle specific products to show first followed by the general products (after all, this is what the customer is trying to accomplish). I do not see an option that allows us to have it sort this way.

    Otherwise, its a pretty slick setup that is easy to implement and works as advertised.

    milel

    #2
    For #1, you would have to re-sort the list using JavaScript. I'll see if I can get you an example of how to do this.

    For #2, the module itself does not control the sort order. You would have to sort your products using the standard sorting features. You could also via template easily re-the results based on a custom field for example, where you had a simple toggle for universal product, and forced those to always appear last.

    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      For #1, that would be awesome. Thank you, Brennan.

      For #2, is it possible, maybe in a future update that the default would be opposite what it is now? It makes sense that someone who has just done a combination facet selection would get the specific results they've just selected up first followed by the general products afterwards. Might be in Miva's best interest to have it that way by default.

      Just sayin... :)

      Comment


        #4
        Here’s some JS that reverses the sort for the year. It would be added to the Combination Facet Menu Layout right below the line that constructs an MMCombinationFacet object:

        Code:
                     
           combination_facet.Field_Load_Callback = function( response, field, callback )
                        {
                                        if ( !response.success )
                                        {
                                                        return;
                                        }
        
                                        if ( field.index == 0 )
                                        {
                                                        response.data.sort( function( a, b ) { return a > b ? -1 : 1 } );
                                        }
        
                                        MMCombinationFacet.prototype.Field_Load_Callback.call( this, response, field, callback );
                        }
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          Perfect. Worked like a charm. Thank you, Brennan. Have a great weekend.

          Comment

          Working...
          X