From 6cea66126aac57894b101ad8e77ceee21fb8ab27 Mon Sep 17 00:00:00 2001 From: Tom Bartelt Date: Tue, 22 Sep 2026 21:21:38 +0200 Subject: [PATCH] fix(kasse): HTTP 500 in der Gast-Kasse bei leerem Land - Country::getShippingAreaById: Land/Gruppe als int, leeres Land -> false statt 'WHERE id = ' (SQL-Fatal, leere Seite, 16x seit 03.09.2026) - manage_guest_order_address: Lieferadresse = Rechnungsadresse ohne Land -> Standardland fuer die Versandgebiet-Suche --- core/country.class.php | 8 ++++++++ modules/website_cashdesk.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/core/country.class.php b/core/country.class.php index c8ac357..a422252 100644 --- a/core/country.class.php +++ b/core/country.class.php @@ -261,6 +261,14 @@ class Country extends Main { public static function getShippingAreaById($countryId, $customer_group_id = false) { $db = Registry::get('base')->db; + // 22.09.2026: leeres Land (Gast-Kasse per Enter abgeschickt, Land nicht gewaehlt) lief in + // "WHERE id = " und damit in einen SQL-Fatal -> HTTP 500 mit leerer Seite in der Kasse. + $countryId = (int) $countryId; + $customer_group_id = (int) $customer_group_id; + if ($countryId <= 0) { + return false; + } + $sql = "SELECT shipping_area_id FROM countries WHERE id = $countryId"; diff --git a/modules/website_cashdesk.php b/modules/website_cashdesk.php index 7e95802..a6d3b7b 100644 --- a/modules/website_cashdesk.php +++ b/modules/website_cashdesk.php @@ -694,6 +694,10 @@ class website_cashdesk { if (isset($_POST['shipping']) && $_POST['shipping']['address'] == -1) { $this->shipping_address = $_POST['billing']; + if (empty($this->shipping_address['country'])) { + // 22.09.2026: Land nicht gewaehlt -> Standardland fuer die Versandgebiet-Suche, sonst SQL-Fatal + $this->shipping_address['country'] = $this->customer_data->default_address_country_id; + } $_POST['shipping'] = $_POST['billing']; } else if (isset($_POST['shipping'])) { if (!$this->shipping_address['country']) {