Jump to content

[SOLVED] How to order features in the product comparison page


Recommended Posts



PS 1.5.2


I finally found how to order features in the comparison product data sheet, without renaming features (i mean 01. 02. etc. as it is seen in some posts)


I don't konw if it is a good practice, but it works nice :)


edit the classes/Feature.php


around line 256 ( function GetFeaturesForComparison(..) )








ORDER BY f.`position` ASC


then, it will place features as they are ordered in your back end / features (drag/drop features to order them as you want)


Maybe it can be added in the next version, just to avoid an ugly unordered list in the comparison result, knowing that features are ordered in the back end/features conf page.



Edited by cybervirem (see edit history)
  • Like 5
Link to comment
Share on other sites

  • 1 month later...
  • 5 weeks later...

have a look to the original source code, in classes/feature.php (line 256) :


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`




we can see that "f" stands for table `'._DB_PREFIX_.'feature`, "fp" for `'._DB_PREFIX_.'feature_product`, etc.

(it's often used when you need to select from many tables)


so if you want to order by features, you need to change to ORDER BY f DESC (instead of ordering by number)

Link to comment
Share on other sites

  • 1 year later...
  • 7 months later...

Thanks for the solution,


it worked PS1.6 also.


I have organized a set of 98 features for our 2000+ catalog by manually setting the position valus in ps_feature table, this was what matters most will be on top everywhere, only the comparison was not following which is now solved thanks to this thread!


Good Luck



Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...