[Помогите] Вывод описание категории в правой колонке

Тема в разделе "OpenCart", создана пользователем kastahhls, 14 апр 2014.

  1. kastahhls

    kastahhls

    Регистрация:
    30 дек 2012
    Сообщения:
    114
    Симпатии:
    13
    Помогите сделать описание категории в правой колонке сайт.
    Желательно вот это дополнительное описание:
    Код:
    <modification>
        <id>category_short_description</id>
        <version>1.0</version>
        <vqmver>1.1.1</vqmver>
        <author>starlin</author>
        <!-- back -->
        <file name="admin/controller/catalog/category.php">
            <operation>
                <search position="after" offset="7"><![CDATA[
                      public function index() {
                ]]></search>
                <add><![CDATA[
                    $query = $this->db->query("DESC " . DB_PREFIX . "category_description short_desc");
                    if (!$query->num_rows) {
                        $this->db->query("ALTER TABLE `" . DB_PREFIX . "category_description` ADD `short_desc` text COLLATE utf8_bin NOT NULL");
                    }
                ]]></add>
            </operation>
        </file>
        <file name="admin/model/catalog/category.php">
            <operation>
                <search position="replace" offset="2"><![CDATA[
                foreach ($data['category_description'] as $language_id => $value) {
                ]]>
                </search>
                <add><![CDATA[
                foreach ($data['category_description'] as $language_id => $value) {
                    $this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "', short_desc = '" . $this->db->escape($value['short_desc']) . "'");
                }
                ]]></add>
            </operation>
        </file>
        <file name="admin/model/catalog/category.php">
            <operation>
                <search position="after"><![CDATA[
                    'description'      => $result['description']
                ]]>
                </search>
                <add><![CDATA[
                    , 'short_desc' => $result['short_desc']
                ]]></add>
            </operation>
        </file>
        <file name="admin/controller/catalog/category.php">
            <operation>
                <search position="after" offset="1"><![CDATA[
                $this->data['category_description'] = array();
                ]]>
                </search>
                <add><![CDATA[
                if (isset($this->error['short_desc'])) {
                $this->data['short_desc'] = $this->error['short_desc'];
            } else {
                $this->data['short_desc'] = array();
            }
                ]]></add>
            </operation>
        </file>
        <file name="admin/controller/catalog/category.php">
            <operation>
                <search position="after"><![CDATA[
                $this->data['entry_description'] = $this->language->get('entry_description');
                ]]>
                </search>
                <add><![CDATA[
                $this->data['entry_short_desc'] = $this->language->get('entry_short_desc');
                ]]></add>
            </operation>
        </file>
        <file name="admin/language/english/catalog/category.php">
            <operation>
                <search position="after"><![CDATA[
                $_['entry_description']      = 'Description:';
                ]]>
                </search>
                <add><![CDATA[
                $_['entry_short_desc']      = 'Additional description:';
                ]]></add>
            </operation>
        </file>
        <file name="admin/language/russian/catalog/category.php">
            <operation>
                <search position="after"><![CDATA[
                $_['entry_description']      = 'Описание:';
                ]]>
                </search>
                <add><![CDATA[
                $_['entry_short_desc']      = 'Additional description:';
                ]]></add>
            </operation>
        </file>
        
        <file name="admin/view/template/catalog/category_form.tpl">
            <operation>
                <search position="after" offset="2"><![CDATA[
                <td><?php echo $entry_description; ?></td>]]>
                </search>
                <add><![CDATA[
                    <tr>        
                    <td><?php echo $entry_short_desc; ?></td>
                    <td><textarea name="category_description[<?php echo $language['language_id']; ?>][short_desc]" id="short_desc<?php echo $language['language_id']; ?>"><?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['short_desc'] : ''; ?></textarea></td>
                    </tr>
                    ]]></add>
            </operation>
        </file>
        <file name="admin/view/template/catalog/category_form.tpl">
            <operation>
                <search position="after" offset="3"><![CDATA[
                filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
                ]]></search>
                <add><![CDATA[       
                    <script type="text/javascript" src="view/javascript/ckeditor/ckeditor.js"></script>
                    <script type="text/javascript"><!--
                    <?php foreach ($languages as $language) { ?>
                    CKEDITOR.replace('short_desc<?php echo $language['language_id']; ?>', {
                    filebrowserBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
                    filebrowserImageBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
                    filebrowserFlashBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
                    filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
                    filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
                    filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
                    });
                    <?php } ?>
                    //--></script>
                    ]]></add>
            </operation>
        </file>
        <file name="catalog/model/catalog/category.php">
            <operation>
                <search position="before"><![CDATA[
                  public function getCategory($category_id) {            ]]></search>
                <add><![CDATA[
    public function getShortDesc($category_id) {
            $query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "short_desc cd ON (c.category_id = cd.category_id) LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id) WHERE c.category_id = '" . (int)$category_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND c.status = '1'");
            if ($query->num_rows) {
                return array(
                    'short_desc'      => $query->row['short_desc']
                    );
            } else {
                return false;
            }
        }            ]]></add>
            </operation>
        </file>
        <file name="catalog/controller/product/category.php">
            <operation>
                <search position="after"><![CDATA[
                $this->data['heading_title'] = $category_info['name'];
                ]]></search>
                <add><![CDATA[
                $this->data['short_desc'] = $category_info['short_desc'];
                ]]></add>
            </operation>
        </file>
        <file name="catalog/controller/product/category.php">
            <operation>
                <search position="after"><![CDATA[
                $this->data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
                ]]></search>
                <add><![CDATA[
                $this->data['short_desc'] = html_entity_decode($category_info['short_desc'], ENT_QUOTES, 'UTF-8');
                ]]></add>
            </operation>
        </file>
        <!-- front -->
        <file name="catalog/controller/product/category.php">
            <operation>
                <search position="after"><![CDATA[
                $this->data['text_limit'] = $this->language->get('text_limit');
                ]]></search>
                <add><![CDATA[
                $this->data['text_short_desc'] = $this->language->get('text_short_desc');
                ]]></add>
            </operation>
        </file>
        <file name="catalog/language/english/product/category.php">
            <operation>
                <search position="after"><![CDATA[
                $_['text_error']        = 'Product not found!';
                ]]></search>
                <add><![CDATA[
                $_['text_short_desc']    = 'Additional description';
                ]]></add>
            </operation>
        </file>
        <file name="catalog/language/russian/product/category.php">
            <operation>
                <search position="after"><![CDATA[
                $_['text_error']        = 'Категория не найдена!';
                ]]></search>
                <add><![CDATA[
                $_['text_short_desc']    = 'Additional description';
                ]]></add>
            </operation>
        </file>
        
        <file name="catalog/view/theme/default/template/product/category.tpl">
            <operation>
                <search position="before"><![CDATA[
                <?php echo $content_bottom; ?>
                ]]></search>
                <add><![CDATA[
                <?php if ($short_desc) { ?>
                <span><?php echo $text_short_desc; ?></span> <?php echo $short_desc; ?></a><br />
                <?php } ?>
                ]]></add>
            </operation>
        </file>
    </modification>
     
  2. kastahhls

    kastahhls

    Регистрация:
    30 дек 2012
    Сообщения:
    114
    Симпатии:
    13
    неужели нет людей, которые могут помочь???
    Подскажите тогда как стандартное описание для категорий вывести в column_right
     
  3. nikfakel

    nikfakel

    Регистрация:
    24 июл 2013
    Сообщения:
    150
    Симпатии:
    33
    Править нужно category.tpl. После (или перед - смотря как вам нужно) <?php echo $column_right ?> ставим

    Код:
    <div class="category-info">
        <?php if ($thumb) { ?>
        <div class="image"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" /></div>
        <?php } ?>
        <?php if ($description) { ?>
        <?php echo $description; ?>
        <?php } ?>
      </div>
    
    Это код вывода описания категории, соответственно надо его убрать оттуда, где он был раньше. Ну и шаблон правим как нужно - по умолчанию column_right идет после $column_left, и только потом основной контент - то есть удобно будет код вывода категории и $column_right обернуть в общий див, чтобы сделать сайдбар.

    Напрямую вывести дескрипшн именно в колумн_райт простыми методами не получится.