[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] [/then] [else] [loop list="[cgi item_id]"]
[/loop] [if type=data term="[cgi mv_data_table]::o_matrix::[cgi item_id]"] [include include/item_option_matrix] [elsif type=data term="[cgi mv_data_table]::o_modular::[cgi item_id]"] [include include/item_option_modular] [/elsif] [else] [include include/item_option_simple] [/else] [/if] [/else] [/if] |