如何使用侧边栏在类别页面上显示全宽横幅

时间:2015-10-05 07:52:34

标签: opencart2.x opencart-module

我在OpenCart中创建了一个名为testt的侧边栏。我想在category page with sidebar上显示它。

layout->category page我编辑并按排序顺序testt0

设置content top

但它显示在right sidebar

如何在full width

中显示此横幅广告

1 个答案:

答案 0 :(得分:0)

我在xml下面使用VQmod,它在布局上提供页眉和页脚位置选项。

<modification>
    <id><![CDATA[Header and Footer Options in Layout for Modules ]]></id>
    <version><![CDATA[2.0]]></version>
    <vqmver><![CDATA[2.5.1]]></vqmver>
    <author><![CDATA[Ramesh Chaudhary]]></author>

    <file path="admin/controller/design/" name="layout.php">
        <operation error="skip">
            <search position="before">
                <![CDATA[
                $data['text_content_top'] = $this->language->get('text_content_top');
                 ]]>

            </search>
            <add><![CDATA[
               $data['text_content_header'] = $this->language->get('text_content_header');
               $data['text_content_footer'] = $this->language->get('text_content_footer');
                ]]></add>

        </operation>


    </file>

    <file path="admin/language/english/design/" name="layout.php">
        <operation error="skip">
            <search position="bottom">
                <![CDATA[
                 ]]>

            </search>
            <add><![CDATA[
               $_['text_content_header'] = 'Header';
               $_['text_content_footer'] = 'Footer';
                ]]></add>

        </operation>
    </file>

    <file path="admin/view/template/design/" name="layout_form.tpl">
        <operation error="skip">
            <search position="after">
                <![CDATA[
                <td class="text-left"><select name="layout_module[<?php echo $module_row; ?>][position]" class="form-control">
                 ]]>

            </search>
            <add><![CDATA[
               <?php if ($layout_module['position'] == 'content_header') { ?>
                    <option value="content_header" selected="selected"><?php echo $text_content_header; ?></option>
                    <?php } else { ?>
                    <option value="content_header"><?php echo $text_content_header; ?></option>
                    <?php } ?>

                    <?php if ($layout_module['position'] == 'content_footer') { ?>
                    <option value="content_footer" selected="selected"><?php echo $text_content_footer; ?></option>
                    <?php } else { ?>
                    <option value="content_footer"><?php echo $text_content_footer; ?></option>
                    <?php } ?>

                ]]></add>

        </operation>

        <operation error="skip">
            <search position="after">
                <![CDATA[
                html += '  <td class="text-left"><select name="layout_module[' + module_row + '][position]" class="form-control">';
                 ]]>

            </search>
            <add><![CDATA[
                 html += '    <option value="content_header"><?php echo $text_content_header; ?></option>';
                 html += '    <option value="content_footer"><?php echo $text_content_footer; ?></option>';

                ]]></add>

        </operation>

    </file>


    <file path="catalog/controller/common/" name="header.php">
        <operation error="skip" info="For frontend header add modules feature">
            <search position="after">
                <![CDATA[

        $data['title'] = $this->document->getTitle();
                 ]]>

            </search>
            <add><![CDATA[

        $this->load->model('design/layout');
        $this->load->model('catalog/information');
        $this->load->model('catalog/product');
        $this->load->model('catalog/category');

        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'])) {
            $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'])) {
            $layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
        }

        if ($route == 'information/information' && isset($this->request->get['information_id'])) {
            $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');
        }

        $data['modules'] = array();

        $modules = $this->model_design_layout->getLayoutModules($layout_id, 'content_header');
        foreach ($modules as $module) {
            $part = explode('.', $module['code']);

            if (isset($part[0]) && $this->config->get($part[0] . '_status')) {
                $data['modules'][] = $this->load->controller('module/' . $part[0]);
            }

            if (isset($part[1])) {
                $setting_info = $this->model_extension_module->getModule($part[1]);

                if ($setting_info && $setting_info['status']) {
                    $data['modules'][] = $this->load->controller('module/' . $part[0], $setting_info);
                }
            }
        }


                ]]></add>

        </operation>

    </file>
    <file path="catalog/view/theme/*/template/common/" name="header.tpl">
        <operation error="skip" info="print module on front header">
            <search position="bottom" offset="1">
                <![CDATA[
                 ]]>

            </search>
            <add><![CDATA[
                    <?php foreach ($modules as $module) { ?>
                    <?php echo $module; ?>
                    <?php } ?>
                ]]></add>

        </operation>

    </file>

    <file path="catalog/controller/common/" name="footer.php">
        <operation error="skip" info="For frontend footer add modules feature">
            <search position="before">
                <![CDATA[
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/footer.tpl')) {
                 ]]>

            </search>
            <add><![CDATA[

        $this->load->model('design/layout');
        $this->load->model('catalog/product');
        $this->load->model('catalog/category');

        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'])) {
            $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'])) {
            $layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
        }

        if ($route == 'information/information' && isset($this->request->get['information_id'])) {
            $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');
        }

        $data['modules'] = array();

        $modules = $this->model_design_layout->getLayoutModules($layout_id, 'content_footer');

        foreach ($modules as $module) {
            $part = explode('.', $module['code']);

            if (isset($part[0]) && $this->config->get($part[0] . '_status')) {
                $data['modules'][] = $this->load->controller('module/' . $part[0]);
            }

            if (isset($part[1])) {
                $setting_info = $this->model_extension_module->getModule($part[1]);

                if ($setting_info && $setting_info['status']) {
                    $data['modules'][] = $this->load->controller('module/' . $part[0], $setting_info);
                }
            }
        }

                ]]></add>

        </operation>

    </file>
    <file path="catalog/view/theme/*/template/common/" name="footer.tpl">
        <operation error="skip" info="print module on front footer">
            <search position="top" offset="0">
                <![CDATA[
                 ]]>

            </search>
            <add><![CDATA[
                    <?php foreach ($modules as $module) { ?>
                    <?php echo $module; ?>
                    <?php } ?>
                ]]></add>

        </operation>

    </file>

</modification>