summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-20 14:50:48 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-20 14:50:48 +0800
commit488e6e8145ce64dd124ba6187a5d7b5813bb927b (patch)
tree3a81f24f4273fad235e9d0f1b82ffcf737fd96b2
parent0550cb43f08b97292639f800512df3965ee96df1 (diff)
Trying to get weight shouldn't be the template user's concern
-rw-r--r--config/pikul_codes.tag8
-rw-r--r--pages/ord/checkout.html10
2 files changed, 8 insertions, 10 deletions
diff --git a/config/pikul_codes.tag b/config/pikul_codes.tag
index fb4a0e6..71fd5cc 100644
--- a/config/pikul_codes.tag
+++ b/config/pikul_codes.tag
@@ -1,7 +1,7 @@
-UserTag pikul-codes Order company district city province weight
+UserTag pikul-codes Order company district city province
UserTag pikul-codes Routine <<EOR
sub {
- my ($company, $district, $city, $province, $weight) = @_;
+ my ($company, $district, $city, $province) = @_;
my (@provisions, $origin, $table);
if ($company == $::Variable->{PIKUL_ANTERAJA}) {
@provisions = (
@@ -12,6 +12,10 @@ sub {
$origin = $::Variable->{ANTERAJA_ORIGIN};
$table = 'anteraja';
}
+ my $weight = 0.0;
+ for my $item (@{$Carts->{main}}) {
+ $weight += $Tag->data('products', 'weight', $item->{code}) * $item->{quantity};
+ }
use Pikul;
Pikul::init($company, \@provisions);
my @codes = @{Pikul::codes(
diff --git a/pages/ord/checkout.html b/pages/ord/checkout.html
index ae2e694..19617fe 100644
--- a/pages/ord/checkout.html
+++ b/pages/ord/checkout.html
@@ -84,14 +84,8 @@
<div class="container my-4">
<div class="block-body">
<div class="row">
- <div class="form-group col-md-6 d-flex align-items-center">[tmp weight][perl products]
- my $weight = 0.0;
- for my $item (@{$Carts->{main}}) {
- $weight += tag_data('products', 'weight', "$item->{code}") * $item->{quantity};
- }
- return $weight;
- [/perl][/tmp]
- [pikul_codes company="__PIKUL_ANTERAJA__" district="[value address2]" city="[value city]" province="[value state]" weight="[scratch weight]"]
+ <div class="form-group col-md-6 d-flex align-items-center">
+ [pikul_codes company="__PIKUL_ANTERAJA__" district="[value address2]" city="[value city]" province="[value state]"]
<label class="ml-3" for="ship_widget">
<strong class="d-block text-uppercase mb-2">[shipping-desc]</strong>
<span class="text-muted text-sm">