In case anybody is looking to sort manufacturer list on left column in prestashop 1.6 by the highest product count, here's the code to put into /override/modules/blockmanufacturer/blockmanufacturer.php (create if doesn't exist):
class BlockManufacturerOverride extends BlockManufacturer
{
public function hookLeftColumn($params)
{
if (!$this->isCached('blockmanufacturer.tpl', $this->getCacheId())) {
$manufacturers = Manufacturer::getManufacturers(true);
if (count($manufacturers)) {
usort($manufacturers, function ($a, $b) {
return strnatcmp(strval($b["nb_products"]), strval($a["nb_products"]));
});
}
foreach ($manufacturers as &$manufacturer) {
$manufacturer['image'] = $this->context->language->iso_code.'-default';
if (file_exists(_PS_MANU_IMG_DIR_.$manufacturer['id_manufacturer'].'-'.ImageType::getFormatedName('medium').'.jpg')) {
$manufacturer['image'] = $manufacturer['id_manufacturer'];
}
}
$this->smarty->assign(array(
'manufacturers' => $manufacturers,
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'),
'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS'),
));
}
return $this->display(__FILE__, 'blockmanufacturer.tpl', $this->getCacheId());
}
}