'🎧', 'headphone' => '🎧', 'earphone' => '🎧', 'earbud' => '🎧', 'charger' => 'πŸ”Œ', 'charging' => 'πŸ”Œ', 'cable' => 'πŸ”Œ', 'adapter' => 'πŸ”Œ', 'case' => 'πŸ“±', 'cover' => 'πŸ“±', 'screen' => 'πŸ“±', 'protector'=> 'πŸ“±', 'watch' => '⌚', 'strap' => '⌚', 'band' => '⌚', 'wireless' => 'πŸ”‹', 'power' => 'πŸ”‹', 'battery' => 'πŸ”‹', 'tablet' => 'πŸ“‹', 'stylus' => '✏️', 'pen' => '✏️', ]; function panna_pick_icon($label) { global $ICON_KEYWORDS; $label_lc = strtolower($label); foreach ($ICON_KEYWORDS as $kw => $icon) { if (strpos($label_lc, $kw) !== false) return $icon; } return 'πŸ› οΈ'; } function panna_fetch_accessories() { $accessories = []; $error = null; try { $dsn = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4'; $pdo = new PDO($dsn, DB_USER, DB_PASS, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]); $prefix = DB_PREFIX; // Products linked to a product-category (type=0) whose label matches // the accessories tag, and that are actually marked "to sell". $sql = " SELECT p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type FROM {$prefix}product p INNER JOIN {$prefix}categorie_product cp ON cp.fk_product = p.rowid INNER JOIN {$prefix}categorie c ON c.rowid = cp.fk_categorie WHERE c.type = 0 AND c.label = :tag AND p.tosell = 1 ORDER BY p.label ASC "; $stmt = $pdo->prepare($sql); $stmt->execute([':tag' => ACCESSORIES_TAG]); $rows = $stmt->fetchAll(); foreach ($rows as $row) { // Prefer VAT-inclusive price for a customer-facing retail price; // fall back to the base price field if price_ttc isn't set. $price = (isset($row['price_ttc']) && $row['price_ttc'] !== null && $row['price_ttc'] !== '') ? (float) $row['price_ttc'] : (float) $row['price']; $desc = trim(strip_tags((string) $row['description'])); if ($desc === '') { $desc = 'Genuine Samsung accessory β€” ask in-store for full specifications.'; } $key = 'acc' . $row['rowid']; $accessories[$key] = [ 'id' => (int) $row['rowid'], 'ref' => $row['ref'], 'name' => $row['label'], 'price' => round($price), 'desc' => $desc, 'emoji' => panna_pick_icon($row['label']), ]; } } catch (Throwable $e) { // Never leak DB details to the page β€” log server-side, show a // friendly message client-side instead. error_log('Panna accessories fetch failed: ' . $e->getMessage()); $error = 'Accessories could not be loaded right now. Please try again shortly.'; } return [$accessories, $error]; } [$ACCESSORIES, $ACCESSORIES_ERROR] = panna_fetch_accessories(); ?> Panna Music Centre β€” Quick Links

Panna Music Centre

Pre-order devices, browse accessories, or check our terms

Visit Site
EXPLORE

VISIT SITE

pannamusic.co.ke