Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Не подключает js и css файлы в новом позиции


sanyok
 Share

Recommended Posts

Здравствуйте.

 

Создал новую позицию для header модуль норм выводит. поставил слайдер в главном странице норм отображается а во внутренних страницах js и css не подключаются и слайдер ломается. 

 

Заранее спасибо

Link to comment
Share on other sites


Кстати, не где не подключает js и css файлы модуль слайдшов, даже на главном стр. (((

 

файл catalog/controller/common/top_slider.php

<?php
class ControllerCommonTopSlider 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/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 (!$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, 'top_slider');

		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/top_slider', $data);
	}
}

файл catalog/view/theme/default/template/common/top_slider.tpl

<?php foreach ($modules as $module) { ?>
<?php echo $module; ?>
<?php } ?>

файл catalog/view/theme/default/template/common/header.tpl


<div class="container">
	<div class="menuslider">
		
			<div class="menuinner">
				<?php if ($categories) { ?>
				<nav id="menu">
					<div class="navbar-header">
						<span class="navbar-title"><?php echo $text_category; ?></span>
						<button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>
					</div>
					<div class="collapse navbar-collapse navbar-ex1-collapse">
						<ul class="nav">
							<?php foreach ($categories as $category) { ?>
							<li><a href="<?php echo $category['href']; ?>"<?php echo ($category['category_id'] == $category_id) ? ' class="active"' : ''; ?>><?php echo $category['name']; ?></a></li>
							<?php } ?>
						</ul>
					</div>
				</nav>
				<?php } ?>
			</div>
			<div class="sliderinner"><?php echo $top_slider; ?></div>

	</div>
</div>

Файл top_slider.ocmod.xml

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <name>Новая позиция Слайдер в шапке</name>
    <code>Position</code>
    <version>1.0</version>
    <author>OcStore 2.3</author>
    <date>17.06.2018</date>
    <file path="admin/controller/design/layout.php">
        <operation>
            <search><![CDATA[$data['text_column_right'] = $this->language->get('text_column_right');]]></search>
            <add position="after"><![CDATA[        $data['text_top_slider'] = $this->language->get('text_top_slider');]]></add>
        </operation>
    </file>

    <file path="admin/language/ru-ru/design/layout.php">
        <operation>
            <search><![CDATA[$_['text_column_right']         = 'Правая колонка';]]></search>
            <add position="after"><![CDATA[$_['text_top_slider']           = 'Слайдер в шапке';]]></add>
        </operation>
    </file>     

    <file path="admin/view/template/design/layout_form.tpl">
        <operation>
            <search><![CDATA[<table id="module-content-top" class="table table-striped table-bordered table-hover">]]></search>
            <add position="before"><![CDATA[                <table id="module-top-slider" class="table table-striped table-bordered table-hover">
                  <thead>
                    <tr>
                      <td class="text-center"><?php echo $text_top_slider; ?></td>
                    </tr>
                  </thead>
                  <tbody>
                    <?php foreach ($layout_modules as $layout_module) { ?>
                    <?php if ($layout_module['position'] == 'top_slider') { ?>
                    <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('top-slider');" 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>]]></add>
        </operation>
     
        <operation>
            <search><![CDATA[$('#module-column-left, #module-column-right, #module-content-top, #module-content-bottom').delegate('select[name*=\'code\']', 'change', function() {]]></search>
            <add position="replace"><![CDATA[$('#module-column-left, #module-column-right, #module-content-top, #module-content-bottom, #module-top-slider').delegate('select[name*=\'code\']', 'change', function() {]]></add>
        </operation>
     
        <operation>
            <search><![CDATA[$('#module-column-left, #module-column-right, #module-content-top, #module-content-bottom').trigger('change');]]></search>
            <add position="replace"><![CDATA[$('#module-column-left, #module-column-right, #module-content-top, #module-content-bottom, #module-top-slider').trigger('change');]]></add>
        </operation>
    </file> 
 
    <file path="catalog/controller/common/header.php">
        <operation>
            <search><![CDATA[$data['language'] = $this->load->controller('common/language');]]></search>
            <add position="before"><![CDATA[        $data['top_slider'] = $this->load->controller('common/top_slider');]]></add>
        </operation>
    </file>

</modification>

 

Edited by sanyok
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

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.