diff --git a/api/cart.php b/api/cart.php new file mode 100644 index 0000000..fae6b2b --- /dev/null +++ b/api/cart.php @@ -0,0 +1,79 @@ + $id, + 'name' => $name, + 'price' => (float)$price, + 'image' => $image, + 'quantity' => 1 + ]; + } + echo json_encode(['success' => true, 'cart_count' => getCartCount()]); + } else { + echo json_encode(['success' => false, 'error' => 'Invalid product']); + } + break; + + case 'remove': + $id = $_POST['id'] ?? null; + if ($id && isset($_SESSION['cart'][$id])) { + unset($_SESSION['cart'][$id]); + echo json_encode(['success' => true, 'cart_count' => getCartCount()]); + } else { + echo json_encode(['success' => false, 'error' => 'Product not in cart']); + } + break; + + case 'update': + $id = $_POST['id'] ?? null; + $quantity = (int)($_POST['quantity'] ?? 1); + if ($id && isset($_SESSION['cart'][$id])) { + if ($quantity <= 0) { + unset($_SESSION['cart'][$id]); + } else { + $_SESSION['cart'][$id]['quantity'] = $quantity; + } + echo json_encode(['success' => true, 'cart_count' => getCartCount()]); + } else { + echo json_encode(['success' => false, 'error' => 'Product not in cart']); + } + break; + + case 'get': + echo json_encode(['success' => true, 'cart' => array_values($_SESSION['cart']), 'cart_count' => getCartCount()]); + break; + + default: + echo json_encode(['success' => false, 'error' => 'Invalid action']); + break; +} \ No newline at end of file diff --git a/assets/css/custom.css b/assets/css/custom.css index 8a872e4..dd9ec9e 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -22,6 +22,12 @@ h1, h2, h3, .h1, .h2, .h3 { color: var(--ee-charcoal); } +/* Ensure headers inside white-text containers are visible */ +.text-white h1, .text-white h2, .text-white h3, +.hero-section h1, .hero-section h2, .hero-section h3 { + color: var(--ee-white) !important; +} + .bg-charcoal { background-color: var(--ee-charcoal) !important; } @@ -87,6 +93,18 @@ footer { padding: 60px 0; } +/* Zoom Effect */ +.zoom-container { + overflow: hidden; + border-radius: 8px; + border: 2px solid var(--ee-gold); +} + +.img-zoom-20 { + transform: scale(1.2); + transform-origin: center; +} + /* Senior Friendly Adjustments */ @media (max-width: 768px) { body { font-size: 1rem; } diff --git a/assets/images/pexels/jar-opener.jpg b/assets/images/pexels/jar-opener.jpg new file mode 100644 index 0000000..519c889 Binary files /dev/null and b/assets/images/pexels/jar-opener.jpg differ diff --git a/assets/images/pexels/pill-organizer.jpg b/assets/images/pexels/pill-organizer.jpg new file mode 100644 index 0000000..e77a9c3 Binary files /dev/null and b/assets/images/pexels/pill-organizer.jpg differ diff --git a/assets/js/main.js b/assets/js/main.js index 8fb2290..a668186 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,41 +1,132 @@ -function addToCart(product) { - alert(product + " has been added to your cart. We are still setting up our full checkout system!"); -} - -document.addEventListener('DOMContentLoaded', function() { +document.addEventListener('DOMContentLoaded', () => { + // Inquiry Form Handling const inquiryForm = document.getElementById('inquiryForm'); if (inquiryForm) { - inquiryForm.addEventListener('submit', function(e) { + inquiryForm.addEventListener('submit', async (e) => { e.preventDefault(); - const formData = new FormData(this); - const submitBtn = this.querySelector('button[type="submit"]'); + const formData = new FormData(inquiryForm); + const submitBtn = inquiryForm.querySelector('button[type="submit"]'); submitBtn.disabled = true; - submitBtn.textContent = 'Sending...'; + submitBtn.innerHTML = ' Sending...'; - fetch(this.action, { - method: 'POST', - body: formData - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - alert('Thank you! We have received your inquiry.'); - const modal = bootstrap.Modal.getInstance(document.getElementById('inquiryModal')); - modal.hide(); - inquiryForm.reset(); + try { + const response = await fetch('/api/inquiry.php', { + method: 'POST', + body: formData + }); + const result = await response.json(); + + if (result.success) { + inquiryForm.innerHTML = `
We have received your inquiry and will contact you shortly.
+Review your safety essentials before checkout.
+It looks like you haven't added any safety essentials yet.
+ Browse Products +| Product | +Quantity | +Price | ++ |
|---|---|---|---|
|
+
+
+
+
+ $ each
+
+ |
+
+
+
+
+
+
+ |
+ + $ + | ++ + | +