hannhimhe Posted February 20, 2013 Share Posted February 20, 2013 I would like the attribute values in blocklayered to be displayed in the order I have chosen in BO. Heavy SQL-queries are not really an issue for me but I simply can not seem to figure this one out myself. public function indexAttribute($id_product = null) { if (is_null($id_product)) Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'layered_product_attribute'); else Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_product_attribute WHERE id_product = '.(int)$id_product); Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'layered_product_attribute` (`id_attribute`, `id_product`, `id_attribute_group`, `id_shop`) SELECT pac.id_attribute, pa.id_product, ag.id_attribute_group, '.(version_compare(_PS_VERSION_,'1.5','>') ? 'product_attribute_shop.`id_shop`' : '1').' FROM '._DB_PREFIX_.'product_attribute pa '.(version_compare(_PS_VERSION_,'1.5','>') ? Shop::addSqlAssociation('product_attribute', 'pa') : '').' INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_product_attribute = pa.id_product_attribute INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute = pac.id_attribute) INNER JOIN '._DB_PREFIX_.'attribute_group ag ON ag.id_attribute_group = a.id_attribute_group '.(is_null($id_product) ? '' : 'AND pa.id_product = '.(int)$id_product).' GROUP BY a.id_attribute, pa.id_product '.(version_compare(_PS_VERSION_,'1.5','>') ? ', product_attribute_shop.`id_shop`' : '')); return 1; } Is there anyone out there who has a fix for this? Link to comment Share on other sites More sharing options...
hannhimhe Posted March 2, 2013 Author Share Posted March 2, 2013 The current order shown in my shop is: Attribute 1 40 30 20 60 Attribute 2 Small 40-42 60-62 Medium 44-46 52-54 Large X-large 48-50 56-58 It looks really bad. I can ofcourse delete them all and recreate them and make sure I do so in the correct order. But it would feel much better to have blocklayered to display the attribute values in the same order as in back office. The position is already stored in the database. Link to comment Share on other sites More sharing options...
Recommended Posts