Summary
The getBundles() service method in ProductBundleService fully supports pagination (page, items_per_page, get_total, total_items), and the admin bundle management page (product_bundles.manage) correctly implements it. However, two other pages that display bundles do not implement pagination at all, causing bundles beyond the limit to be silently hidden.
1. Admin Product Edit Page (dispatch=products.update)
Controller: app/addons/product_bundles/controllers/backend/products.post.php
- Line 38:
getBundles()is called withoutpage,get_total, or explicititems_per_page - Defaults to
admin_elements_per_page(typically 10) - The returned
$params(containingtotal_items) is discarded:list($bundles,) = $service->getBundles($params);
Template: design/backend/templates/addons/product_bundles/hooks/products/tabs_extra.post.tpl
- Simple
{foreach $bundles as $bundle}loop (line 31) - No
{include file="common/pagination.tpl"}— compare withviews/product_bundles/manage.tplwhich correctly includes it at lines 12 and 99
Result: If a product has 25 bundles and admin_elements_per_page = 10, only 10 are shown. No indication that 15 more exist. No way to navigate to them without going to the separate bundle management page.
2. Storefront Product View (dispatch=products.view)
Component: app/addons/product_bundles/src/SmartyPlugins/components/product_bundles/component.product_bundles.php
- Lines 34-37:
items_per_pageis not set, so it defaults toadmin_elements_per_page:
$bundles_params = [
'full_info' => true,
'status' => ObjectStatuses::ACTIVE,
];
- No
'get_total' => true— total count never calculated - No
'page' => $_REQUEST['page']— always loads page 1 - Line 87:
list($bundles,) = $bundle_service->getBundles($bundles_params);— pagination metadata discarded
Template: design/themes/responsive/templates/addons/product_bundles/components/common/product_bundles.tpl
- Lines 35-40: Simple foreach with no pagination UI
Result: Storefront silently truncates bundles at the default admin_elements_per_page limit. Customers cannot see or access additional bundles. No “load more” or page navigation.
3. Correct Implementation for Reference (product_bundles.manage)
Controller: app/addons/product_bundles/controllers/backend/product_bundles.php (lines 131-156)
$params = [
'page' => 1,
'items_per_page' => Registry::get('settings.Appearance.admin_elements_per_page'),
'get_total' => true,
];
$params = array_merge($params, $_REQUEST);
list($bundles, $search) = $bundle_service->getBundles($params);
$valid_page = db_get_valid_page($search['page'], $search['items_per_page'], $search['total_items']);
Template: design/backend/templates/addons/product_bundles/views/product_bundles/manage.tpl
{include file="common/pagination.tpl"}
This page works correctly. The other two pages should follow the same pattern.
Root Cause
The service layer (ProductBundleService::getBundles()) has full pagination support. The issue is that the callers (product edit controller, storefront component) don’t pass pagination parameters and don’t render pagination controls.
| Area | page |
get_total |
items_per_page |
Pagination UI | Status |
|---|---|---|---|---|---|
product_bundles.manage |
From $_REQUEST |
true |
From settings | pagination.tpl |
OK |
products.update tab |
Not passed | Not passed | Default (10) | None | BUG |
products.view storefront |
Not passed | Not passed | Default (10) | None | BUG |
Recommended Fix
Admin product edit (products.post.php):
- Pass
'page','items_per_page','get_total' => truetogetBundles() - Capture pagination data:
list($bundles, $search) = ... - Pass
$searchto template for pagination rendering
Admin template (tabs_extra.post.tpl):
- Add
{include file="common/pagination.tpl"}before and after the bundles list
Storefront component (component.product_bundles.php):
- Add
'get_total' => trueand'page'handling - Pass pagination data to template
Storefront template (product_bundles.tpl):
- Add pagination or “load more” controls
Steps to Reproduce
- Create a product with 15+ bundles linked to it (via
show_on_product_page = Y) - Go to admin > Products > edit product > “Product Bundles” tab
- Observe: only first 10 bundles shown, no pagination, no indication more exist
- Go to storefront > view the same product
- Observe: only first 10 bundles shown, no pagination
Expected: All bundles accessible via pagination controls
Actual: Bundles beyond limit silently hidden