summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/pikul.tag56
1 files changed, 31 insertions, 25 deletions
diff --git a/config/pikul.tag b/config/pikul.tag
index ea279c2..343e50b 100644
--- a/config/pikul.tag
+++ b/config/pikul.tag
@@ -1,39 +1,45 @@
-UserTag pikul Order company
+UserTag pikul Order widget extra
UserTag pikul Routine <<EOR
sub {
- my ($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';
- }
+ my ($widget, $extra) = @_;
+ my $district = $Tag->value('address2');
+ my $city = $Tag->value('city');
+ my $province = $Tag->value('state');
my $weight = 0.0;
for my $item (@{$Carts->{main}}) {
$weight += $Tag->data('products', 'weight', $item->{code}) * $item->{quantity};
}
+ my $elements;
+ if ($widget eq 'select') {
+ $elements = '<select name="mv_shipmode"' . ($extra ? " $extra" : '') . '>';
+ }
use Pikul;
- Pikul::init($company, \@provisions);
- my $district = $Tag->value('address2');
- my $city = $Tag->value('city');
- my $province = $Tag->value('state');
- my @codes = @{Pikul::codes(
+ 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' \
AND province='$province'", wantarray => 1})->[0]->[0] || '',
$weight)};
- Pikul::cleanup();
- my $elements = '<select name="mv_shipmode" id="ship_widget" class="form-control" onchange="this.form.submit()">';
- for my $code (@codes) {
- $elements .= qq(
- <option name="mv_shipmode" value="$table)
- . qq(_$code")
- . ($Tag->value('mv_shipmode') eq $table . "_$code" ? ' selected' : '')
- . ">$table&nbsp;$code</option>";
+ Pikul::cleanup();
+ for my $code (@codes) {
+ $elements .= q(
+ <option value=")
+ . $table . qq(_$code")
+ . ($Tag->value('mv_shipmode') eq $table . "_$code" ? ' selected' : '')
+ . ">$table&nbsp;$code</option>";
+ }
}
$elements .= q(
</select>);