query(" SELECT i.*, c.name_ar as cat_ar, c.name_en as cat_en FROM items i LEFT JOIN categories c ON i.category_id = c.id WHERE i.in_catalog = 1 ORDER BY c.id, i.name "); $items = $stmt->fetchAll(PDO::FETCH_ASSOC); $catalog = []; foreach ($items as $item) { $catName = current_lang() === 'ar' ? ($item['cat_ar'] ?? 'عام') : ($item['cat_en'] ?? 'General'); $catalog[$catName][] = $item; } ?>

AR EN
tr('تم الدفع بنجاح وتم استلام طلبك.', 'Payment completed successfully and your order was received.'), 'cancelled' => tr('تم إلغاء عملية الدفع. يمكنك المحاولة مرة أخرى أو اختيار الدفع لاحقاً.', 'Payment was cancelled. You can try again or choose Pay Later.'), 'failed' => tr('تعذر تأكيد الدفع. إذا تم الخصم يرجى مراجعة الإدارة.', 'We could not confirm the payment. If you were charged, please contact the store.'), default => tr('تم تحديث حالة الطلب.', 'The order status has been updated.'), }; ?>

$catItems): ?>

<?= h($item['name']) ?>