Forums / Zen Cart Code Suggestions / Sorting rules in Index Filters

Sorting rules in Index Filters

Views: 252

Results 1 to 4 of 4
6 Oct 2025, 10:39 AM
#1
yesaul avatar

yesaul

New Zenner

Join Date:
Apr 2011
Location:
Espoo, Finland
Posts:
73
Plugin Contributions:
0

Sorting rules in Index Filters

Good day,

As sort_order is a standard column in categories table, why $options array is being created for categories in alphabetical order in default_filter.php?

(I mean "ORDER BY cd.categories_name" clause in $filterlist_sql request)

IMHO something like "ORDER BY c.sort_order" or "ORDER BY c.sort_order, cd.categories_name" would look more reasonable

Or in case there are any reasons (which I missed as not very experienced user) to have this request 'as it is now', could respected developers please add another one notifier for $filterlist_sql (as it is already done for $listing_sql string) ??

Thank you

6 Oct 2025, 4:06 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,110
Plugin Contributions:
56

Re: Sorting rules in Index Filters

Noting that there's already such a notification in /includes/index_filters/default_filter.php (line 148 in zc210):

$zco_notifier->notify('NOTIFY_PRODUCT_LISTING_QUERY_STRING', ['default'], $listing_sql, $where_str, $order_by);

My bad; this is the notifier to which you referred in your original post.

6 Oct 2025, 4:24 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,110
Plugin Contributions:
56

Re: Sorting rules in Index Filters

The **$filterlist_sql **simply grabs a list of either categories or manufacturers to be used in a dropdown filter. I'm guessing that the reason that the sort-order isn't part of the order-by clause is that the result could be confusing to a customer.

Having the dropdown list in alphabetic order seems more natural/intuitive.

6 Oct 2025, 4:48 PM
#4
yesaul avatar

yesaul

New Zenner

Join Date:
Apr 2011
Location:
Espoo, Finland
Posts:
73
Plugin Contributions:
0

Re: Sorting rules in Index Filters

Just imagine, somebody is using $options array not for standard dropdown menu... :blush:

Anyway, thank you for your reply

Actually, the best solution (for me) seems to prepare customized array (according to specific requirements) in separate module

Notifier would be helpful anyway... :yes: