Fix potential undefined index notices in compare.php for attribute values
This commit is contained in:
parent
8ec5f4b3d6
commit
a7926ff900
@ -119,7 +119,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['remove_compare'])) {
|
||||
</tr>
|
||||
<?php foreach ($attributes as $attrId => $attr): ?>
|
||||
<tr>
|
||||
<td style="padding: 10px; border: 1px solid #334155; font-weight: bold; background: #0f172a;"><?= htmlspecialchars($attr['name']) ?></td>
|
||||
<td style="padding: 10px; border: 1px solid #334155; font-weight: bold; background: #0f172a;"><?= htmlspecialchars($attr['name'] ?? '') ?></td>
|
||||
<?php foreach ($productIds as $pId): ?>
|
||||
<?php if (!isset($products[$pId])) continue; ?>
|
||||
<td style="padding: 10px; border: 1px solid #334155; text-align: center; background: <?= $pId % 2 == 0 ? '#1e293b' : '#0f172a' ?>;">
|
||||
@ -127,9 +127,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['remove_compare'])) {
|
||||
if (isset($productAttrVals[$pId][$attrId])) {
|
||||
$valRow = $productAttrVals[$pId][$attrId];
|
||||
if (!empty($valRow['valueString'])) {
|
||||
echo htmlspecialchars($valRow['valueString']);
|
||||
echo htmlspecialchars($valRow['valueString'] ?? '');
|
||||
} elseif (!empty($valRow['valueNumber']) || $valRow['valueNumber'] === '0.00' || $valRow['valueNumber'] === 0) {
|
||||
echo htmlspecialchars(floatval($valRow['valueNumber'])) . " " . htmlspecialchars($attr['unit']);
|
||||
echo htmlspecialchars((string)floatval($valRow['valueNumber'])) . " " . htmlspecialchars($attr['unit'] ?? '');
|
||||
} elseif ($valRow['valueBool'] !== null) {
|
||||
echo $valRow['valueBool'] ? 'Ja' : 'Nein';
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user