Jump to content

[Solved] Sort product features on comparsion page


Coldlaw

Recommended Posts

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

  • 1 year later...

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

  • 6 months later...

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...