sbm Posted October 4, 2012 Share Posted October 4, 2012 Hello, How to order the brands and the manufacturers by the number of products they have?? Thanks for you help, Steven Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted October 5, 2012 Share Posted October 5, 2012 Hi Steven, You need to change the Manufacturer::getManufacturers() function realisation Please, view the example: Manufacturer::getManufacturers(){ .... self::sortArrayByAttribute($manufacturers, 'nb_products'); .... } public static function sortArrayByAttribute(&$array, $attribute, $type = 'desc') { return usort($array, create_function('$a, $b','return $a["' . $attribute . '"] ' . ($type == 'asc' ? '>' : '<') . ' $b["' . $attribute . '"];')); } Best regards Link to comment Share on other sites More sharing options...
sbm Posted October 5, 2012 Author Share Posted October 5, 2012 Hi Valerie, Please, where do I find the code you mention? What you put there is what I need to add, change....??? Thanks a lot for your help, Steven Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted October 9, 2012 Share Posted October 9, 2012 Hi Steven, The code can be found in manufacturer.php class. You can view the example above for more information. Best regards Link to comment Share on other sites More sharing options...
sbm Posted October 23, 2012 Author Share Posted October 23, 2012 what exactly do I need to change please??? thanks, Steven Link to comment Share on other sites More sharing options...
Recommended Posts