Skip to content

Commit

Permalink
Merge pull request #827 from droptica/ISSUE-308600-fix-products-list-…
Browse files Browse the repository at this point in the history
…notice

Issue #3308600 by perpignan: Error : Call to a member function getTotalItems()
  • Loading branch information
grzegorz-pietrzak-droptica authored Sep 28, 2022
2 parents 3c121a4 + 1094630 commit bfeb6aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ function d_commerce_products_list_preprocess_page(&$variables) {
$route_name = \Drupal::routeMatch()->getRouteName();
if (stripos($route_name, 'view.droopler_commerce_products_list') !== FALSE) {
$pager_manager = \Drupal::service('pager.manager');
$variables['pager_total_items'] = $pager_manager->getPager(0)->getTotalItems();
if ($pager = $pager_manager->getPager(0)) {
$variables['pager_total_items'] = $pager->getTotalItems();
}
$variables['#attached']['library'][] = 'd_commerce_products_list/d_commerce_products_list_select';
$variables['#attached']['library'][] = 'd_commerce_products_list/d_commerce_products_list_searches';

Expand Down
5 changes: 3 additions & 2 deletions modules/custom/d_product/d_product.module
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ function d_product_preprocess_page(&$variables) {
$route_name = \Drupal::routeMatch()->getRouteName();
if (stripos($route_name, 'view.products_list') !== FALSE) {
$pager_manager = \Drupal::service('pager.manager');
$variables['pager_total_items'] = $pager_manager->getPager(0)
->getTotalItems();
if ($pager = $pager_manager->getPager(0)) {
$variables['pager_total_items'] = $pager->getTotalItems();
}
$variables['#attached']['library'][] = 'd_product/d_product_select';
$variables['#attached']['library'][] = 'd_product/d_product_searches';
}
Expand Down

0 comments on commit bfeb6aa

Please sign in to comment.