Sort By Custom Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lesliekirk
    Super Moderator











    • Aug 2008
    • 9296

    #1

    Sort By Custom Field

    I was thinking someone else may have asked this question but I'm not finding it. Is it possible to include a custom field in the CTGY Page Sort by method?

    Thanks,
    Leslie
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: X | Facebook | Pinterest
  • Brennan
    Super Moderator









    • Jun 2009
    • 3481

    #2
    Re: Sort By Custom Field

    There is currently nothing naively built in to sort by a custom field on the category page. There are a couple toolkit ways to do it. Are you looking to just have the custom field name in the drop down and sort alphabetically when selected, or something else?
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    • lesliekirk
      Super Moderator











      • Aug 2008
      • 9296

      #3
      Re: Sort By Custom Field

      The field is for the "grade" of an item - Fine, Very Fine, ect - which would make it difficult to be some sort of "alpha" sort. Guess I need to table this idea for a while.
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: X | Facebook | Pinterest

      Comment

      • fastees
        Mivite

        • Dec 2007
        • 194

        #4
        This works: <mvt:item name="toolkit" param="asortmulti|l.all_settings:category_listing| :customfield_values:customfields:Illustration_Numb er|1" />

        In my example this is on a cat page in the Category Product List Layout and located just before the <mvt:foreach iterator="product" array="category_listing:products">. The custom field code is Illustration_Number. I hope this saves you hours of trial and effort. I put a ticket in with miva and this is all they sent me. I did ask for sorting by custom field and there was no help with that part of it at all. I give them credit for being as good as they are but this answer would not help the average Joe at all. I guess that's what keeps us developers in business but I personally had to spend 30 minutes to figure this out.
        Use asortmulti to sort a multidimensional array. The 2nd parameter is the array name. The 3rd is the column to sort on. It must be preceeded with the colon character. The 4th parameter is the direction of the sort. Use 1 for ascending and -1 for descending. Below is an example of sorting the category list in the Power Search display.
        <mvt:item name="toolkit" param="asortmulti|l.all_settings:searchcats|:name| 1" />
        Last edited by fastees; 04-21-16, 05:23 AM.

        Comment

        • Bruce - PhosphorMedia
          Developer Partner











          • Mar 2006
          • 11256

          #5
          Originally posted by lesliekirk View Post
          Re: Sort By Custom Field

          The field is for the "grade" of an item - Fine, Very Fine, ect - which would make it difficult to be some sort of "alpha" sort. Guess I need to table this idea for a while.
          If you entered the VALUE for the field as 1:Good, 2:Fine, 3:Very Fine, etc, you could use that field for sorting by first tokenizing the value using the first segment for sorting and the second for the display value.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment

          Working...
          X