cyber83 Designer Fra Romania Medlem siden cyber83 5 feb. 2025 17:36 When Editing a new product At Options, when selecting from Attribute Groups (Options > Add Predefined Option Groups) , by clicking the --select-- button you can select a value from the already created attribute groups. Here the list is coming from Catalog > Attribute Group - Name field. What I'd like is that when the dropdown is clicked instead of the Name field , to show me the Code filed from Catalog > Attribute Group, - only here in admin . Why? I have many filters and I want to populate them somehow and when making a selection when editing a product by seeing the Code names it will be easier to scroll and find the filter At Catalog > Attribute Group I can group the Attributes by giving logical names for the Code column/fields. Example: CODE Car - color Car - type Car - brand etc. Bicycle - color Bicycle - type Bicycle - brand etc. (in this way the attributes are populated by product category simply from A-Z) And for the Name column/fields: Name Color Type Brand etc. .. as these will appear on the front when selection options when placing the order. What would be the right way achieving the above by following Litecart's coding guide? (This will do the trick for me, but for a long term solution having Attributes categories, subcategories, and subsubcategories where attributes are organised would be nice)
jackmaessen LiteCart Fan Fra Netherlands Medlem siden jackmaessen 5 feb. 2025 19:25 https://github.com/litecart/litecart/blob/dev/public_html/includes/functions/func_form.inc.php#L906 function form_draw_attribute_groups_list($name, $input=true, $multiple=false, $parameters='') { $query = database::query( "select ag.id, agi.name from ". DB_TABLE_PREFIX ."attribute_groups ag left join ". DB_TABLE_PREFIX ."attribute_groups_info agi on (agi.group_id = ag.id and agi.language_code = '". database::input(language::$selected['code']) ."') order by name;" ); $options = []; if (empty($multiple)) $options[] = ['-- '. language::translate('title_select', 'Select') . ' --', '']; while ($row = database::fetch($query)) { $options[] = [$row['name'], $row['id']]; } ... Add code to the function: function form_draw_attribute_groups_list($name, $input=true, $multiple=false, $parameters='') { $query = database::query( "select ag.id, ag.code, agi.name from ". DB_TABLE_PREFIX ."attribute_groups ag /*add ag.code */ left join ". DB_TABLE_PREFIX ."attribute_groups_info agi on (agi.group_id = ag.id and agi.language_code = '". database::input(language::$selected['code']) ."') order by name;" ); $options = []; if (empty($multiple)) $options[] = ['-- '. language::translate('title_select', 'Select') . ' --', '']; while ($row = database::fetch($query)) { $options[] = [$row['code'], $row['id']]; /*$row['code'] instead of $row['name]*/ } ...
cyber83 Designer Fra Romania Medlem siden cyber83 6 feb. 2025 10:25 Hi @jackmaessen - works ok thank you. A bit of a change needed so it work ok, please, if you could help i would greatly appreciate it: 1 - in Dashboard / Catalog / Attribute Groups page at the moment the entries / lines are organised A-Z by the NAME column I'd like the entries / lines to be organised A-Z by the CODE column 2 - In Dashboard / Catalog / Edit Product: (product name) at the OPTIONS tab: the <h2> option title </h2> is the Attribute name I'd like this to be also be the Attribute Code (The rest remains the same.. the ftont page to still show the Attribute Name as you changed that with the above code)
jackmaessen LiteCart Fan Fra Netherlands Medlem siden jackmaessen 7 feb. 2025 07:30 First already solved: https://github.com/litecart/litecart/blob/dev/public_html/admin/catalog.app/attribute_groups.inc.php#L18 change to order by ag.code asc;" need to figure out that...
cyber83 Designer Fra Romania Medlem siden cyber83 7 feb. 2025 09:04 Ive messaged you directly. Thanks for your help.