Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Sorting of showcase items by custom field?

Discussion in 'Showcase Support' started by tajhay, Jan 9, 2015.

  1. tajhay

    tajhay Active Member CAS Premium AMS Premium SC Premium Sportsbook Pickem Power Rankings Survivor

    In the showcase index page, theres tabs where the items are sorted by Alphabetical, recently updated, most popular, most recent etc....just wondering if its possible to have a tab there where items are instead sorted by a custom field? That would be awesome for myself.

    Not sure how much this would be of use to others, so if noone else is interested, i was wondering if i could perhaps get a lil help in adding that(or using an existing tab item to sort by the custom field).
    jOOc likes this.
  2. Bob

    Bob Developer Staff Member

    The canonical custom field data (stored in its own tables) is not joined to the item during the fetch process, so sorting (which is part of the fetch process) isn't possible.

    Just so you know.... Custom Fields data is also CACHED for each given item and that cache is stored serialized in a blob field in the item record (and therefor is not something that can be sortable via SQL). After the item(s) have been fetched, they are prepared and part of that process is unserializing and preparing the custom field data for display.

    With that said, I DO have SOME (not all) of the code you'd need already in the Item Model that lets you fetch items BY custom field(s). This is used exclusively by the searching for items by custom field functionality. This would still have to be further tweaked as it doesn't handle SORTING. The more I think of it while typing this, you'd probably have to write your own completely separate fetching method as the sorting method in the item model being used won't work for custom fields.

    This isn't something that I'd add to core, but am willing to add code to the model(s) if needed to help with peoples custom development towards stuff like this.
    tajhay likes this.
  3. Solari

    Solari Member AMS Premium RMS Premium SC Premium Sportsbook Pickem

    Late to the party, but definitely would like sorting by custom fields. One use of the Showcase I see is for showing lists of football players sorted by position.

  4. Bob

    Bob Developer Staff Member

    This is not possible. The latest version of Showcase 2.x does have Filtering by custom fields however.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.