PDA

View Full Version : Sorting Categories in search drop down combo box


devenh
4th of December 2006 (Mon), 13:12
I have a gallery that contains several categories:

http://www.biglens.com/gallery/list.php?exhibition=204

In the Category drop down combo box the categories are not sorted. How can I sort them?

Deven

Pekka
4th of December 2006 (Mon), 17:44
The code change (included in 2.02) is in list.php, change


$fetchcategories_sql = "
SELECT DISTINCT
ee_category_{$override_lang}.ee_category_name,
ee_category_{$override_lang}.ee_category_id,
ee_category_{$override_lang}.ee_category_descripti on
FROM
ee_category_{$override_lang},
ee_photo_to_category,
ee_photo,
ee_exhibition,
ee_photo_to_exhibition
WHERE
ee_photo.ee_photo_for_www = '1'
AND ee_category_{$override_lang}.ee_category_id = ee_photo_to_category.ee_category_id
AND ee_photo_to_category.ee_photo_id = ee_photo_to_exhibition.ee_photo_id
AND ee_photo.ee_photo_id = ee_photo_to_exhibition.ee_photo_id
AND ee_photo_to_category.ee_photo_id = ee_photo.ee_photo_id
AND ee_photo_to_exhibition.ee_exhibition_id = ee_exhibition.ee_exhibition_id
AND ee_exhibition.ee_exhibition_id = ee_photo_to_exhibition.ee_exhibition_id
{$categoryrule}
{$and_exhibition_ids_are}



to


$fetchcategories_sql = "
SELECT DISTINCT
ee_category_{$override_lang}.ee_category_name,
ee_category_{$override_lang}.ee_category_id,
ee_category_{$override_lang}.ee_category_descripti on
FROM
ee_category_{$override_lang},
ee_photo_to_category,
ee_photo,
ee_exhibition,
ee_photo_to_exhibition
WHERE
ee_photo.ee_photo_for_www = '1'
AND ee_category_{$override_lang}.ee_category_id = ee_photo_to_category.ee_category_id
AND ee_photo_to_category.ee_photo_id = ee_photo_to_exhibition.ee_photo_id
AND ee_photo.ee_photo_id = ee_photo_to_exhibition.ee_photo_id
AND ee_photo_to_category.ee_photo_id = ee_photo.ee_photo_id
AND ee_photo_to_exhibition.ee_exhibition_id = ee_exhibition.ee_exhibition_id
AND ee_exhibition.ee_exhibition_id = ee_photo_to_exhibition.ee_exhibition_id
{$categoryrule}
{$and_exhibition_ids_are}
ORDER BY ee_category_{$override_lang}.ee_category_name ASC

devenh
4th of December 2006 (Mon), 18:03
Works great -- Thanks!

You may want to consider forcing the 'All' choice to be always listed first and/or displaying it in a different color otherwise it sometimes becomes lost in the list.

Deven

Pekka
4th of December 2006 (Mon), 19:08
Works great -- Thanks!

You may want to consider forcing the 'All' choice to be always listed first and/or displaying it in a different color otherwise it sometimes becomes lost in the list.

Deven

That is the reason they were originally sorted by id. Now that they are alphabetical I must add some more code to stick ALL to top. That is not done yet.