{ const matchCat = this.activeCategory === 'all' || p.category === this.activeCategory; const matchSearch = p.name.toLowerCase().includes(this.search.toLowerCase()) || p.desc.toLowerCase().includes(this.search.toLowerCase()); return matchCat && matchSearch; }); }, addToCart(p) { let cart = JSON.parse(localStorage.getItem('odm_cart') || '[]'); if (!cart.find(i => i.id === p.id)) cart.push({ id: p.id, name: p.name, qty: 1 }); localStorage.setItem('odm_cart', JSON.stringify(cart)); this.cartCount = cart.length; this.notification = p.name; setTimeout(() => this.notification = '', 2500); } }" x-init="cartCount = JSON.parse(localStorage.getItem('odm_cart') || '[]').length">