https://blog.superhosting.bg/en/faster-opencart-part-one.html

Press enter to see results or esc to cancel.

SuperHosting.BG Blog

How To Speed Up Your OpenCart Store? (Part 1)

2016-07-20
Support tips
opencart, Speed Up OpenCart, OpenCart store

OpenCart is one of the most commonly used online store systems by our customers and comprises 6.3% of all installed CMS platforms). As we receive many inquiries about speed optimization we decided to give you a few tips on how to speed up your OpenCart store.

Numerous checks carried out on this issue combined with our expertise gave us grounds to specify the most common reasons for slow loading. The OpenCart system’s code calculates the number of products in each category. Every time a page is loaded, the calculation is performed again. This represents actually an SQL query to the database for each category. The more categories and products you have in your store, the more slowly it will load.

Although, you can disable the number of displayed products from the website’s administration, this does not stop the constant execution of SQL queries.

The optimization is a solution for stores with a large number of categories and products.

Killing two birds with one stone!
By stopping the execution of SQL queries the website not only starts loading faster, but the CPU time of the hosting account is also reduced.

The optimization can be done in two ways: by adding plugins to OpenCart or with manual settings.We highly recommend the second option: manual optimization of OpenCart. The plugins are changing the OpenCart database and some of the system files. What exactly and where is changed by the plugin might not be described in its help section, so sometimes the initial settings of the store cannot be restored. By optimizing OpenCart manually you will know exactly which file is edited and you can undo the changes, if necessary. You will perform the optimization step by step and if something goes wrong you can immediately undo the changes of the edited file.The described manual optimization is performed on OpenCart version 1.5.6.4, but it applies also to 1.5.х older versions.

Optimization with additional OpenCart plugin

You can find online different free and paid plugins that will help you optimize your store. For example: Opencart Turbo.

Another plugin that stops displaying and calculating the number of products in the categories is Product Count True Disabling / Speed Up.

Tip:
If you choose to test your store optimization with such plugins, plase backup your website (database and files).
Manual optimization

The optimization requires editing of three OpenCart files. By replacing a few lines in those files you will stop the constant execution of SQL queries.

Note:: Once you have edited the files, the number of products in categories will no longer be displayed. If you insist on the products’ number visibility, do not optimize your store in this way. In the next article for OpenCart optimization we will tell you more about how to optimize so that the number of products is displayed, but the website does not load so slowly.

Another very important thing is to make a copy of every file before editing it. In this way you will be able to restore it without the changes you have made.

Before manually editing the system files you need to deactivate the visibility of product numbers in the Open Cart admin panel -> System -> Settings -> General (Showing the number of products in a category – select No).

Then get ready for a little editing of three system files:

catalog/controller/product/category.php – the number of products for main categories and subcategories
catalog/controller/common/header.php – the number of products in the main menu (website header)
catalog/controller/module/category.php – the number of products in the menu on the left

• /catalog/controller/product/category.php

In the first system file you need to find the following lines:

and change them to:

• /catalog/controller/common/header.php

This file contains functionality for calculating the number of products shown in categories on the website main menu.

In this file you need to find the following lines:

and change them to:

• /catalog/controller/module/category.php

Disabling of the categories calculation for the website menu of the left.

Find the following lines:

and change them to:

The number of the main categories can be removed in the same file.

Change the following lines from:

to:

We have optimized many stores in this way and with most of them the result was great as the loading speeds up a lot. If this optimization does not affect the website loading time, there are many other ways to accelerate it.

Memecached is a good example for this. Dynamic Content Caching with  Memcached improves the site loading speed. This is another way to optimize and through it loading a store is considerably accelerated.

The changes made in the system files should not lead to difficulties in the website’s normal operation. However, we strongly recommend to make a backup in advance.

Tip from the support
Since OpenCart offers a great diversity of settings and installation options the optimization process described above might not work for every store. If there is not a visible result from the optimization, the reason for slow loading might be somewhere else (e.g. something that has been additionally installed on the store – a complicated template, additional functionality, a plugin, etc). In this case you should look more carefully for a problem. Make a test by activating another website template or disabling the plugins one by one so that you can detect what is causing the slow loading.

Technical Support Specialist

Megan is our support guru – she can answer every technical question. She knows everything about new technologies. Megan's SuperPower is that she can explain even the most complicated technologies in plain language.

500px270px
SuperHosting.BG

Related Posts

Leave a Reply

Be the First to Comment!

Notify of
avatar

wpDiscuz