WP-prog

Как добавить новую страницу в PrestaShop

Добавить новую страницу в PrestaShop сложнее, чем в WordPress. К сожалению, информации по данной CMS достаточно немного.

Данный способ был проверен мной на PrestaShop 1.7.7.0 на сайте https://top1autovaruosad.ee

Создаем 2 файла:
1) /override/controllers/front/VinPageController.php

				
					<?php

class VinPageController extends FrontController
{

    /**
     * Initialize controller
     * @see FrontController::init()
     */
    public function init()
    {
        parent::init();
    }

    /**
     * Assign template vars related to page content
     * @see FrontController::initContent()
     */
    public function initContent()
    {
        parent::initContent();

        $this->setTemplate('vinpage.tpl');
    }
}

				
			

2) /themes/ваша_тема/templates/vinpage.tpl

				
					{**
 * 2007-2018 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2018 PrestaShop SA
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *}
{extends file='page.tpl'}

{block name='page_header_container'}{/block}

{block name='left_column'}
  <div id="left-column" class="col-xs-12 col-sm-4 col-md-3">
    {* {widget name="ps_contactinfo" hook='displayLeftColumn'} *}
    {hook h="displayContactForm7" id="2"}
  </div>
{/block}

{block name='page_content'}

  <h1>{l s='Поиск по VIN'}</h1>
  {* {widget name="contactform"} *}
  {* {hook h="displayContactForm7" id="2"} *}
{/block}
				
			

После всех манипуляций нужно удалить файл /var/cache/prod/class_index.php.

ВНИМАНИЕ! ОБЯЗАТЕЛЬНО создайте резервную копию!

Затем настраиваем страницу в админке таким образом:

Как добавить новую страницу в PrestaShop
Как добавить новую страницу в PrestaShop

Другие материалы по PrestaShop можно найти здесь.

Если у Вас есть какие-либо вопросы, оставьте свой комментарий:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *