Zenith Posted September 11, 2010 Share Posted September 11, 2010 Possible on the attributes page to show the number of products an attribute in every group is linked to e.g.White (2)Black (3)Yellow (0)This would allow the deletion of unused attributes to be done with confidence, knowing that a product would not be upset.As products get deleted some attributes/attribute groups are no longer used and allowing the deletion of unused attributes would help keep the database streamlined.In “classes/AttributeGroup.php”Change (line 101): SELECT * FROM `’._DB_PREFIX_.’attribute` a LEFT JOIN `’._DB_PREFIX_.’attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = ‘.intval($id_lang).’) WHERE a.`id_attribute_group` = ‘.intval($id_attribute_group).’ ORDER BY `name`’); To: SELECT a.*, al.*, COUNT(pac.`id_attribute`) as count FROM `’._DB_PREFIX_.’attribute` a LEFT JOIN `’._DB_PREFIX_.’attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = ‘.intval($id_lang).’) LEFT JOIN `’._DB_PREFIX_.’product_attribute_combination` pac ON a.`id_attribute` = pac.`id_attribute` WHERE a.`id_attribute_group` = ‘.intval($id_attribute_group).’ GROUP BY a.`id_attribute` ORDER BY `name`’); In “admin/tabs/AdminAttributesGroups.php”Change (line 127): .$attribute[’name’].’ To: .$attribute[’name’].’ (’.$attribute[’count’].’) As far as I can tell this works correctly showing the amount of times the attribute is used in products without any side effects.Can someone test and confirm that it works for them....this would be a great addition to the core code. Link to comment Share on other sites More sharing options...
Recommended Posts