2nd update

This commit is contained in:
“VeLiTi”
2025-05-26 15:07:22 +02:00
parent cd0e04981c
commit 580f835fff
46 changed files with 16006 additions and 952 deletions

View File

@@ -38,14 +38,6 @@ $checkout_input = [
// Error array, output errors on the form
$errors = [];
//CALL TO API FOR shipping
$api_url = '/v2/taxes/';
$countries = ioAPIv2($api_url,'',$clientsecret);
//Decode Payload
if (!empty($countries)){$countries = json_decode($countries,true);}else{$countries = null;}
//CountryID mapping
$countryMap = array_column($countries, 'country', 'id');
// ---------------------------------------------
// End defaults --------------------------------
// ---------------------------------------------
@@ -367,15 +359,17 @@ if (isset($_POST['method'], $_POST['first_name'], $_POST['last_name'], $_POST['a
$terms_link = url('index.php?page=termsandconditions');
template_header(($checkout_header ?? 'Checkout'));
$view = template_header(($checkout_header ?? 'Checkout'),'');
$view = '
$view .= '
<div class="checkout content-wrapper">
<h1>'.$h1_checkout.'</h1>
<p class="error">'.implode('<br>', $errors).'</p>';
<h1>'.$h1_checkout.'</h1>';
if (!empty($errors) || count($errors) > 0){
$view .= '<p class="error">'.implode('<br>', $errors).'</p>';
}
if (!isset($_SESSION['account_loggedin'])){
$view .= '<p>'.$account_available.' <a href="'.url('index.php?page=myaccount').'">'.$account_log_in.'</a></p>';
}
@@ -459,8 +453,8 @@ $view .= '
<label for="address_country">'.$shipping_country.'</label>
<select name="address_country" class="ajax-update form-field" required>';
foreach($countries as $country){
$view .= ' <option value="'.$country['id'].'" '.($country['id']==$account['address_country'] ? ' selected' : '').'>'.(${$countryMap[$country['id']]} ?? $countryMap[$country['id']]).'</option>';
foreach($countries_in_scope as $key => $value){
$view .= ' <option value="'.$key.'" '.($key==$account['address_country'] ? ' selected' : '').'>'.(${$value} ?? $value).'</option>';
}
$view .= ' </select>
@@ -547,7 +541,7 @@ $view .= ' </div>
</div>
<div class="buttons">
<button type="submit" name="checkout" class="btn">'.$btn_place_order.'</button>
<button type="submit" name="checkout" class="checkout_btn">'.$btn_place_order.'</button>
</div>
</div>
@@ -558,9 +552,9 @@ $view .= ' </div>
</div>';
$view .= template_footer();
//OUTPUT
echo $view;
template_footer();
?>