fix(artikel): attribute_7 nur als Ziffernfolge in die SQL (Leerzeichen => HTTP 500); zieht Live-Haertung vom 25.08. (Grundpreis-Teiler) nach
This commit is contained in:
@@ -52,8 +52,12 @@ if (strlen($obj->number) >= 8 || !empty($obj->attribute_7)) {
|
|||||||
$ersatzteil_ids = array();
|
$ersatzteil_ids = array();
|
||||||
|
|
||||||
// Query 1A: Legacy Items (über attribute_7)
|
// Query 1A: Legacy Items (über attribute_7)
|
||||||
if (!empty($obj->attribute_7)) {
|
// 27.09.2026: navisionid ist bigint -- nur eine echte Ziffernfolge in die SQL. Artikel 832247
|
||||||
$sql1a = "SELECT id FROM krempl_passendwie WHERE navisionid = ".$this->db->real_escape_string($obj->attribute_7);
|
// hatte ein einzelnes Leerzeichen in attribute_7 (truthy, aber "navisionid = " => SQL-Fehler,
|
||||||
|
// Artikelseite HTTP 500, 14x im fatal.log seit 22.09.).
|
||||||
|
$attr7 = trim((string)$obj->attribute_7);
|
||||||
|
if ($attr7 !== '' && ctype_digit($attr7)) {
|
||||||
|
$sql1a = "SELECT id FROM krempl_passendwie WHERE navisionid = ".$attr7;
|
||||||
$result1a = $this->db->query($sql1a);
|
$result1a = $this->db->query($sql1a);
|
||||||
if ($result1a) {
|
if ($result1a) {
|
||||||
while ($row = $result1a->fetch_assoc()) {
|
while ($row = $result1a->fetch_assoc()) {
|
||||||
@@ -229,11 +233,32 @@ $int = $this->createIntWithTableData($html);
|
|||||||
|
|
||||||
|
|
||||||
// base price calc
|
// base price calc
|
||||||
if ($obj->attribute_11 && $obj->attribute_15) {
|
//
|
||||||
$obj->sample_unit = $obj->attribute_15;
|
// 25.08.2026 gehaertet. Vorher wurde nur auf "truthy" geprueft -- und zwei Sorten
|
||||||
if (strstr($obj->sample_unit, '100')) {
|
// gepflegter Werte sind truthy, ohne rechenbar zu sein:
|
||||||
$obj->sample_price = $obj->shop_price_1 / ($obj->attribute_11 * 10);
|
//
|
||||||
|
// " " (Artikel 831966, beide Felder ein Leerzeichen)
|
||||||
|
// PHP 8: float / " " => TypeError => Artikelseite mit HTTP 500 tot.
|
||||||
|
// Unter PHP 7 lief das als Warnung durch -- ein Migrationsueberbleibsel.
|
||||||
|
//
|
||||||
|
// "2,5" (24 aktive Artikel, Komma statt Punkt)
|
||||||
|
// PHP 8 nimmt den fuehrenden Teil und rechnet mit 2 statt 2,5. Kein Fehler,
|
||||||
|
// aber ein um 25 % zu hoher Grundpreis -- und wegen error_reporting(0) in
|
||||||
|
// index.php sieht das niemand.
|
||||||
|
//
|
||||||
|
// Deshalb: Komma normalisieren, numerisch pruefen, und erst dann rechnen. Ist der
|
||||||
|
// Teiler unbrauchbar, bleibt sample_price schlicht ungesetzt -- besser kein Grundpreis
|
||||||
|
// als ein falscher (Preisangabenverordnung).
|
||||||
|
$grundpreis_teiler = str_replace(',', '.', trim((string)$obj->attribute_11));
|
||||||
|
$grundpreis_einheit = trim((string)$obj->attribute_15);
|
||||||
|
|
||||||
|
if (is_numeric($grundpreis_teiler) && (float)$grundpreis_teiler > 0 && $grundpreis_einheit !== '') {
|
||||||
|
$grundpreis_teiler = (float)$grundpreis_teiler;
|
||||||
|
$obj->sample_unit = $obj->attribute_15;
|
||||||
|
|
||||||
|
if (strstr($grundpreis_einheit, '100')) {
|
||||||
|
$obj->sample_price = $obj->shop_price_1 / ($grundpreis_teiler * 10);
|
||||||
} else {
|
} else {
|
||||||
$obj->sample_price = $obj->shop_price_1 / $obj->attribute_11;
|
$obj->sample_price = $obj->shop_price_1 / $grundpreis_teiler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user