From 8d2476666edc596e5332cafe880f4103e70521ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Tue, 20 Jul 2021 22:38:18 +0800 Subject: Now the HTML is created in libpikul --- config/pikul.tag | 60 +++++++++++++++++++++++--------------------------------- 1 file changed, 24 insertions(+), 36 deletions(-) (limited to 'config') diff --git a/config/pikul.tag b/config/pikul.tag index 3c8f455..bbbbd8d 100644 --- a/config/pikul.tag +++ b/config/pikul.tag @@ -2,10 +2,6 @@ UserTag pikul Order widget extra UserTag pikul Routine <'; - } my $district = $Tag->value('address2'); my $city = $Tag->value('city'); my $province = $Tag->value('state'); @@ -13,40 +9,32 @@ sub { for my $item (@{$Carts->{main}}) { $weight += $Tag->data('products', 'weight', $item->{code}) * $item->{quantity}; } + my @provisions = ( + $Global::Variable->{ANTERAJA_ACCESS_KEY_ID}, + $Global::Variable->{ANTERAJA_SECRET_ACCESS_KEY}, + $Global::Variable->{ANTERAJA_BASE_PATH} + ); + my @code_prefixes = ( + 'anteraja_' + ); + my @name_prefixes = ( + 'Anteraja ' + ); use Pikul; - for (my $company = $::Variable->{PIKUL_ANTERAJA}; $company <= $::Variable->{PIKUL_ANTERAJA}; - $company++) { - my (@provisions, $origin, $table); - if ($company == $::Variable->{PIKUL_ANTERAJA}) { - @provisions = ( - $Global::Variable->{ANTERAJA_ACCESS_KEY_ID}, - $Global::Variable->{ANTERAJA_SECRET_ACCESS_KEY}, - $Global::Variable->{ANTERAJA_BASE_PATH} - ); - $origin = $::Variable->{ANTERAJA_ORIGIN}; - $table = 'anteraja'; - } - Pikul::init($company, \@provisions); - my @codes = @{Pikul::codes( - $origin, - $Tag->query({ sql => "SELECT code FROM $table WHERE district='$district' AND city='$city' \ + Pikul::init($::Variable->{PIKUL_ANTERAJA}, \@provisions); + my $elements = Pikul::html( + $::Variable->{ANTERAJA_ORIGIN}, + $Tag->query({sql => "SELECT code FROM anteraja WHERE district='$district' AND city='$city' \ AND province='$province'", wantarray => 1})->[0]->[0] || '', - $weight)}; - Pikul::cleanup(); - for my $code (@codes) { - if ($widget eq 'select') { - $elements .= q( - "; - } - } - } - if ($widget eq 'select') { - $elements .= q( - ); - } + $weight, + $widget, + $extra, + 'mv_shipmode', + $Tag->value('mv_shipmode'), + \@code_prefixes, + \@name_prefixes + ); + Pikul::cleanup(); return $elements; } EOR -- cgit v1.2.3