Make your OpenCart Shopping Cart Faster RIGHT NOW!

This is a post dedicated to making OpenCart faster.   I am going to list in depth and in priority order the things that you can do to make your OpenCart install go much faster.  As a disclaimer, please backup all your files prior to doing any of this.  I am also not responsible if your cart goes down as a result of any of my recommendations.

EASY (low risk of damaging site if done incorrectly):

1.) Optimize images by running PNG’s through tinypng.com, or saving your JPG or GIF as web optimized in photoshop to reduce file size.  The overall goal here is to reduce the footprint of each page.

2.)  Disable and Uninstall any of the features/plugins you aren’t using through the admin interface.

3.) Minify JSS and CSS (JSS Minifier, CSS Minifier) to increase load time.

4.) Run your website through two speedtests: Pingdom and Web Page Test.  If Web Page test says your time to first byte is greater than 3 or 4 seconds, switch to a different host.  Think about getting a dedicated server or virtual dedicated.

5.) Implement a CDN.  Change any files that get used more than once in your layouts to point to files in the CDN.  For non enterprise level carts, I recommend Cloud Files by Rackspace (which is actually Akami).  Most of these changes will live in your catalog/view/theme/default/template/common/header.tpl and footer.tpl.

MODERATE (medium risk of damaging site if done incorrectly):

1.) Add index’s to your table to optimize your database.  Full Article here: http://forum.opencart.com/viewtopic.php?f=121&t=107756

2.) Implement caching in your htaccess so your user’s don’t have to redownload files on every page they visit.

Paste the following into your htaccess file:

# turn on the module for this directory
<IfModule mod_expires.c>
ExpiresActive on
# set default
ExpiresDefault “access plus 24 hours”
ExpiresByType image/jpg “access plus 1 months”
ExpiresByType image/gif “access plus 1 months”
ExpiresByType image/jpeg “access plus 1 months”
ExpiresByType image/png “access plus 1 months”
ExpiresByType text/css “access plus 1 months”
ExpiresByType text/javascript “access plus 1 months”
ExpiresByType application/javascript “access plus 1 months”
ExpiresByType application/x-shockwave-flash “access plus 1 months”
</IfModule>

DIFFICULT (doing anything wrong in here will white screen your website)

1.) Comment out any unnecessary items in your catalog/controller/common/header.php and footer.tpl (back this file up first).   Examples of things I have removed without breaking the cart:

$this->data[‘categories’] = $this->getCategories(0);  //<-this made a big improvement

$results = $this->model_localisation_language->getLanguages(); <-was able to remove this because I am serving only english on my site

$results = $this->model_localisation_currency->getCurrencies(); <-was able to remove this because only accepting the US dollar

I have done several other things to this file but my installs are custom and I hard code things like to logo, favicon and other no brainer items.  By hard coding these in the header, you can get rid of the loops and all the queries it takes to resolve these on every page load.  This improves load time significantly.

Let me know if you have any questions, I would be happy to help.