trim($_POST['store_name'] ?? ''), 'email' => trim($_POST['store_email'] ?? ''), 'phone' => trim($_POST['store_phone'] ?? ''), 'address' => trim($_POST['store_address'] ?? ''), 'currency' => $_POST['currency'] ?? 'USD', 'timezone' => $_POST['timezone'] ?? 'America/New_York' ]); setFlash('success', 'Store settings updated'); } if ($section === 'tax') { setSetting('tax', [ 'enabled' => isset($_POST['tax_enabled']), 'rate' => floatval($_POST['tax_rate'] ?? 0), 'included_in_price' => isset($_POST['tax_included']) ]); setFlash('success', 'Tax settings updated'); } if ($section === 'checkout') { setSetting('checkout', [ 'guest_checkout' => isset($_POST['guest_checkout']), 'require_phone' => isset($_POST['require_phone']), 'order_notes' => isset($_POST['order_notes']), 'terms_required' => isset($_POST['terms_required']), 'terms_url' => trim($_POST['terms_url'] ?? '') ]); setFlash('success', 'Checkout settings updated'); } header('Location: /admin/settings.php'); exit; } // Get current settings $store = getSetting('store', [ 'name' => "Tom's Java Jive", 'email' => '', 'phone' => '', 'address' => '', 'currency' => 'USD', 'timezone' => 'America/New_York' ]); $tax = getSetting('tax', [ 'enabled' => false, 'rate' => 0, 'included_in_price' => false ]); $checkout = getSetting('checkout', [ 'guest_checkout' => true, 'require_phone' => false, 'order_notes' => true, 'terms_required' => false, 'terms_url' => '' ]); ?>