This is kinda neat as it is a little annoying (to me at least) that manufacturers do not have sort orders and there fore can not be listed as per a sort order by default.
so if you're like me, here is a neat little fix that allows you to either sort ALL your manufactures of simply just bring a few to the top of the list (without having to rename them.)
lets assume that you have manufactures id's 1-5
- Ford
- Vauxhall
- Audi
- Seat
- Honda
when displayed they will show in this order:
3. Audi
- Ford
- Honda
- Seat
- Vauxhall
but what if you wanted to have Honda at the top followed by Ford and then everything else..
here's how...
backup includes/templates/YOUR_TEMPLATE/templates/tpl_dynamic_filter.php
open up includes/templates/YOUR_TEMPLATE/templates/tpl_dynamic_filter.php
find this:
```php
$manufacturers = $db->Execute("SELECT manufacturers_id, manufacturers_name, IF(manufacturers_id IN(" . implode(',', $filteredManufacturers) . "), 'Y', 'N') as flag" .
" FROM " . TABLE_MANUFACTURERS .
" WHERE manufacturers_id IN (" . implode(',', $unfilteredManufacturers) . ")" .
" ORDER BY manufacturers_name");
and replace with this:
```php
$manufacturers = $db->Execute("SELECT manufacturers_id, manufacturers_name, IF(manufacturers_id IN(" . implode(',', $filteredManufacturers) . "), 'Y', 'N') as flag" .
" FROM " . TABLE_MANUFACTURERS .
" WHERE manufacturers_id IN (" . implode(',', $unfilteredManufacturers) . ")" .
" ORDER BY FIELD(manufacturers_id,1,5) DESC");
so notice how we are replacing the standard ORDER BY manufacturers_name and now replacing it with
ORDER BY FIELD(manufacturers_id,1,5) DESC
by doing this we are able to specify the field we wish to sort by, in this case manufacturers_id and then we specify the order starting with the one you want at the very top furthest away.
so in this format:
ORDER BY FIELD({FEILD ID},{forth...},{third},{second},{first}) DESC
so now the order would be:
- Honda
- Ford
followed by the rest..
Hope someone finds this of use! :smile: