Opencart (v4)

DAM x Opencart v4 plugin

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

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

  • Obtain a DAM token (request it here);

  • Install the DAM module for Opencart;

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

Installation

Prerequisites

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

Step 1: Upload the plugin

  • Login to Admin Dashboard

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

  • Install DAM 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.

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

  • Security Template Identifier: Security template ID, found in the Project > Access > Security templates tab;

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

Please create the folder in DAM first to prevent errors.

Usage

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

Step 1: Open MAW (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 DAM before returning data to the view. An examples for banners would be:

Copy

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