Coldlaw Posted May 10, 2011 Share Posted May 10, 2011 How to sort by name pruduct features on product comparsion page?I searched in product-comparsion.php, CompareController.php but i doesn't found it.Anybody can help me? Link to comment Share on other sites More sharing options...
Coldlaw Posted May 10, 2011 Author Share Posted May 10, 2011 Ohh , I found it.In the Feature.php funtion of getFeaturesForComparison moded it: public static function getFeaturesForComparison($list_ids_product, $id_lang) { $ids = ''; foreach($list_ids_product as $id) $ids .= (int)($id).','; $ids = rtrim($ids, ','); if (empty($ids)) return false; return Db::getInstance()->ExecuteS(' SELECT * , COUNT(*) as nb FROM `'._DB_PREFIX_.'feature` f LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON f.`id_feature` = fp.`id_feature` LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON f.`id_feature` = fl.`id_feature` WHERE fp.`id_product` IN ('.$ids.') AND `id_lang` = '.(int)($id_lang).' GROUP BY f.`id_feature` ORDER BY `name` ASC'); }} Link to comment Share on other sites More sharing options...
guillenqn Posted July 6, 2012 Share Posted July 6, 2012 Could you tell me the location of those files please? Link to comment Share on other sites More sharing options...
nadie Posted July 7, 2012 Share Posted July 7, 2012 Could you tell me the location of those files please? The file: Feature.php is in the directory called /classes/ Sorry for my English Link to comment Share on other sites More sharing options...
guillenqn Posted July 7, 2012 Share Posted July 7, 2012 Ohh , I found it. In the Feature.php funtion of getFeaturesForComparison moded it: public static function getFeaturesForComparison($list_ids_product, $id_lang) { $ids = ''; foreach($list_ids_product as $id) $ids .= (int)($id).','; $ids = rtrim($ids, ','); if (empty($ids)) return false; return Db::getInstance()->ExecuteS(' SELECT * , COUNT(*) as nb FROM `'._DB_PREFIX_.'feature` f LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON f.`id_feature` = fp.`id_feature` LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON f.`id_feature` = fl.`id_feature` WHERE fp.`id_product` IN ('.$ids.') AND `id_lang` = '.(int)($id_lang).' GROUP BY f.`id_feature` ORDER BY `name` ASC'); } } Great! Worked for me. New question, is it possible to sort the features by the ID order, not alphabetically? Sorry for my English. Link to comment Share on other sites More sharing options...
logs00 Posted January 15, 2013 Share Posted January 15, 2013 Thanks !!! It's work for me too and it's work on PS 1.5.2 ;-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now