I'm running Opencart 1.5.2 on my server and after importing a large number of products I got a massive speed down. I tried installing a vq mod which had to speed up the site... it didn't.
I know I have some elements on the site which are relatively big but before the import it was running fine.
The product count in the categories is a significant source of slow page loads in opencart. There are a few places this could be calculated and you will have to get rid of all of them to notice an improvement in page load time due to this factor.
If you edit the Catalog
module you can disable the product count for the navigation menu (displayed in the left column by default) by setting Product Count:
to Disabled
.
The default theme also has a product count displayed in the main menu of the site. You can find this code in catalog/controller/common/header.php:
$product_total = $this->model_catalog_product->getTotalProducts($data);
$children_data[] = array(
'name' => $child['name'] . ' (' . $product_total . ')',
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
Remove or comment out any references to $product_total
:
//$product_total = $this->model_catalog_product->getTotalProducts($data);
$children_data[] = array(
'name' => $child['name'],
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
That should take care of all the references in a default opencart install, but if you are using a custom theme or modules there could be more. More generally, you can search the entire catalog/ directory for references to model_catalog_product->getTotalProducts()
.
If you search for other references to getTotalProducts()
Make sure you don't remove the references that use the product count for pagination, otherwise the pagination will not work properly. Here is an example from catalog/controller/product/search.php, a file that needs the product count to function properly.
$pagination->total = $product_total;
Removing these references has led to almost a 10x speedup in page load time on my development servers in an opencart install with ~2,000 products.