mirror of
https://github.com/myronblair/tomsjavajive
synced 2026-06-30 17:50:32 -05:00
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>
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="/assets/js/main.js"></script>
|
||||
<script src="/assets/js/main.js?v=<?= filemtime($_SERVER['DOCUMENT_ROOT'] . '/assets/js/main.js') ?>"></script>
|
||||
|
||||
<!-- PWA Service Worker Registration -->
|
||||
<script>
|
||||
|
||||
@@ -190,7 +190,7 @@ $productTypesList = db()->fetchAll("SELECT type_id, name, slug FROM product_type
|
||||
<span class="original"><?= formatCurrency($product['price']) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<button class="btn btn-primary btn-block add-to-cart-btn" data-product-id="<?= $product['product_id'] ?>">
|
||||
<button class="btn btn-primary btn-block add-to-cart-btn" data-product-id="<?= $product['product_id'] ?>" onclick="addToCart('<?= $product['product_id'] ?>', 1)">
|
||||
<i class="fas fa-shopping-bag"></i> Add to Cart
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user