[strip interpolate=1] [comment]See below, this seems to be the only way this will work[/comment] [tag flag write]options[/tag] [if cgi mv_more_ip][/if] [calc] $CGI->{item_id} = $CGI->{sku} if $CGI->{sku} and ! $CGI->{ignore_sku}; $CGI->{ui_meta_view} = 'optmaster'; $CGI->{mv_data_table} = '@_MV_OPTION_TABLE_@' || 'options'; $CGI->{ui_display_only} = '__ProductFiles_0__:__DescriptionField__'; return; [/calc] [if cgi item_id] [flag type=write table="[cgi mv_data_table]"] [/if] [if cgi setting] [tmp hide_results] [if cgi setting eq 'none'] [record table="[cgi mv_data_table]" col.o_enable=0 col.o_master=0 col.o_modular=0 col.o_matrix=0 key="[cgi item_id]" ] [elsif cgi setting eq 'simple'] [record table="[cgi mv_data_table]" col.o_enable=1 col.o_master=1 col.o_modular=0 col.o_matrix=0 key="[cgi item_id]" ] [/elsif] [elsif cgi setting eq 'matrix-separate'] [record table="[cgi mv_data_table]" col.o_enable=1 col.o_master=1 col.o_modular=0 col.o_matrix=2 key="[cgi item_id]" ] [/elsif] [elsif cgi setting eq 'matrix'] [record table="[cgi mv_data_table]" col.o_enable=1 col.o_master=1 col.o_modular=0 col.o_matrix=1 key="[cgi item_id]" ] [/elsif] [elsif cgi setting eq 'modular'] [record table="[cgi mv_data_table]" col.o_enable=1 col.o_master=1 col.o_modular=1 col.o_matrix=0 key="[cgi item_id]" ] [/elsif] [/if] [/tmp] [/if] [tmp page_title] [either] [cgi page_title] [or] Item option editor: [data table="products" col="description" key="[cgi item_id]"] ([cgi item_id]) [/either] [/tmp] [tmp page_banner] [either] [cgi page_banner] [or] [cgi page_title] [or] Item option editor: [data table="products" col="description" key="[cgi item_id]"] ([cgi item_id]) [/either] [/tmp] [tmp help_name][either][cgi help_name][or]item.option[/either][/tmp] [tmp icon_name][either][cgi icon_name][or]icon_item.gif[/either][/tmp] [set ui_class]Items[/set] [if-mm function="!tables" table="[cgi mv_data_table]"] [bounce page="__UI_BASE__/error"] [/if-mm] [perl tables="[cgi mv_data_table]"] $id = $CGI->{item_id}; my $db = $Db{$CGI->{mv_data_table}} or die "No options db?"; $CGI->{ui_data_fields} = 'code __ProductFiles_0__:__DescriptionField__ o_enable o_matrix o_modular'; if($db->record_exists($id) and $db->field($id, 'o_modular')) { $CGI->{ui_data_fields} .= ' sku o_master'; $CGI->{ui_options_modular} = 1; } return; [/perl] [if scratch ui_location] [bounce href=`delete $Scratch->{ui_location}`] [elsif !cgi mv_data_table] [bounce page="__UI_BASE__/gentable"] [/elsif] [/if] [/strip]@_UI_STD_HEAD_@

[if cgi ui_change_options] [tmp ui_change_options]1[/tmp] [/if] [if type="!data" term="[cgi mv_data_table]::o_enable::[cgi item_id]"] [tmp ui_change_options]1[/tmp] [tmp ui_never_options]1[/tmp] [/if] [if scratch ui_change_options] [then] ## [if scratch ui_never_options] [L]Select option type and/or enable options[/L] [else] [L]Select option type and/or disable options[/L] [/else][/if] [perl tables="[cgi mv_data_table]"] my $id = $CGI->{item_id}; my $tab = $CGI->{mv_data_table}; my $db = $Db{$tab} or return; # Set this up front, returns set 'none' type $Scratch->{setting} = 'none'; return unless $db->record_exists($id); my $record = $db->row_hash($id) or return; return unless $record->{o_enable}; if ($record->{o_modular}) { $Scratch->{setting} = 'modular'; } elsif($record->{o_matrix}) { $Scratch->{setting} = $record->{o_matrix} == 2 ? 'matrix-separate' : 'matrix'; } else { $Scratch->{setting} = 'simple'; } return; [/perl] [form-session-id] [L]No Options[/L] [L]Simple Options[/L] [L]Matrix Options, one widget[/L] [L]Matrix Options, separate widgets[/L] [L]Modular Options[/L] [button text="[L]Update[/L]" mv_check="[L]Update[/L]"] mv_todo=return mv_nextpage="@@MV_PAGE@@" [/button] [/then] [else] [loop list="[cgi item_id]"]
Option type: [if-loop-data @_MV_OPTION_TABLE_@ o_matrix] Matrix [tmp matrix_or_modular]1[/tmp] [if-loop-data @_MV_OPTION_TABLE_@ o_matrix == 2] (separate widgets) [/if-loop-data] [/if-loop-data] [if-loop-data @_MV_OPTION_TABLE_@ o_modular] [if-loop-data !@_MV_OPTION_TABLE_@ o_matrix] Modular [tmp matrix_or_modular]1[/tmp] [/if-loop-data] [/if-loop-data] [if !scratch matrix_or_modular] Simple [/if] [page href="@@MV_PAGE@@" form=" ui_change_options=1 item_id=[loop-code] "]Change
[/loop] [if type=data term="[cgi mv_data_table]::o_matrix::[cgi item_id]"] [include include/Options/old/item_option_matrix] [elsif type=data term="[cgi mv_data_table]::o_modular::[cgi item_id]"] [include include/Options/old/item_option_modular] [/elsif] [else] [include include/Options/old/item_option_simple] [/else] [/if] [/else] [/if]

@_UI_STD_FOOTER_@