OpenCart is an open-source online store management software used to build online stores that provide you to set up your own online business and run your e-commerce cost-effectively. It is PHP-based, using a MySQL database and HTML components.
To integrate the CDN using OpenCart, please follow these steps:
This tutorial assumes you have already created a Pull Zone.
OpenCart CDN Integration
- Download the CloudCache OCXXX.zip module from the official module web page.
Do not download the vQmod version, use the OCXXX.zip module instead or download it from here.
- Upload the admin and system folders from the CloudCache module to the root path of your website.
- Go to the admin panel of your OpenCart store and open the modules list on Extensions → Modules.
- Select the Install button on the right side to install the module.
- After the installation is done, list the modules again and go to the “edit” button on the right side of the modules list in the CloudCache module row.
- Enable the module by selecting the Enabled option on the drop-down list.
- Enter the Custom Domain or temp URL (e.g foo.bar.netdna-cdn.com) in the provided text box.
- Check which file types you would like the CDN to deliver.
- Select Save to save all changes.
Change “foo.bar.netdna-cdn.com” to your temp URL or custom domain.
To ensure MaxCDN was implemented correctly, view the source code of any page to confirm that the CDN domain is being used for static assets instead of the origin domain. Tools like pingdom, gtmetrix, webpagetest can also provide more detailed reports on the CDN implementation status.
If the CDN URLs are not present in the source code after everything is done, you should check if OpenCart is pushing compression and if it does, follow these steps to disable it:
- Log in to the OpenCart Admin Dashboard.
- Navigate to System -> Settings.
- Next to the store select Edit.
- Find the Server tab.
- Find Output Compression Level and set it to
0
. - Save the setting by selecting Save.
In some cases an error may be displayed on top of the page (frontend or backend/admin area) pointing out the variable HTTP_IMAGE:
Notice: Use of undefined constant HTTP_IMAGE - assumed 'HTTP_IMAGE' in /system/library/response.php on line 79
To solve this, open /config.php and add a definition for HTTP_IMAGE on the top of the file, so that resulting file looks like:
<?php
// HTTP
define('HTTP_SERVER', 'http://domain.com/');
define('HTTP_IMAGE', 'http://domain.com/image/');
// HTTPS
define('HTTPS_SERVER', 'http://domain.com/opencart/');
If you have any questions or experience any issues, please reach out to the Support Team, live chat and ticket support are available 24/7.