# Opencart

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](https://www.scaleflex.com/request-a-demo));
* Install the DAM module for Opencart;
* Add your security configuration parameters to access your DAM library.

### **Limitations** <a href="#limitations" id="limitations"></a>

Currently, the plugin supports the default WYSIWYG editor from Opencart - Summernote, but the native "Image resize" function is disabled. You can change the image size by removing the previous one then add it with new dimensions (a dedicated function will be added in the next version).

### Installation <a href="#od_a4f55725" id="od_a4f55725"></a>

#### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

[Register for a demo](https://www.scaleflex.com/request-a-demo) if you don't already have a DAM account.

#### Step 1: Upload the plugin <a href="#step-1-upload-the-plugin" id="step-1-upload-the-plugin"></a>

* Upload the `admin` folder in `upload/admin` to your Opencart source code.
* Login to the Admin Dashboard, navigate to *Extensions/Installers* and upload the `scaleflex_filerobot.ocmod.zip` file. Then, go to *Modification* and click *Reload* to update the installer.

#### Step 2: Configure and activate the plugin <a href="#step-2-configure-and-activate-the-plugin" id="step-2-configure-and-activate-the-plugin"></a>

Navigate to *Extensions/Extensions*, choose *Modules* from the drop-down menu, select *DAM* 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*;
* **DAM upload directory:** This is the top storage folder for your assets.

{% hint style="info" %}
*Please create the folder in DAM first to prevent error.*
{% endhint %}

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FpHakvBI9oUWxytpzUtpM%252Fo1.png%3Falt%3Dmedia%26token%3D3b3a28a6-908e-46ff-a426-738daa6a0ee2&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=32d941a5&#x26;sv=1" alt=""><figcaption></figcaption></figure>

### Usage <a href="#od_687683f1" id="od_687683f1"></a>

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

#### **Step 1: Open MAW (Media Asset Widget)** <a href="#step-1-open-fmaw-filerobot-media-asset-widget" id="step-1-open-fmaw-filerobot-media-asset-widget"></a>

With Summernote:

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FyE3mFHCGmDZOviA4m4dv%252Fo2.png%3Falt%3Dmedia%26token%3D8231a340-62a4-4a5b-913a-2f01edf6c88d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=a8229265&#x26;sv=1" alt=""><figcaption></figcaption></figure>

With Image field:

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FUT4N2rDfxVQhFlQlEF3s%252Fo3.png%3Falt%3Dmedia%26token%3D86d27841-7554-4a16-a449-2705bf6eeb7b&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=1f8f7ab7&#x26;sv=1" alt=""><figcaption></figcaption></figure>

#### **Step 2: Choose the image(s), then click insert button** <a href="#step-2-choose-the-image-s-then-click-insert-button" id="step-2-choose-the-image-s-then-click-insert-button"></a>

If you are on Summernote: 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.

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FYrxlmLB1CISXRV6hYsnW%252Fo4.png%3Falt%3Dmedia%26token%3De63af51e-f212-47b6-aae5-c7b7196fcc5e&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=39186b26&#x26;sv=1" alt=""><figcaption></figcaption></figure>

### Developer's den <a href="#od_f8f03ba2" id="od_f8f03ba2"></a>

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:

```
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']
                );
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scaleflex.com/digital-asset-management-dam/plugins-and-connectors/plugins/opencart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
