Take into account subcategories shown to get product offset (#33788)

This commit is contained in:
David Beniamine 2025-04-09 16:01:48 +02:00 committed by GitHub
parent 2f5eb74524
commit b96c3d0df3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -469,7 +469,8 @@ function MoreProducts(moreorless) {
if (maxproduct >= 1) {
limit = maxproduct-1;
}
var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts;
var nb_cat_shown = $('.div5 div.wrapper2[data-iscat=1]').length;
var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts - nb_cat_shown;
// Only show products for sale (tosell=1)
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);