[Помогите] создание страниц в ocStore

Тема в разделе "OpenCart", создана пользователем Lundin, 22 окт 2015.

  1. Lundin

    Lundin

    Регистрация:
    19 сен 2015
    Сообщения:
    1
    Симпатии:
    0
    Здравствуйте, нужно создать страницу отдельную по примеру вот этой http://superpotolok.by/tseny.html пробовал создать дополнительный файл в шаблоне и через модуль "Персонализованные шаблоны" но после создания страницы в модуле при переходе по ссылке страницы которую создал появляется ошибка: Notice: Error: Could not load template /home/aminasve/public_html/catalog/view/theme//home/aminasve/public_html/catalog/view/theme/default/product/natyazhnye-potolki.tpl! in/home/aminasve/public_html/vqmod/vqcache/vq2-system_engine_controller.php on line 70 ,объясните как можно от нее избавиться и заодно как лучше создать эту страницу,зараннее спасибо
     
    Последнее редактирование: 22 окт 2015
  2. alex_storm

    alex_storm webdev

    Регистрация:
    11 дек 2012
    Сообщения:
    1.151
    Симпатии:
    667
    Для создания уникальной страницы нужно:
    1. Контроллер
    2. Темплейт
    3. Язык (по желанию)

    В папке catalog/controller/information, создаем контроллер типа mypage.php

    В открываем его и пишем:
    Код:
    <?php
    class ControllerInformationMypage extends Controller {
        private $error = array();
          
          public function index() {
            $this->language->load('information/contact');
    
            $this->document->setTitle($this->language->get('heading_title'));
       
              $this->data['breadcrumbs'] = array();
    
              $this->data['breadcrumbs'][] = array(
                'text'      => $this->language->get('text_home'),
                'href'      => $this->url->link('common/home'),          
                'separator' => false
              );
    
              $this->data['breadcrumbs'][] = array(
                'text'      => $this->language->get('heading_title'),
                'href'      => $this->url->link('information/contact'),
                'separator' => $this->language->get('text_separator')
              );  
              
            $this->data['heading_title'] = $this->language->get('heading_title');
    
      
            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/mypage.tpl')) {
                $this->template = $this->config->get('config_template') . '/template/information/mypage.tpl';
            } else {
                $this->template = 'default/template/information/mypage.tpl';
            }
          
            $this->children = array(
                'common/column_left',
                'common/column_right',
                'common/content_top',
                'common/content_bottom',
                'common/footer',
                'common/header'
            );
                  
             $this->response->setOutput($this->render());      
          }
    }
    Далее идем создаем языковой файл по пути:
    catalog/language/russian/information/mypage.php

    В нем укажем одну переменную типа:
    // Heading
    $_['heading_title'] = 'Моя страница';

    Далее идем в теплейт по пути:
    catalog/view/theme/_Ваша тема_/template/information/mypage.tpl

    И там делаем следующий код:
    Код:
    <?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
    <div id="content"><?php echo $content_top; ?>
      <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
      </div>
      <h1><?php echo $heading_title; ?></h1>
    <!--Здесь пишем все, что нужно на странице -->
      <?php echo $content_bottom; ?></div>
    <?php echo $footer; ?>

    Страница будет доступа по адресу /index.php?route=information/mypage
    Чтобы ее превратить в норм страницу, если есть seo manager, то просто добавить там запись information/mypage
    Если нет, то в БД сделать запись:
    INSERT INTO `url_alias`(`url_alias_id`,`query`,`keyword`) VALUES (NULL,information/mypage','mypage');

    Вроде все.