[FIX] website_sale_aplicoop: Complete infinite scroll and search filter integration
Major fixes: - Fix JSON body parsing in load_products_ajax with type='http' route * Parse JSON from request.httprequest.get_data() instead of post params * Correctly read page, search, category from JSON request body - Fix search and category filter combination * Use intersection (&) instead of replacement to preserve both filters * Now respects search AND category simultaneously - Integrate realtime_search.js with infinite_scroll.js * Add resetWithFilters() method to reset scroll to page 1 with new filters * When search/category changes, reload products from server * Clear grid and load fresh results - Fix pagination reset logic * Set currentPage = 0 in resetWithFilters() so loadNextPage() increments to 1 * Prevents loading empty page 2 when resetting filters Results: ✅ Infinite scroll loads all pages correctly (1, 2, 3...) ✅ Search filters work across all products (not just loaded) ✅ Category filters work correctly ✅ Search AND category filters work together ✅ Page resets to 1 when filters change
This commit is contained in:
parent
534876242e
commit
5eb039ffe0
4 changed files with 603 additions and 71 deletions
|
|
@ -551,22 +551,43 @@
|
|||
<t t-call="website_sale_aplicoop.eskaera_shop_products" />
|
||||
</div>
|
||||
|
||||
<!-- Load More Button (for lazy loading) -->
|
||||
<!-- Infinite scroll container -->
|
||||
<t t-if="lazy_loading_enabled and has_next">
|
||||
<div class="row mt-4">
|
||||
<div id="infinite-scroll-container" class="row mt-4">
|
||||
<div class="col-12 text-center">
|
||||
<!-- Spinner (hidden by default) -->
|
||||
<div id="loading-spinner" class="d-none" style="padding: 20px;">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<p class="mt-2">Loading more products...</p>
|
||||
</div>
|
||||
<!-- Fallback Load More button (shown if auto-load fails) -->
|
||||
<button
|
||||
id="load-more-btn"
|
||||
class="btn btn-primary btn-lg"
|
||||
class="btn btn-primary btn-lg d-none"
|
||||
t-attf-data-page="{{ current_page + 1 }}"
|
||||
t-attf-data-order-id="{{ group_order.id }}"
|
||||
t-attf-data-search="{{ search_query }}"
|
||||
t-attf-data-category="{{ selected_category }}"
|
||||
t-attf-data-per-page="{{ per_page }}"
|
||||
aria-label="Load more products"
|
||||
style="display: none;"
|
||||
>
|
||||
<i class="fa fa-download me-2" />Load More Products
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Data attributes for infinite scroll configuration -->
|
||||
<div id="eskaera-config"
|
||||
t-attf-data-order-id="{{ group_order.id }}"
|
||||
t-attf-data-search="{{ search_query }}"
|
||||
t-attf-data-category="{{ selected_category }}"
|
||||
t-attf-data-per-page="{{ per_page }}"
|
||||
t-attf-data-current-page="{{ current_page }}"
|
||||
class="d-none">
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">
|
||||
|
|
@ -646,6 +667,8 @@
|
|||
<script type="text/javascript" src="/website_sale_aplicoop/static/src/js/checkout_labels.js" />
|
||||
<script type="text/javascript" src="/website_sale_aplicoop/static/src/js/home_delivery.js" />
|
||||
<script type="text/javascript" src="/website_sale_aplicoop/static/src/js/realtime_search.js" />
|
||||
<!-- Infinite scroll for lazy loading products -->
|
||||
<script type="text/javascript" src="/website_sale_aplicoop/static/src/js/infinite_scroll.js" />
|
||||
|
||||
<!-- Initialize tooltips using native title attribute -->
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue