$product */ $variants = $product['preview_variants'] ?? []; $activeVariant = $variants[0] ?? [ 'name' => $product['variant_name'] ?? '', 'unit' => $product['unit'] ?? '', 'price_per_unit' => $product['price_per_unit'] ?? null, 'package_price' => $product['package_price'] ?? null, 'package_quantity' => $product['package_quantity'] ?? 0, 'old_package_price' => $product['old_package_price'] ?? null, ]; $cardId = 'product-card-' . (int) ($product['id'] ?? 0); $activePackagePrice = (float) ($activeVariant['package_price'] ?? 0); $activeUnitPrice = $activeVariant['price_per_unit'] === null ? null : (float) $activeVariant['price_per_unit']; $activePackageQuantity = (float) ($activeVariant['package_quantity'] ?? 0); $activeVariantOldPackagePrice = $activeVariant['old_package_price'] ?? null; $activeOldPackagePrice = ( $activeVariantOldPackagePrice !== null && (float) $activeVariantOldPackagePrice > $activePackagePrice ) ? (float) $activeVariantOldPackagePrice : null; $activeOldUnitPrice = ($activeOldPackagePrice !== null && $activePackageQuantity > 0 && $activeUnitPrice !== null) ? $activeOldPackagePrice / $activePackageQuantity : null; if ($activeOldUnitPrice !== null && $activeOldUnitPrice <= $activeUnitPrice) { $activeOldUnitPrice = null; } ?>
<?= e((string) $product['name']) ?> Рыбсток

Доступные фасовки:
$variant): ?> $variantPackagePrice ) ? (float) $variant['old_package_price'] : null; $variantOldUnitPrice = ($variantOldPackagePrice !== null && $variantPackageQuantity > 0 && $variantUnitPrice !== null) ? $variantOldPackagePrice / $variantPackageQuantity : null; if ($variantOldUnitPrice !== null && $variantOldUnitPrice <= $variantUnitPrice) { $variantOldUnitPrice = null; } ?>
Цена за : > За фасовку : > Цена за ×