[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Admin UI - Multiple select - Mysql multiple records update
Hello,
I search thru the list and doesn't find something enough details (The
trouble is not the list but ONLY my knowledge !!) to do the following
thing :
I set up a store wich sells dvd's.
One dvd can be in multiple "genres"
Then I use 3 tables (mysql):
products
sku ..................
A0001 ..................
A0002 ..................
A0003 ..................
produits_genres
id genre_id sku
01 1 A0001
02 2 A0001
03 1 A0002
04 1 A0003
05 2 A0003
genres
id_genre nom_genre
1 Fantastic
2 Action
I've create a new menu in icmenu to display a "Genres" link in the
Item_edit submenu.
This link call a page called "item_genres" with the following code:
[if !cgi item_id]
[bounce page="__UI_BASE__/item"]
[/if]
[calc]
if(! $CGI->{mv_data_table}) {
$CGI->{ui_hide_key} = 0;
$CGI->{mv_data_table} = 'produits_genres';
}
if(! $CGI->{ui_data_fields}) {
$CGI->{ui_data_fields} = '[db-columns name=produits_genres]';
$CGI->{ui_display_only} = '';
}
if(! $CGI->{ui_break_before}) {
$CGI->{ui_break_before} = '';
}
if(! $CGI->{ui_return_to}) {
my @args = (
'__UI_BASE__/item_edit',
"item_id=$CGI->{item_id}",
"item_id_left=$CGI->{item_id_left}",
"ui_sequence_edit=$CGI->{ui_sequence_edit}",
);
$CGI->{ui_return_to} = join "\0", @args;
}
return;
[/calc]
[seti page_title]Genres: [cgi item_id][/seti]
[seti page_banner]Genres: edit item <B>[page
href="__UI_BASE__/item_edit" form="item_id=[cgi item_id]"][cgi
item_id]</A></B>[/seti]
[set help_name]item.editor[/set]
[set table_perm]inventory[/set]
[set icon_name]icon_item.gif[/set]
@_UI_STD_HEAD_@
<P>
[table-editor cgi=1]
[if-mm super]
<A HREF="[area href=admin/flex_editor
form='
item_id=[cgi item_id]
mv_data_table=__ProductFiles_0__
page_title=Edit items: [cgi item_id]
help_name=inventory.edit
ui_no_meta_display=1
ui_hide_key=1
ui_return_to=admin/item
icon_name=icon_item.gif
']">No meta display</A>
[/if-mm]
@_UI_STD_FOOTER_@
<!-- page: @@MV_PAGE@@ -->
Here is the display:
Genres: edit item ADE0001
id 1
Genres Fantastic <selected>
Action
sku ADE0001
When I select only "Action" and save, the two records in the
"produits_genres" database are updated with the same value "2".
When after I select the two "Genres" (Fantastic and Action) the two
records in the "produits_genres" database (with A0001 sku) are updated
with the same value "1".
I try to use the null_to_comma filter option in the "multiple select"
control parameters but the result is the same.
The my question is the following:
How to setup the admin/item_genres page to
-first display a the correct selected choice in the "multiple select"
control according to the database example shown at ther begin of this mail.
-second, but I think the answer will be very similar, how to update the
"produits-genres" database content ?
Your help will be much helpfull than u can think.
Merci par avance.
Alain