Files
tomsjavajive/includes/footer.php
T
myron 6e86031576 Fix add-to-cart: bust main.js SW cache, add inline onclick to shop buttons
Service worker was caching main.js (cache-first strategy) so event listeners
may not have been running. Added filemtime version param to main.js like CSS.
Also added inline onclick to shop page buttons so they work regardless of
whether event delegation is functional.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 20:11:35 +00:00

94 lines
3.9 KiB
PHP

<?php
/**
* Tom's Java Jive - Footer Include
*/
?>
</main>
<footer class="footer">
<div class="container">
<div class="footer-grid">
<div class="footer-brand">
<a href="/" class="logo">
<img src="/assets/images/logo.png" alt="<?= SITE_NAME ?>" style="height: 50px;">
</a>
<p>Premium artisan coffee beans freshly roasted and delivered to your door. Experience the perfect cup, every time.</p>
</div>
<div>
<h4>Shop</h4>
<ul class="footer-links">
<li><a href="/shop.php">All Products</a></li>
<?php
$footerCategories = db()->fetchAll(
"SELECT DISTINCT category FROM products WHERE category IS NOT NULL AND category != '' AND is_active = 1 ORDER BY category"
);
foreach ($footerCategories as $fc): ?>
<li><a href="/shop.php?category=<?= urlencode($fc['category']) ?>"><?= htmlspecialchars(ucfirst($fc['category'])) ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div>
<h4>Sub Categories</h4>
<ul class="footer-links">
<?php
$footerTypes = db()->fetchAll("SELECT type_id, name FROM product_types WHERE is_active=1 ORDER BY sort_order ASC");
foreach ($footerTypes as $ft): ?>
<li><a href="/shop.php?subcat=<?= urlencode($ft['type_id']) ?>"><?= htmlspecialchars($ft['name']) ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div>
<h4>Company</h4>
<ul class="footer-links">
<li><a href="/#about">About Us</a></li>
<li><a href="/contact.php">Contact</a></li>
</ul>
</div>
<div>
<h4>Support</h4>
<ul class="footer-links">
<li><a href="/faq.php">FAQ</a></li>
<li><a href="/shipping.php">Shipping Info</a></li>
<li><a href="/returns.php">Returns</a></li>
<li><a href="/track-order.php">Track Order</a></li>
<li><a href="/privacy.php">Privacy Policy</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>&copy; <?= date('Y') ?> Tom's Java Jive. All rights reserved.</p>
<div class="footer-social">
<a href="#" title="Facebook"><i class="fab fa-facebook-f"></i></a>
<a href="#" title="Instagram"><i class="fab fa-instagram"></i></a>
<a href="#" title="Twitter"><i class="fab fa-twitter"></i></a>
</div>
</div>
</div>
</footer>
<script src="/assets/js/main.js?v=<?= filemtime($_SERVER['DOCUMENT_ROOT'] . '/assets/js/main.js') ?>"></script>
<!-- PWA Service Worker Registration -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js')
.then(registration => {
console.log('SW registered:', registration.scope);
})
.catch(error => {
console.log('SW registration failed:', error);
});
});
}
</script>
<?php if (isset($extraScripts)) echo $extraScripts; ?>
</body>
</html>