Sort Order for product listing pages
Products shown on a product listing page are sorted in one of two ways:
- Using the per-product sort order set on the product editing page.
- Using the value PRODUCT_LISTING_DEFAULT_SORT_ORDER from the Admin > Configuration > Product Listing page.
PRODUCT_LISTING_DEFAULT_SORT_ORDER is set to blank, the per-product sort order is used.
When it is non-blank, it is interpreted as follows:
There are a list of Display field name settings on the Admin > Configuration > Product Listing page. In 1.5.7, they are:
- Display Product Image
- Display Product Manufacturer Name
- Display Product Model
- Display Product Name
- Display Product Price/Add to Cart
- Display Product Quantity
- Display Product Weight
The settings for each of these values (0 or non-zero) determine whether or not this column will be shown on a product listing page. For specifics, see Product Listing Configuration Settings.
The configuration settings with non-zero values are ordered according to their setting. Then the sort is done using the field number specified in the first character of
PRODUCT_LISTING_DEFAULT_SORT_ORDER, in ascending or descending order according to the second character.
This is best illustrated by an example. Consider the following configuration:
This shows that the listing page will display four fields per row, in the following order:
- product image
- product name
- product price / add to cart
- product quantity in stock
If the value of
PRODUCT_LISTING_DEFAULT_SORT_ORDER is blank, the rows will be sorted according to the per product sort order and product name. Since frequently per product sort order is zero, this means the products are shown sorted by name, like this:
But if the
PRODUCT_LISTING_DEFAULT_SORT_ORDER value is 4d, the products are shown sorted by the 4th displayed field (product quantity) in descending order. The result will look like this: