diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-07 23:03:09 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-07 23:03:09 +0800 |
commit | 7a2a4da3e91d0aa5a681f063845b68f4e49ea704 (patch) | |
tree | 49997dc99ce1d3d8830f8d50f81409a469e0102e | |
parent | 734f09ad906971219b700ee8ce67a0e4e70f5ea2 (diff) |
Anteraja cost usertag
-rw-r--r-- | products/ship/shipping.asc | 5 | ||||
-rw-r--r-- | usertag/anteraja_cost.tag | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/products/ship/shipping.asc b/products/ship/shipping.asc new file mode 100644 index 0000000..fced578 --- /dev/null +++ b/products/ship/shipping.asc @@ -0,0 +1,5 @@ +anteraja: Anteraja + crit weight + min 1000 + max 50000 + cost f [anteraja_cost district='[evalue address3]' city='[evalue city]' province='[evalue state]' weight=@@TOTAL@@] diff --git a/usertag/anteraja_cost.tag b/usertag/anteraja_cost.tag new file mode 100644 index 0000000..0cb143b --- /dev/null +++ b/usertag/anteraja_cost.tag @@ -0,0 +1,16 @@ +UserTag anteraja_cost Order prod_group district city province weight +UserTag anteraja_cost Routine <<EOR +sub { + my ($prod_group, $district, $city, $province, $weight) = @_; + my @provisions = ( "__ANTERAJA_BASE_PATH__", "__ANTERAJA_ACCESS_KEY_ID__", + "__ANTERAJA_SECRET_ACCESS_KEY__" ); + my $origin = $Tag->query({sql => "SELECT code FROM \ + shipping WHERE district='". __DISTRICT__ ."' AND city='" + . __CITY__ . "' AND province='" . __PROVINCE__ . "'", wantarray + => 1})->[0]->[0]; + my $destination = $Tag->query({sql => "SELECT code FROM shipping WHERE district='" . $district + . "' AND city='" . $city . "' AND province='" . $province . "'", + wantarray=> 1})->[0]->[0]; + return $Tag->pikul_cost(0, \@provisions, "$origin", "$destination", $weight, 'REG'); +} +EOR |