Sort Order for product listing pages

Changing how products are sorted on an index listing page

Products shown on a product listing page are sorted in one of two ways:

When 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:

Listing Page configuration



This shows that the listing page will display four fields per row, in the following order:

  1. product image
  2. product name
  3. product price / add to cart
  4. 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:

Listing Page sorted by product name

But if the PRODUCT_LISTING_DEFAULT_SORT_ORDER value is 4d, the products are shown sorted by the 4th displayed field (product quantity in stock) in descending order. The result will look like this:

Listing Page sorted by product name




Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified February 18, 2024 by Scott Wilson (07f9de6).