Jump to content

dayto

Новичок
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Обычный

About dayto

  • Rank
    Новичок
  1. Для opencart 2.3.0.2.3 вариант предложенный Yurasik admin/language/russian/desing/layout.php Перед: $_['text_content_top'] = 'Вверху страницы'; Добавляем: $_['text_header_content'] = 'Шапка сайта'; admin/controller/design/layout.php Перед: $data['text_content_top'] = $this->language->get('text_content_top'); Добавляем: $data['text_header_content'] = $this->language->get('text_header_content'); admin/view/template/design/layout_form.tpl Перед: <table id="module-content-top" class="table table-striped table-bordered table-hover"> Добавляем: <table id="module-header_content" class="table table-striped table-bordered table-hover"> <thead> <tr> <td class="text-center"><?php echo $text_header_content; ?></td> </tr> </thead> <tbody> <?php foreach ($layout_modules as $layout_module) { ?> <?php if ($layout_module['position'] == 'header_content') { ?> <tr id="module-row<?php echo $module_row; ?>"> <td class="text-left"><div class="input-group"> <select name="layout_module[<?php echo $module_row; ?>][code]" class="form-control input-sm"> <?php foreach ($extensions as $extension) { ?> <optgroup label="<?php echo $extension['name']; ?>"> <?php if (!$extension['module']) { ?> <?php if ($extension['code'] == $layout_module['code']) { ?> <option value="<?php echo $extension['code']; ?>" selected="selected"><?php echo $extension['name']; ?></option> <?php } else { ?> <option value="<?php echo $extension['code']; ?>"><?php echo $extension['name']; ?></option> <?php } ?> <?php } else { ?> <?php foreach ($extension['module'] as $module) { ?> <?php if ($module['code'] == $layout_module['code']) { ?> <option value="<?php echo $module['code']; ?>" selected="selected"><?php echo $module['name']; ?></option> <?php } else { ?> <option value="<?php echo $module['code']; ?>"><?php echo $module['name']; ?></option> <?php } ?> <?php } ?> <?php } ?> </optgroup> <?php } ?> </select> <input type="hidden" name="layout_module[<?php echo $module_row; ?>][position]" value="<?php echo $layout_module['position']; ?>" /> <input type="hidden" name="layout_module[<?php echo $module_row; ?>][sort_order]" value="<?php echo $layout_module['sort_order']; ?>" /> <div class="input-group-btn"> <a href="<?php echo $layout_module['edit']; ?>" type="button" data-toggle="tooltip" title="<?php echo $button_edit; ?>" target="_blank" class="btn btn-primary btn-sm"><i class="fa fa-pencil"></i></a> <button type="button" onclick="$('#module-row<?php echo $module_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger btn-sm"><i class="fa fa fa-minus-circle"></i></button> </div> </div></td> </tr> <?php $module_row++; ?> <?php } ?> <?php } ?> </tbody> <tfoot> <tr> <td class="text-left"><div class="input-group"> <select class="form-control input-sm"> <?php foreach ($extensions as $extension) { ?> <optgroup label="<?php echo $extension['name']; ?>"> <?php if (!$extension['module']) { ?> <option value="<?php echo $extension['code']; ?>"><?php echo $extension['name']; ?></option> <?php } else { ?> <?php foreach ($extension['module'] as $module) { ?> <option value="<?php echo $module['code']; ?>"><?php echo $module['name']; ?></option> <?php } ?> <?php } ?> </optgroup> <?php } ?> </select> <div class="input-group-btn"> <button type="button" onclick="addModule('header_content');" data-toggle="tooltip" title="<?php echo $button_module_add; ?>" class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i></button> </div> </div></td> </tr> </tfoot> </table> В двух местах Перед: #module-content-top, Добавляем: #module-header_content, catalog/controller/common/header.php Перед: $data['language'] = $this->load->controller('common/language'); Добавляем: $data['header_content'] = $this->load->controller('common/header_content'); catalog/controller/common/header_content.php Создаем и добавляем: <?php class ControllerCommonHeaderContent extends Controller { public function index() { $this->load->model('design/layout'); if (isset($this->request->get['route'])) { $route = (string)$this->request->get['route']; } else { $route = 'common/home'; } $layout_id = 0; if ($route == 'product/manufacturer/info' && isset($this->request->get['manufacturer_id'])) { $this->load->model('catalog/manufacturer'); $layout_id = $this->model_catalog_manufacturer->getManufacturerLayoutId($this->request->get['manufacturer_id']); } if ($route == 'product/category' && isset($this->request->get['path'])) { $this->load->model('catalog/category'); $path = explode('_', (string)$this->request->get['path']); $layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path)); } if ($route == 'product/product' && isset($this->request->get['product_id'])) { $this->load->model('catalog/product'); $layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']); } if ($route == 'information/information' && isset($this->request->get['information_id'])) { $this->load->model('catalog/information'); $layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']); } if ($route == 'blog/category' && isset($this->request->get['blog_category_id'])) { $this->load->model('blog/category'); $layout_id = $this->model_blog_category->getCategoryLayoutId($this->request->get['blog_category_id']); } if ($route == 'blog/article' && isset($this->request->get['article_id'])) { $this->load->model('blog/article'); $layout_id = $this->model_blog_article->getArticleLayoutId($this->request->get['article_id']); } if (!$layout_id) { $layout_id = $this->model_design_layout->getLayout($route); } if (!$layout_id) { $layout_id = $this->config->get('config_layout_id'); } $this->load->model('extension/module'); $data['modules'] = array(); $modules = $this->model_design_layout->getLayoutModules($layout_id, 'header_content'); foreach ($modules as $module) { $part = explode('.', $module['code']); if (isset($part[0]) && $this->config->get($part[0] . '_status')) { $module_data = $this->load->controller('extension/module/' . $part[0]); if ($module_data) { $data['modules'][] = $module_data; } } if (isset($part[1])) { $setting_info = $this->model_extension_module->getModule($part[1]); if ($setting_info && $setting_info['status']) { $output = $this->load->controller('extension/module/' . $part[0], $setting_info); if ($output) { $data['modules'][] = $output; } } } } return $this->load->view('common/header_content', $data); } } catalog/view/theme/*theme_name*/template/common/header_content.tpl Создаем и добавляем: <?php foreach ($modules as $module) { ?> <?php echo $module; ?> <?php } ?> catalog/view/theme/*theme_name*/template/common/header.tpl Добавляем в необходимом месте: <?php echo $header_content; ?>
×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.