Our company opens in about 1 hour at 09:00 UK time. Send your request now and we will review it when we are back.

Optimize Files for OpenCart

Detailed guide to improve the performance of your online store

Why is file optimization important?

Optimizing your online store files is crucial for performance, user experience and ranking in search engines. A slow store can lead to:

  • Increased visitor dropout rate
  • Lower conversion rate
  • Worst ranking in search engines
  • Greater hosting costs due to increased bandwidth usage

Image Optimization

Images usually form most of the data volume in an online store. Their proper optimization can dramatically reduce the size of the page.

Conversion into modern forms

Turning images into modern formats like WebP can reduce their size by 25-80% while maintaining high quality:

  • WebP: It offers non-loss-free compression and losses with a size of 25-35% less than PNG and JPEG respectively
  • AVIF: Even better compression than WebP, but with less browser support

Image conversion tools

  • Squoosh - Free online conversion tool
  • ImageOptim - App for Mac
  • Plugins for OpenCart like "WebP & Image Optimizer"

Compress images

Even without resizing, compressing images can significantly reduce their size:

  • Use compression with losses for product photos with quality 80-90%
  • Remove the metadata of images that are not necessary
  • Show the images to the exact dimensions you need

Use correct dimensions

Do not use images larger than the required dimensions and offer different sizes for different devices with responsive images:

<img srcset="small.jpg 300w, medium.jpg 600w, large.jpg 1200w" sizes="(max-width: 600px) 300px, (max-width: 1200px) 600px, 1200px" src="medium.jpg" alt=Product description />

JavaScript Optimization

JavaScript files can significantly slow down loading the page, especially if loaded at the beginning (head) of the page.

Minimization

Minimization removes unnecessary gaps, comments and formatting by reducing file size:

  • Use tools such as Terser or UglifyJS
  • Many of themes and modules of OpenCart have already minimized versions (.min.js)

Late loading (Lazy Loading)

Load the scripts only when necessary:

  • Add Feature defer or async scripts that are not necessary for the original rendering of the page
  • Load third party scripts (e.g. analytics, chat widgets) with delay
<script src="analytics.js" defer></script>

File combination

Combine multiple small JavaScript files into a larger one to reduce the number of HTTP requests:

  • Use the integrated OpenCart combination system in the settings
  • Think about using module for optimization such as "Speedup Optimization"

Attention!

The combination of files can sometimes cause compatibility problems between different scripts. Always try changes in a test environment before applying them to the live store.

CSS Optimization

CSS files can also be optimized in similar ways to JavaScript:

Minimization

Remove unnecessary spaces, comments and formatting:

  • Use tools like CSS Nano or Clean CSS
  • Choose the minimized versions of CSS frames (.min.css)

File combination

As with JavaScript, combining CSS files reduces HTTP requests:

  • Enable the CSS combination from OpenCart settings
  • Use preprocessors like SCSS to better organize and maintain the code

Remove unused CSS

Many topics include CSS not used in your store:

  • Use tools like PurgeCSS to remove unused CSS
  • Load only the necessary components from CSS frames (e.g. Bootstrap)

Critical CSS

Load the necessary CSS for the visible section of the page (bove-the-fold) directly to the page head and delay loading the rest:

&lt;style&gt;/* Critical CSS here */&lt;/style&gt; &lt;link rel="preload" href="styles.css" as="style" onload="this.onload=null; this.rel='stylesheet'"&gt; &lt;noscript&gt;&lt;link rel="stylesheet" href="styles.css"&gt;&lt;/noscript&gt;

Optimize Content Loading

In addition to optimising individual files, you can improve the performance by checking what and when it is loaded:

Lazy Loading

Apply lazy loading to images and videos that are not visible in the original view window:

<img src="placeholder.jpg" data-src="actual-image.jpg" class="lazy" alt=Description />

With modern browsers, you can simply use the built-in feature:

<img src="actual-image.jpg" loading="lazy" alt=Description />

Content priority

Check which content is loaded first:

  • Use the feature preload for critical resources
  • Apply prefetch for resources needed in the next navigation
  • Avoid loading heavy items such as sliders and videos at the top of the home page

Remove redundant content

Many OpenCart topics include unnecessary elements that burden the performance:

  • Remove non-essential modules and widgets
  • Limit the number of products shown in sliders and blocks
  • Replace heavy JavaScript components with lighter alternatives

Advanced Optimization Techniques

Use Content Delivery Network (CDN)

A CDN distributes your content from servers closer to your users:

  • Connect OpenCart to services such as Cloudflare, BunnyCDN or Amazon CloudFront
  • Make sure static resources (pictures, CSS, JS) are served by CDN

Use Caching

Store in cache allows faster loading of returned visitors:

  • Enable OpenCart caching in the administrator's settings
  • Configure HTTP cache heads properly
  • Install a caching module such as "Super Cache" or "Turbo Cache"
  • Think about using server-side caching like Redis or Memcached

Gzip Compression

Gzip compression reduces text file transfer size (HTML, CSS, JS):

# Add to .htaccess &lt;IfModule mod_deflate.c&gt; AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript &lt;/IfModule&gt;

Database Optimization

Optimize OpenCart database:

  • Regular reconstruction and optimization of base tables
  • Cleaning old data (historical visitors, abandonment baskets)
  • Use appropriate indexes for frequent searches

Performance Analysis Tools

To identify specific performance problems, use the following tools:

  • Google PageSpeed Insights - Analyzes page performance and suggests improvements
  • WebPageTest - Detailed loading analysis from different locations
  • Browser Tools (Chrome, Firefox)
  • GTmetrix - Combines various performance indicators

Check before and after

Before applying any optimizations, record current performance measurements so that you can compare results after changes.

Ready to speed up your store?

Contact OpenCart Greece for a professional analysis and optimization of your online store.

Discover our services