Sorting Products By Custom Fields
Overview
Miva 10.00.05 introduces new functionality to allow customers to sort a list of products such as a category or
search results page by a custom product field.
For example, if you have a custom product field called Brand you can now make brand a sortable value similar or
how customers already can sort the products by price, name, code or bestselling. This is different from a facet
or filter which limits the results to only show products matching that selected facet. When you sort by a custom
field, the entire result set is displayed, just sorted ascending or descending by the custom field you selected.
Setup & Configuration
To enable sorting by custom fields you need to modify your page template on CTGY or SRCH to add the custom fields
to your sort by select input. The default code looks like below. In this example "tea_caffine" is the custom
product field code.
There are two options sorting custom fields, either ascending or descending. You can choose to only use one, or
both. The first sort option sorts the products accending and the second option which has "customfield_desc:" is the decending sort.
Note: Sorting by custom fields is currently supported on CTGY & SRCH. It is not currently supported on ReadyTheme
Product Listing Components.
Point & Click Settings
There are admin UI settings in point in click mode which will automatically output the code needed in the page
template. However, this does rewrite the page template back to default CSSUI. This can be useful to generate the
code you need, then copy and paste it into your themes template.
Default Sort Method
Now that custom fields are sortable fields on product lists, you can also set the default sort for when the page
loads to be one of them. Just keep in mind, this does have a negative impact on overall page load performance
compared to the default sort.