[calc] $Values->{mv_data_table} = $CGI->{mv_data_table} = 'variable'; $CGI->{no_dbmenu} = 1; return; [/calc] [flag type=write table=variable] [set table_perm]1[/set] [set ui_class]Admin[/set] [set page_title][L]Tax configuration[/L][/set] [set help_name]tax.main[/set] [set icon_name]icon_config.gif[/set] @_UI_STD_HEAD_@ [perl tables=variable] delete $Scratch->{changes}; return unless $CGI->{tax_format} eq 'do'; for (my $i = 0; $i < 1000; $i++) { last unless defined $CGI->{"taxarea$i"}; next if defined $CGI->{"Delete$i.x"}; my $area = $CGI->{"taxarea$i"}; my $rate = $CGI->{"taxrate$i"}; my $ship = $CGI->{"taxship$i"}; push @areas, ($area || 'new'); push @rates, "$area=$rate"; push (@taxes, $area) if $CGI->{"taxship$i"}; } $Scratch->{taxarea} = join " ", @areas; $Scratch->{taxrate} = join ",", @rates; $Scratch->{taxship} = join " ", @taxes; $Scratch->{changes} = 1; return; [/perl] [if scratch changes] [/if] [if type=explicit compare=| [newer source=__UI_PRODUCT_DIR__/variable.txt target=`"$Config->{ConfDir}/status.$Config->{CatalogName}"` ] |] [value name=ui_changes_made set=1 hide=1] You need to [page __UI_BASE__/reconfig @@MV_PAGE@@]apply changes for changes to take effect. [/if] [calc] @areas = grep /\S/, split /\s+/, tag_data(qw/variable Variable TAXAREA/); @rates = grep /\S/, split /,/, tag_data(qw/variable Variable TAXRATE/); my $taxship = tag_data(qw/variable Variable TAXSHIPPING/); $taxship = " $taxship "; my $i; my $last = -1; for ($i = 0; $i < scalar @areas; $i++) { my $rate = $rates[$i]; $rate =~ s/.*=//; $rate =~ s/[^\d.]//g; my $ship = ($taxship =~ / $areas[$i] /i) ? $areas[$i] : ''; push @out, "$i\t$areas[$i]\t$rate\t$ship"; $last = $i; } if ($CGI->{addnewtax}) { $last++; push @out, "$last\tnew"; } $Scratch->{its} = join "\n", @out; return; [/calc]

[form-session-id]

[L]Location[/L] | [L]Tax Rate[/L] (%) | [L]Apply tax to shipping charge[/L] |
[loop lr=1 list="[scratch its]"]
[/loop]

[button text="[L]Update[/L]"] mv_todo=return [/button] @_UI_STD_FOOTER_@