Kuzmichev Ruslan 1 anno fa
commit
d47bce0328

+ 366 - 0
install.xml

@@ -0,0 +1,366 @@
+<?xml version="1.0" encoding="utf-8"?>
+<modification>
+    <name>Links to marketplaces</name>
+    <code>links2marketplaces</code>
+    <version>1.0.0</version>
+    <date>05.08.2024</date>
+    <author>Kuzmichev Ruslan</author>
+    <link>http://kuzmichev.pw</link>
+
+    <file path="admin/controller/catalog/product.php">
+        <operation>
+            <search>
+                <![CDATA[
+                    if (isset($this->error['name'])) {
+                ]]>
+            </search>
+
+            <add position="before">
+                <![CDATA[
+                    $data['module_links_to_marketplaces_status'] = $this->config->get('module_links_to_marketplaces_status');
+                    $data['module_links_to_marketplaces'] = $this->config->get('module_links_to_marketplaces');
+
+                    if (isset($this->error['url_ozon'])) {
+                        $data['error_url_ozon'] = $this->error['url_ozon'];
+                    } else {
+                        $data['error_url_ozon'] = array();
+                    }
+
+                    if (isset($this->error['url_wildberries'])) {
+                        $data['error_url_wildberries'] = $this->error['url_wildberries'];
+                    } else {
+                        $data['error_url_wildberries'] = array();
+                    }
+
+                    if (isset($this->error['url_yandex_market'])) {
+                        $data['error_url_yandex_market'] = $this->error['url_yandex_market'];
+                    } else {
+                        $data['error_url_yandex_market'] = array();
+                    }
+
+                    if (isset($this->error['url_megamarket'])) {
+                        $data['error_url_megamarket'] = $this->error['url_megamarket'];
+                    } else {
+                        $data['error_url_megamarket'] = array();
+                    }
+                ]]>
+            </add>
+        </operation>
+
+        <operation>
+            <search>
+                <![CDATA[
+                    if (isset($this->request->post['model'])) {
+                ]]>
+            </search>
+
+            <add position="before">
+                <![CDATA[
+                    if (isset($this->request->post['url_ozon'])) {
+                        $data['url_ozon'] = $this->request->post['url_ozon'];
+                    } elseif (!empty($product_info)) {
+                        $data['url_ozon'] = $product_info['url_ozon'];
+                    } else {
+                        $data['url_ozon'] = '';
+                    }
+
+                    if (isset($this->request->post['url_wildberries'])) {
+                        $data['url_wildberries'] = $this->request->post['url_wildberries'];
+                    } elseif (!empty($product_info)) {
+                        $data['url_wildberries'] = $product_info['url_wildberries'];
+                    } else {
+                        $data['url_wildberries'] = '';
+                    }
+
+                    if (isset($this->request->post['url_yandex_market'])) {
+                        $data['url_yandex_market'] = $this->request->post['url_yandex_market'];
+                    } elseif (!empty($product_info)) {
+                        $data['url_yandex_market'] = $product_info['url_yandex_market'];
+                    } else {
+                        $data['url_yandex_market'] = '';
+                    }
+
+                    if (isset($this->request->post['url_megamarket'])) {
+                        $data['url_megamarket'] = $this->request->post['url_megamarket'];
+                    } elseif (!empty($product_info)) {
+                        $data['url_megamarket'] = $product_info['url_megamarket'];
+                    } else {
+                        $data['url_megamarket'] = '';
+                    }
+                ]]>
+            </add>
+        </operation>
+
+        <operation>
+            <search>
+                <![CDATA[
+                    if ($this->error && !isset($this->error['warning'])) {
+                ]]>
+            </search>
+
+            <add position="before">
+                <![CDATA[
+                    $url_pattern = '/^((ftp|http|https):\/\/)?(www\.)?([A-Za-zА-Яа-я0-9]{1}[A-Za-zА-Яа-я0-9\-]*\.?)*\.{1}[A-Za-zА-Яа-я0-9-]{2,8}(\/([\w#!:.?+=&%@!\-\/])*)?/';
+
+                    if (!empty($this->request->post['url_ozon']) && !preg_match($url_pattern, $this->request->post['url_ozon'])) {
+                        $this->error['url_ozon'] = $this->language->get('error_invalid_url');
+                    }
+
+                    if (!empty($this->request->post['url_wildberries']) && !preg_match($url_pattern, $this->request->post['url_wildberries'])) {
+                        $this->error['url_wildberries'] = $this->language->get('error_invalid_url');
+                    }
+
+                    if (!empty($this->request->post['url_yandex_market']) && !preg_match($url_pattern, $this->request->post['url_yandex_market'])) {
+                        $this->error['url_yandex_market'] = $this->language->get('error_invalid_url');
+                    }
+
+                    if (!empty($this->request->post['url_megamarket']) && !preg_match($url_pattern, $this->request->post['url_megamarket'])) {
+                        $this->error['url_megamarket'] = $this->language->get('error_invalid_url');
+                    }
+                ]]>
+            </add>
+        </operation>
+    </file>
+
+    <file path="admin/model/catalog/product.php">
+        <operation>
+            <search>
+                <![CDATA[
+                    if (isset($data['image'])) {
+                ]]>
+            </search>
+
+            <add position="before">
+                <![CDATA[
+                    if (isset($data['url_ozon']) || isset($data['url_wildberries']) || isset($data['url_yandex_market']) || isset($data['url_megamarket'])) {
+                        $this->db->query("UPDATE ". DB_PREFIX . "product SET url_ozon = '" . $this->db->escape($data['url_ozon']) . "', url_wildberries = '" . $this->db->escape($data['url_wildberries']) . "', url_yandex_market = '" . $this->db->escape($data['url_yandex_market']) . "', url_megamarket = '" . $this->db->escape($data['url_megamarket']) . "' WHERE product_id = '" . (int)$product_id . "'");
+                    }
+                ]]>
+            </add>
+        </operation>
+    </file>
+
+    <file path="admin/view/template/catalog/product_form.twig">
+        <operation>
+            <search>
+                <![CDATA[
+                    <div class="tab-pane" id="tab-links">
+                ]]>
+            </search>
+
+            <add position="before" offset="1">
+                <![CDATA[
+                    {% if module_links_to_marketplaces_status %}
+                    {% if module_links_to_marketplaces.ozon.show or module_links_to_marketplaces.wildberries.show or module_links_to_marketplaces.yandex_market.show or module_links_to_marketplaces.megamarket.show %}
+                    <fieldset>
+                        <legend>{{ entry_links_to_marketplace }}</legend>
+
+                        {% if module_links_to_marketplaces.ozon.show %}
+                        <div class="form-group">
+                            <label class="col-sm-2 control-label" for="input-url-ozon">{{ entry_ozon }}</label>
+                            <div class="col-sm-10">
+                              <input type="url" name="url_ozon" value="{{ url_ozon }}" placeholder="{{ entry_ozon }}" id="input-url-ozon" class="form-control" />
+                              {% if error_url_ozon %}
+                                <div class="text-danger">{{ error_url_ozon }}</div>
+                              {% endif %}
+                            </div>
+                        </div>
+                        {% endif %}
+
+                        {% if module_links_to_marketplaces.wildberries.show %}
+                        <div class="form-group">
+                            <label class="col-sm-2 control-label" for="input-url-wildberries">{{ entry_wildberries }}</label>
+                            <div class="col-sm-10">
+                              <input type="url" name="url_wildberries" value="{{ url_wildberries }}" placeholder="{{ entry_wildberries }}" id="input-url-wildberries" class="form-control" />
+                              {% if error_url_wildberries %}
+                                <div class="text-danger">{{ error_url_wildberries }}</div>
+                              {% endif %}
+                            </div>
+                        </div>
+                        {% endif %}
+
+                        {% if module_links_to_marketplaces.yandex_market.show %}
+                        <div class="form-group">
+                            <label class="col-sm-2 control-label" for="input-url-yandex-market">{{ entry_yandex_market }}</label>
+                            <div class="col-sm-10">
+                              <input type="url" name="url_yandex_market" value="{{ url_yandex_market }}" placeholder="{{ entry_yandex_market }}" id="input-url-yandex-market" class="form-control" />
+                              {% if error_url_yandex_market %}
+                                <div class="text-danger">{{ error_url_yandex_market }}</div>
+                              {% endif %}
+                            </div>
+                        </div>
+                        {% endif %}
+
+                        {% if module_links_to_marketplaces.megamarket.show %}
+                        <div class="form-group">
+                            <label class="col-sm-2 control-label" for="input-url-megamarket">{{ entry_megamarket }}</label>
+                            <div class="col-sm-10">
+                              <input type="url" name="url_megamarket" value="{{ url_megamarket }}" placeholder="{{ entry_megamarket }}" id="input-url-megamarket" class="form-control" />
+                              {% if error_url_megamarket %}
+                                <div class="text-danger">{{ error_url_megamarket }}</div>
+                              {% endif %}
+                            </div>
+                        </div>
+                        {% endif %}
+                    </fieldset>
+                    {% endif %}
+                    {% endif %}
+                ]]>
+            </add>
+        </operation>
+    </file>
+
+    <file path="admin/language/en-gb/catalog/product.php">
+        <operation>
+            <search>
+                <![CDATA[
+                    <?php
+                ]]>
+            </search>
+
+            <add position="after">
+                <![CDATA[
+                    $_['entry_links_to_marketplace'] = 'Links to marketplaces';
+                    $_['entry_ozon'] = 'Ozon';
+                    $_['entry_wildberries'] = 'Wildberries';
+                    $_['entry_yandex_market'] = 'Yandex.Market';
+                    $_['entry_megamarket'] = 'Megamarket';
+                    $_['error_invalid_url'] = 'Invalid url';
+                ]]>
+            </add>
+        </operation>
+    </file>
+
+    <file path="catalog/controller/product/product.php">
+        <operation>
+            <search>
+                <![CDATA[
+                    $data['column_left'] = $this->load->controller('common/column_left');
+                ]]>
+            </search>
+
+            <add position="before">
+                <![CDATA[
+                    $this->document->addStyle('catalog/view/theme/default/stylesheet/links_to_marketplaces.css');
+                ]]>
+            </add>
+        </operation>
+
+        <operation>
+            <search>
+                <![CDATA[
+                    $this->response->setOutput($this->load->view('product/product', $data));
+                ]]>
+            </search>
+
+            <add position="before">
+                <![CDATA[
+                    $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+                    $data['url_ozon'] = !empty($product_info['url_ozon']) ? $product_info['url_ozon'] : '';
+                    $data['url_wildberries'] = !empty($product_info['url_wildberries']) ? $product_info['url_wildberries'] : '';
+                    $data['url_yandex_market'] = !empty($product_info['url_yandex_market']) ? $product_info['url_yandex_market'] : '';
+                    $data['url_megamarket'] = !empty($product_info['url_megamarket']) ? $product_info['url_megamarket'] : '';
+
+                    $data['module_links_to_marketplaces_status'] = $this->config->get('module_links_to_marketplaces_status');
+                    $data['module_links_to_marketplaces'] = $this->config->get('module_links_to_marketplaces');
+
+                    if (!empty($data['module_links_to_marketplaces']) && count($data['module_links_to_marketplaces'])) {
+                        foreach($data['module_links_to_marketplaces'] as $key => $linkData) {
+                            if (!empty($data['module_links_to_marketplaces'][$key]['image'])) {
+                                $data['module_links_to_marketplaces'][$key]['thumb'] = $this->model_tool_image->resize($data['module_links_to_marketplaces'][$key]['image'], $data['module_links_to_marketplaces']['icon']['width'], $data['module_links_to_marketplaces']['icon']['height']);
+                            } else {
+                                $data['module_links_to_marketplaces'][$key]['thumb'] = $data['placeholder'];
+                            }
+                        }
+                    }
+                ]]>
+            </add>
+        </operation>
+    </file>
+
+    <file path="admin/language/ru-ru/catalog/product.php">
+        <operation>
+            <search>
+                <![CDATA[
+                    <?php
+                ]]>
+            </search>
+
+            <add position="after">
+                <![CDATA[
+                    $_['entry_links_to_marketplace'] = 'Ссылки на маркетплейсы';
+                    $_['entry_ozon'] = 'Ozon';
+                    $_['entry_wildberries'] = 'Wildberries';
+                    $_['entry_yandex_market'] = 'Yandex.Market';
+                    $_['entry_megamarket'] = 'Megamarket';
+
+                    $_['error_invalid_url'] = 'Некорректная ссылка';
+                ]]>
+            </add>
+        </operation>
+    </file>
+
+    <file path="catalog/model/catalog/product.php">
+        <operation>
+            <search>
+                <![CDATA[
+                    'date_modified'    => $query->row['date_modified'],
+                ]]>
+            </search>
+
+            <add position="after">
+                <![CDATA[
+                    'url_ozon' => $query->row['url_ozon'],
+                    'url_wildberries' => $query->row['url_wildberries'],
+                    'url_yandex_market' => $query->row['url_yandex_market'],
+                    'url_megamarket' => $query->row['url_megamarket'],
+                ]]>
+            </add>
+        </operation>
+    </file>
+
+    <file path="catalog/view/theme/*/template/product/product.twig">
+        <operation>
+            <search>
+                <![CDATA[
+                    <ul class="nav nav-tabs">
+                ]]>
+            </search>
+
+            <add position="before">
+                <![CDATA[
+                    {% if module_links_to_marketplaces_status %}
+                    {% if module_links_to_marketplaces.ozon.show or module_links_to_marketplaces.wildberries.show or module_links_to_marketplaces.yandex_market.show or module_links_to_marketplaces.megamarket.show %}
+                    <div class="marketplaces">
+
+                        {% if module_links_to_marketplaces.ozon.show and url_ozon %}
+                        <div class="marketplaces__item">
+                            <a href="{{ url_ozon }}" target="_blank" class="marketplaces__link"><img src="{{ module_links_to_marketplaces.ozon.thumb }}" alt="" /></a>
+                        </div>
+                        {% endif %}
+
+                        {% if module_links_to_marketplaces.wildberries.show and url_wildberries %}
+                        <div class="marketplaces__item">
+                            <a href="{{ url_wildberries }}" target="_blank" class="marketplaces__link"><img src="{{ module_links_to_marketplaces.wildberries.thumb }}" alt="" /></a>
+                        </div>
+                        {% endif %}
+
+                        {% if module_links_to_marketplaces.yandex_market.show and url_yandex_market %}
+                        <div class="marketplaces__item">
+                            <a href="{{ url_yandex_market }}" target="_blank" class="marketplaces__link"><img src="{{ module_links_to_marketplaces.yandex_market.thumb }}" alt="" /></a>
+                        </div>
+                        {% endif %}
+
+                        {% if module_links_to_marketplaces.megamarket.show and url_megamarket %}
+                        <div class="marketplaces__item">
+                            <a href="{{ url_megamarket }}" target="_blank" class="marketplaces__link"><img src="{{ module_links_to_marketplaces.megamarket.thumb }}" alt="" /></a>
+                        </div>
+                        {% endif %}
+                    </div>
+                    {% endif %}
+                    {% endif %}
+                ]]>
+            </add>
+        </operation>
+    </file>
+</modification>

+ 113 - 0
upload/admin/controller/extension/module/links_to_marketplaces.php

@@ -0,0 +1,113 @@
+<?php
+class ControllerExtensionModuleLinksToMarketplaces extends Controller {
+    private $error = array();
+
+    public function install() {
+        $this->load->model('extension/module/links_to_marketplaces');
+
+        $this->model_extension_module_links_to_marketplaces->addColumnsToTable();
+    }
+
+    public function index() {
+        $this->load->language('extension/module/links_to_marketplaces');
+
+        $this->document->setTitle($this->language->get('heading_title'));
+
+        $this->load->model('setting/setting');
+
+        if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
+            $this->model_setting_setting->editSetting('module_links_to_marketplaces', $this->request->post);
+
+            $this->session->data['success'] = $this->language->get('text_success');
+
+            $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
+        }
+
+        if (isset($this->error['warning'])) {
+            $data['error_warning'] = $this->error['warning'];
+        } else {
+            $data['error_warning'] = '';
+        }
+
+        if (isset($this->error['icon_width'])) {
+            $data['error_icon_width'] = $this->error['icon_width'];
+        } else {
+            $data['error_icon_width'] = '';
+        }
+
+        if (isset($this->error['icon_height'])) {
+            $data['error_icon_height'] = $this->error['icon_height'];
+        } else {
+            $data['error_icon_height'] = '';
+        }
+
+        $data['breadcrumbs'] = array();
+
+        $data['breadcrumbs'][] = array(
+            'text' => $this->language->get('text_home'),
+            'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
+        );
+
+        $data['breadcrumbs'][] = array(
+            'text' => $this->language->get('text_extension'),
+            'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)
+        );
+
+        $data['breadcrumbs'][] = array(
+            'text' => $this->language->get('heading_title'),
+            'href' => $this->url->link('extension/module/links_to_marketplaces', 'user_token=' . $this->session->data['user_token'], true)
+        );
+
+        $data['action'] = $this->url->link('extension/module/links_to_marketplaces', 'user_token=' . $this->session->data['user_token'], true);
+
+        $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
+
+        if (isset($this->request->post['module_links_to_marketplaces_status'])) {
+            $data['module_links_to_marketplaces_status'] = $this->request->post['module_links_to_marketplaces_status'];
+        } else {
+            $data['module_links_to_marketplaces_status'] = $this->config->get('module_links_to_marketplaces_status');
+        }
+
+        if (isset($this->request->post['module_links_to_marketplaces'])) {
+            $data['module_links_to_marketplaces'] = $this->request->post['module_links_to_marketplaces'];
+        } else {
+            $data['module_links_to_marketplaces'] = $this->config->get('module_links_to_marketplaces');
+        }
+
+        $this->load->model('tool/image');
+
+        $data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
+
+        if (!empty($data['module_links_to_marketplaces']) && count($data['module_links_to_marketplaces'])) {
+            foreach($data['module_links_to_marketplaces'] as $key => $linkData) {
+                if (!empty($data['module_links_to_marketplaces'][$key]['image'])) {
+                    $data['module_links_to_marketplaces'][$key]['thumb'] = $this->model_tool_image->resize($data['module_links_to_marketplaces'][$key]['image'], 100, 100);
+                } else {
+                    $data['module_links_to_marketplaces'][$key]['thumb'] = $data['placeholder'];
+                }
+            }
+        }
+
+        $data['header'] = $this->load->controller('common/header');
+        $data['column_left'] = $this->load->controller('common/column_left');
+        $data['footer'] = $this->load->controller('common/footer');
+
+        $this->response->setOutput($this->load->view('extension/module/links_to_marketplaces', $data));
+    }
+
+    protected function validate() {
+        if (!$this->user->hasPermission('modify', 'extension/module/links_to_marketplaces')) {
+            $this->error['warning'] = $this->language->get('error_permission');
+        }
+
+        if (empty($this->request->post['module_links_to_marketplaces']['icon']['width']) || (int)$this->request->post['module_links_to_marketplaces']['icon']['width'] <= 0) {
+            $this->error['icon_width'] = $this->language->get('error_icon_width');
+        }
+
+        if (empty($this->request->post['module_links_to_marketplaces']['icon']['height']) || (int)$this->request->post['module_links_to_marketplaces']['icon']['height'] <= 0) {
+            $this->error['icon_height'] = $this->language->get('error_icon_height');
+        }
+
+        return !$this->error;
+    }
+}

+ 24 - 0
upload/admin/language/en-gb/extension/module/links_to_marketplaces.php

@@ -0,0 +1,24 @@
+<?php
+// Heading
+$_['heading_title']    = 'Links to marketplaces';
+
+// Text
+$_['text_extension']     = 'Extensions';
+$_['text_success']       = 'Success: You have modified account module!';
+$_['text_edit']          = 'Edit Account Module';
+$_['text_ozon']          = 'Ozon';
+$_['text_wildberries']   = 'Wildberries';
+$_['text_yandex_market'] = 'Yandex.Market';
+$_['text_megamarket']    = 'Megamarket';
+
+// Entry
+$_['entry_status']      = 'Status';
+$_['entry_show']        = 'Show';
+$_['entry_icon_width']  = 'Icon width';
+$_['entry_icon_height'] = 'Icon height';
+$_['entry_image']       = 'Icon';
+
+// Error
+$_['error_permission'] = 'Warning: You do not have permission to modify account module!';
+$_['error_icon_width'] = 'Icon width invalid';
+$_['error_icon_height'] = 'Icon height invalid';

+ 24 - 0
upload/admin/language/ru-ru/extension/module/links_to_marketplaces.php

@@ -0,0 +1,24 @@
+<?php
+// Heading
+$_['heading_title']    = 'Ссылки на маркетплейсы';
+
+// Text
+$_['text_extension']   = 'Расширения';
+$_['text_success']     = 'Настройки успешно изменены!';
+$_['text_edit']        = 'Настройки модуля';
+$_['text_ozon']          = 'Ozon';
+$_['text_wildberries']   = 'Wildberries';
+$_['text_yandex_market'] = 'Yandex.Market';
+$_['text_megamarket']    = 'Megamarket';
+
+// Entry
+$_['entry_status']      = 'Статус';
+$_['entry_show']        = 'Отображать';
+$_['entry_icon_width']  = 'Ширина иконки';
+$_['entry_icon_height'] = 'Высота иконки';
+$_['entry_image']       = 'Иконка';
+
+// Error
+$_['error_permission'] = 'У Вас нет прав для изменения модуля Аккаунт!';
+$_['error_icon_width'] = 'Некорректная ширина иконки';
+$_['error_icon_height'] = 'Некорректная высота иконки';

+ 28 - 0
upload/admin/model/extension/module/links_to_marketplaces.php

@@ -0,0 +1,28 @@
+<?php
+class ModelExtensionModuleLinksToMarketplaces extends Model {
+    public function addColumnsToTable() {
+        $has_url_ozon_column = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE Field='url_ozon'")->num_rows > 0;
+
+        if (!$has_url_ozon_column) {
+            $this->db->query("ALTER TABLE " . DB_PREFIX . "product ADD COLUMN url_ozon VARCHAR(255) NULL");
+        }
+
+        $has_url_wildberries_column = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE Field='url_wildberries'")->num_rows > 0;
+
+        if (!$has_url_wildberries_column) {
+            $this->db->query("ALTER TABLE " . DB_PREFIX . "product ADD COLUMN url_wildberries VARCHAR(255) NULL");
+        }
+
+        $has_url_yandex_market_column = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE Field='url_yandex_market'")->num_rows > 0;
+
+        if (!$has_url_yandex_market_column) {
+            $this->db->query("ALTER TABLE " . DB_PREFIX . "product ADD COLUMN url_yandex_market VARCHAR(255) NULL");
+        }
+
+        $has_url_megamarket_column = $this->db->query("SHOW COLUMNS FROM " . DB_PREFIX . "product WHERE Field='url_megamarket'")->num_rows > 0;
+
+        if (!$has_url_megamarket_column) {
+            $this->db->query("ALTER TABLE " . DB_PREFIX . "product ADD COLUMN url_megamarket VARCHAR(255) NULL");
+        }
+    }
+}

+ 183 - 0
upload/admin/view/template/extension/module/links_to_marketplaces.twig

@@ -0,0 +1,183 @@
+{{ header }}{{ column_left }}
+<div id="content">
+  <div class="page-header">
+    <div class="container-fluid">
+      <div class="pull-right">
+        <button type="submit" form="form-module" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
+        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
+      <h1>{{ heading_title }}</h1>
+      <ul class="breadcrumb">
+        {% for breadcrumb in breadcrumbs %}
+        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
+        {% endfor %}
+      </ul>
+    </div>
+  </div>
+  <div class="container-fluid">
+    {% if error_warning %}
+    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
+      <button type="button" class="close" data-dismiss="alert">&times;</button>
+    </div>
+    {% endif %}
+    <div class="panel panel-default">
+      <div class="panel-heading">
+        <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
+      </div>
+      <div class="panel-body">
+        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-module" class="form-horizontal">
+          <div class="form-group">
+            <label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
+            <div class="col-sm-10">
+              <select name="module_links_to_marketplaces_status" id="input-status" class="form-control">
+                {% if module_links_to_marketplaces_status %}
+                <option value="1" selected="selected">{{ text_enabled }}</option>
+                <option value="0">{{ text_disabled }}</option>
+                {% else %}
+                <option value="1">{{ text_enabled }}</option>
+                <option value="0" selected="selected">{{ text_disabled }}</option>
+                {% endif %}
+              </select>
+            </div>
+          </div>
+
+          <div class="form-group">
+            <label class="col-sm-2 control-label" for="input-icon-width">{{ entry_icon_width }}</label>
+            <div class="col-sm-10">
+              <input type="text" name="module_links_to_marketplaces[icon][width]" value="{{ module_links_to_marketplaces.icon.width }}" placeholder="{{ entry_icon_width }}" id="input-icon-width" class="form-control" />
+              {% if error_icon_width %}
+                <div class="text-danger">{{ error_icon_width }}</div>
+              {% endif %}
+            </div>
+          </div>
+
+          <div class="form-group">
+            <label class="col-sm-2 control-label" for="input-icon-height">{{ entry_icon_height }}</label>
+            <div class="col-sm-10">
+              <input type="text" name="module_links_to_marketplaces[icon][height]" value="{{ module_links_to_marketplaces.icon.height }}" placeholder="{{ entry_icon_height }}" id="input-icon-height" class="form-control" />
+              {% if error_icon_height %}
+                <div class="text-danger">{{ error_icon_height }}</div>
+              {% endif %}
+            </div>
+          </div>
+
+          <fieldset>
+            <legend>{{ text_ozon }}</legend>
+
+            <div class="form-group">
+              <label class="col-sm-2 control-label" for="input-ozon-show">{{ entry_show }}</label>
+              <div class="col-sm-10">
+                <div class="checkbox">
+                  <label>
+                    {% if module_links_to_marketplaces.ozon.show %}
+                      <input type="checkbox" name="module_links_to_marketplaces[ozon][show]" value="1" checked="checked" id="input-ozon-show" />
+                    {% else %}
+                      <input type="checkbox" name="module_links_to_marketplaces[ozon][show]" value="1" id="input-ozon-show" />
+                    {% endif %}
+                  </label>
+                </div>
+              </div>
+            </div>
+
+            <div class="form-group">
+              <label for="input-image-ozon" class="col-sm-2 control-label">{{ entry_image }}</label>
+              <div class="col-sm-10">
+                <a href="" id="thumb-image-ozon" data-toggle="image" class="img-thumbnail">
+                  <img src="{{ module_links_to_marketplaces.ozon.thumb ? module_links_to_marketplaces.ozon.thumb : placeholder }}" alt="" title="" data-placeholder="{{ placeholder }}"/>
+                </a>
+                  <input type="hidden" name="module_links_to_marketplaces[ozon][image]" value="{{ module_links_to_marketplaces.ozon.image }}" id="input-image-ozon" />
+              </div>
+            </div>
+          </fieldset>
+
+          <fieldset>
+            <legend>{{ text_wildberries }}</legend>
+
+            <div class="form-group">
+              <label class="col-sm-2 control-label" for="input-wildberries-show">{{ entry_show }}</label>
+              <div class="col-sm-10">
+                <div class="checkbox">
+                  <label>
+                    {% if module_links_to_marketplaces.wildberries.show %}
+                      <input type="checkbox" name="module_links_to_marketplaces[wildberries][show]" value="1" checked="checked" id="input-wildberries-show" />
+                    {% else %}
+                      <input type="checkbox" name="module_links_to_marketplaces[wildberries][show]" value="1" id="input-wildberries-show" />
+                    {% endif %}
+                  </label>
+                </div>
+              </div>
+            </div>
+
+            <div class="form-group">
+              <label for="input-image-wildberries" class="col-sm-2 control-label">{{ entry_image }}</label>
+              <div class="col-sm-10">
+                <a href="" id="thumb-image-wildberries" data-toggle="image" class="img-thumbnail">
+                  <img src="{{ module_links_to_marketplaces.wildberries.thumb ? module_links_to_marketplaces.wildberries.thumb : placeholder }}" alt="" title="" data-placeholder="{{ placeholder }}"/>
+                </a>
+                <input type="hidden" name="module_links_to_marketplaces[wildberries][image]" value="{{ module_links_to_marketplaces.wildberries.image }}" id="input-image-wildberries" />
+              </div>
+            </div>
+          </fieldset>
+
+          <fieldset>
+            <legend>{{ text_yandex_market }}</legend>
+
+            <div class="form-group">
+              <label class="col-sm-2 control-label" for="input-yandex-market-show">{{ entry_show }}</label>
+              <div class="col-sm-10">
+                <div class="checkbox">
+                  <label>
+                    {% if module_links_to_marketplaces.yandex_market.show %}
+                      <input type="checkbox" name="module_links_to_marketplaces[yandex_market][show]" value="1" checked="checked" id="input-yandex-market-show" />
+                    {% else %}
+                      <input type="checkbox" name="module_links_to_marketplaces[yandex_market][show]" value="1" id="input-yandex-market-show" />
+                    {% endif %}
+                  </label>
+                </div>
+              </div>
+            </div>
+
+            <div class="form-group">
+              <label for="input-image-yandex-market" class="col-sm-2 control-label">{{ entry_image }}</label>
+              <div class="col-sm-10">
+                <a href="" id="thumb-image-yandex-market" data-toggle="image" class="img-thumbnail">
+                  <img src="{{ module_links_to_marketplaces.yandex_market.thumb ? module_links_to_marketplaces.yandex_market.thumb : placeholder }}" alt="" title="" data-placeholder="{{ placeholder }}"/>
+                </a>
+                <input type="hidden" name="module_links_to_marketplaces[yandex_market][image]" value="{{ module_links_to_marketplaces.yandex_market.image }}" id="input-image-yandex-market" />
+              </div>
+            </div>
+          </fieldset>
+
+          <fieldset>
+            <legend>{{ text_megamarket }}</legend>
+
+            <div class="form-group">
+              <label class="col-sm-2 control-label" for="input-megamarket-show">{{ entry_show }}</label>
+              <div class="col-sm-10">
+                <div class="checkbox">
+                  <label>
+                    {% if module_links_to_marketplaces.megamarket.show %}
+                      <input type="checkbox" name="module_links_to_marketplaces[megamarket][show]" value="1" checked="checked" id="input-megamarket-show" />
+                    {% else %}
+                      <input type="checkbox" name="module_links_to_marketplaces[megamarket][show]" value="1" id="input-megamarket-show" />
+                    {% endif %}
+                  </label>
+                </div>
+              </div>
+            </div>
+
+            <div class="form-group">
+              <label for="input-image-megamarket" class="col-sm-2 control-label">{{ entry_image }}</label>
+              <div class="col-sm-10">
+                <a href="" id="thumb-image-megamarket" data-toggle="image" class="img-thumbnail">
+                  <img src="{{ module_links_to_marketplaces.megamarket.thumb ? module_links_to_marketplaces.megamarket.thumb : placeholder }}" alt="" title="" data-placeholder="{{ placeholder }}"/>
+                </a>
+                <input type="hidden" name="module_links_to_marketplaces[megamarket][image]" value="{{ module_links_to_marketplaces.megamarket.image }}" id="input-image-megamarket" />
+              </div>
+            </div>
+          </fieldset>
+        </form>
+      </div>
+    </div>
+  </div>
+</div>
+{{ footer }}

+ 17 - 0
upload/catalog/view/theme/default/stylesheet/links_to_marketplaces.css

@@ -0,0 +1,17 @@
+.marketplaces {
+    display: flex;
+    justify-content: flex-start;
+    margin: 20px 0;
+}
+
+.marketplaces__item {
+    margin-right: 15px;
+    box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
+    border-radius: 10px;
+    overflow: hidden;
+    transition: all 0.3s ease;
+}
+
+.marketplaces__item:hover {
+    transform: scale(1.1);
+}