diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-07 23:17:36 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-07 23:17:36 +0800 |
commit | 963bf867e6ad092bc26e4822b5edd1a893ffe2ad (patch) | |
tree | a2a7423ebffa94ea4a7d00d484c925e4b990e1a9 /include | |
parent | 7a2a4da3e91d0aa5a681f063845b68f4e49ea704 (diff) |
Province narrows down city narrows down district
Diffstat (limited to 'include')
-rw-r--r-- | include/checkout/shipping_address | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/include/checkout/shipping_address b/include/checkout/shipping_address index e5260f0..0c89e64 100644 --- a/include/checkout/shipping_address +++ b/include/checkout/shipping_address @@ -16,19 +16,39 @@ <input class="form-control" type="text" name="address1" placeholder="123 Main St." id="street_shipping" value="[evalue address1]"/> </div> <div class="form-group col-md-8"> + <label class="form-label" for="province_shipping">[L]City[/L]</label> + <select name="state" id="province_shipping" class="form-control" onchange="this.form.submit()"> + <option value="-- [L]Please select[/L] --">-- [L]Please select[/L] --</option>[perl products] +my $options = ''; +for my $province (@{$Tag->query({sql => "SELECT province FROM shipping GROUP BY province ORDER BY province"})}) { + $options .= qq( + <option value="$province->[0]") . ($province->[0] eq $Tag->value({keep => 1, filter => encode_entities, name => 'state'}) ? ' selected' : '') . ">$province->[0]</option>"; +} +return $options; +[/perl] + </select> + </div> + <div class="form-group col-md-8"> <label class="form-label" for="city_shipping">[L]City[/L]</label> <select name="city" id="city_shipping" class="form-control" onchange="this.form.submit()"> - <option value="-- [L]Please select[/L] --">-- [L]Please select[/L] --</option>[perl tables="products shipping"] + <option value="-- [L]Please select[/L] --">-- [L]Please select[/L] --</option>[perl products] +my $options = ''; +for my $city (@{$Tag->query({sql => "SELECT city FROM shipping WHERE province='" . $Tag->value({keep => 1, filter => encode_entities, name => 'state'}) . "' GROUP BY city ORDER BY city"})}) { + $options .= qq( + <option value="$city->[0]") . ($city->[0] eq $Tag->value({keep => 1, filter => encode_entities, name => 'city'}) ? ' selected' : '') . ">$city->[0]</option>"; +} +return $options; +[/perl] + </select> + </div> + <div class="form-group col-md-8"> + <label class="form-label" for="district_shipping">[L]City[/L]</label> + <select name="address3" id="district_shipping" class="form-control" onchange="this.form.submit()"> + <option value="-- [L]Please select[/L] --">-- [L]Please select[/L] --</option>[perl products] my $options = ''; -for my $zone_group (@{$Tag->query({sql => "SELECT zone_group FROM cpa GROUP BY zone_group ORDER BY zone_group"})}) { -$options .= qq( - <optgroup label="$zone_group->[0]">); - for my $zone (@{$Tag->query({sql => "SELECT zone FROM cpa WHERE zone_group='$zone_group->[0]'"})}) { - $options .= qq( - <option value="$zone->[0]") . ($zone->[0] eq $Tag->value({keep => 1, filter => encode_entities, name => city}) ? ' selected' : '') . ">$zone->[0]</option>"; - } - $options .= q( - </optgroup>); +for my $district (@{$Tag->query({sql => "SELECT district FROM shipping WHERE city='" . $Tag->value({keep => 1, filter => encode_entities, name => 'address3'}) . "' GROUP BY district ORDER BY district"})}) { + $options .= qq( + <option value="$district->[0]") . ($district->[0] eq $Tag->value({keep => 1, filter => encode_entities, name => 'district'}) ? ' selected' : '') . ">$district->[0]</option>"; } return $options; [/perl] |