Opencart (v4)

Filerobot x Opencart v4 plugin

The Filerobot Plugin is an extension which adds Asset Management to Opencart.

There are 3 simple steps for enabling the Filerobot plugin on your Opencart admin:

  • Obtain a Filerobot token (request it here);

  • Install the Filerobot module for Opencart;

  • Add your security configuration parameters to access your Filerobot library.

Installation

Prerequisites

Register for a demo if you don't already have a Filerobot account.

Step 1: Upload the plugin

  • Login to Admin Dashboard

  • Go to Extensions > Installer and upload the file filerobot.ocmod.zip

  • Install Filerobot plugin

Step 2: Configure and activate the plugin

Navigate to Extensions/Extensions, choose Modules from the drop-down menu, select Filerobot and update all configurations.

  • Filerobot Token: Your Filerobot token from the Asset Hub interface;

  • Security Template Identifier: Security template ID, found in the Developers top menu;

  • Filerobot upload directory: This is the top storage folder for your assets.

    Please create the folder in Filerobot first to prevent error.

Usage

You need to enable the extension in order to use Filerobot in all pages.

Step 1: Open FMAW (Filerobot Media Asset Widget)

With Ckeditor:

With Image field:

Step 2: Choose the image(s), then click insert button

If you are on Ckeditor: You can select multiple images for insertion.

If you are in an Image Field: You should select only one. If you selected multiple items, it will use the last one, as Opencart's Image Field inserts only one image at a time.

Developer's den

This extension is 100% compatible with the default theme.

If you use another theme (stock or custom), you should verify that the image is indeed from Filerobot before returning data to the view. An examples for banners would be:

foreach ($banner_images as $key => $value) {
    foreach ($value as $banner_image) {
                if (strpos($banner_image['image'], 'filerobot')) { // Check if image URL contain "filerobot"
                    $data['banner_images'][$key][] = array(
                        'title'      => $banner_image['title'],
                        'link'       => $banner_image['link'],
                        'image'      => $banner_image['image'],
                        'thumb'      => $banner_image['image'] . '&width=100&height=100', // return with dimensions
                        'sort_order' => $banner_image['sort_order']
                    );
                } else {
                    if (is_file(DIR_IMAGE . $banner_image['image'])) {
                        $image = $banner_image['image'];
                        $thumb = $banner_image['image'];
                    } else {
                        $image = '';
                        $thumb = 'no_image.png';
                    }

                    $data['banner_images'][$key][] = array(
                        'title'      => $banner_image['title'],
                        'link'       => $banner_image['link'],
                        'image'      => $image,
                        'thumb'      => $this->model_tool_image->resize($thumb, 100, 100),
                        'sort_order' => $banner_image['sort_order']
                );
  }
}

Last updated