For those who are awake!
Discount -15%
We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.13.4.20. Disable counting products in categories in OpenCart

The standard functionality of OpenCart, which counts products in categories, is too resource-intensive and can cause huge delays in the work of pages and high load on the server. It is recommended to disable it for sites. The disconnection procedure depends on the version of OpenCart you are using:

To disable counting, do the following:
  1. Openup Adminpanel site.
  2. Go to the section "System → Settings» («System → Settings»):
  3. To the right of the store name, click “Edit» («Edit»):
  4. On the tab “Options» («Options") Opposite"Number of products in a category»Select«No»:
  5. Save changes by clicking "Save» («Save») In the upper right corner of the page:
  6. Check the site is working.
If you are using OpenCart version 1.5.1 and below, you need to disable the counting function directly in the site code. To do this, do the following:
  1. Edit the file catalog/controller/common/header.php:
    1. On about 200th line, find the following line and comment it out by adding at the beginning //:
      $product_total = $this->model_catalog_product->getTotalProducts($data);
    2. Find the line:
      'name'  => $child['name'] . ' (' . $product_total . ')',

      And replace it with this:

      'name'  => $child['name'],
    3. You should end up with something like this:
      //$product_total = $this->model_catalog_product->getTotalProducts($data);
      $children_data[] = array</b></br>
      'name'  => $child['name'],</b></br>
      'href'  => 'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . </b>  </br>
      );
  2. Check the site is working.