не видит страницы

Автор yintar, 22 марта 2015, 18:43:59

« назад - далее »

yintar

Всем привет. Я новичок в престе,только начал изучать.
Создал простой модуль кот выбирает товары со сниженной ценой

файл  blocktovarsaction.php в папке modules
<?php

class BlockTovarsAction extends Module {

   public function
__construct() {
       
$this->name = 'blockTovarsAction';
       
$this->tab = 'other';
       
$this->version = 1.0;
       
$this->author = 'AndreyMalovik';
       
parent::__construct();
       
$this->displayName = $this->l('Block select tovars to actions');
       
$this->description = $this->l('selects the products which are promotions and discounts');
   }

   public function
install() {
       if (!
parent::install() OR !$this->registerHook('leftColumn'))
           return
false;
       return
true;
   }

   public function
hookLeftColumn($params) {
       global
$smarty;
       return
$this->display(__FILE__, 'blockTovarsAction.tpl');
   }

}



файл  blocktovarsaction.tpl в папке modules

<style type="text/css">
a { outline:none; }
.linkText{
  font-family: Arial, Helvetica, Sans-Serif;
font-weight: bold;
font-size: 21px;
        color:#0000CC;
}
#information {
  overflow:auto;
  width:500px; height:100px;
}
#outer {
  display:none;
}
</style>
<div id="action_block_left" class="block" title="action">
    <a id="actionLinks"  href="#links"> <h4>Акционные товары на которые снижена цена</h4> </a>
</div>
<div id="outer">
<div id="links">
    <a href="{$link->getPageLink('tovarsaction.php')}" title="{l s='Tovarsaction' mod='blockTovarsAction'}"><span class="linkText">Товары на которые снижена цена</span></a><br>//это страница с товарами для одной акции
    <a href="{$link->getPageLink('tovarsactionsuper.php')}" title="{l s='Tovarsactionsuper' mod='blockTovarsAction'}"><span class="linkText">Товары по супер цене</span></a>//это страница с товарами для другой акции
</div>
</div>
<script type="text/javascript">
    $('#actionLinks').fancybox({
    "titlePosition": "inside",
    "transitionIn": "none",
    "transitionOut": "none"
  });
</script>

файл tovarsaction.php в основном каталоге

require(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('TovarsActionController')->run();

файл контроллера  TovarsActionController.php в папке controllers

class TovarsActionControllerCore extends FrontController {

    public $php_self = 'TovarsAction.php';
   
         protected $tovarsAction;
         protected $tovarsActionSuper;
       
        public function setMedia()
{
parent::setMedia();
Tools::addCSS(array(
_PS_CSS_DIR_.'jquery.cluetip.css' => 'all',
_THEME_CSS_DIR_.'scenes.css' => 'all',
_THEME_CSS_DIR_.'category.css' => 'all',
_THEME_CSS_DIR_.'product_list.css' => 'all'));

if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0)
Tools::addJS(_THEME_JS_DIR_.'products-comparison.js');
}

public function preProcess()
{
$this->tovarsAction = new Category($id_category, self::$cookie->id_lang);
}

public function process()
{
         $this->nbProducts = $this->tovarsAction->getAvtomatSkidkaProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
$this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
$products = $this->tovarsAction->getAvtomatSkidkaProducts((int)(self::$cookie->id_lang), (int)($this->p), (int)($this->n), $this- >orderBy,$this->orderWay);
                         self::$smarty->assign('products', $products);
}
     
       public function displayHeader()
{
parent::displayHeader();
$this->productSort();
}

public function displayContent()
{
parent::displayContent();
                self::$smarty->display(_PS_THEME_DIR_.'tovaraction-list.tpl');//страница с товарами для одной акции
                self::$smarty->display(_PS_THEME_DIR_.'tovarsactionsuper-list.tpl');//страница с товарами для другой акции
         }

}

Еще естественно есть функция getAvtomatSkidkaProducts в модели Category которая выбирает нужные товары из БД
Теперь вопрос:
при переходе на страницу tovarsaction-list.tpl по ссылке:

  <a href="{$link->getPageLink('tovarsaction.php')}" title="{l s='Tovarsaction' mod='blockTovarsAction'}"><span class="linkText">Товары на которые снижена цена</span></a><br>

все работает появляется страница с товарами(даже если закоментить ее в файле).
но при клике по ссылке на страницу tovarsactionsuper-list.tpl по ссылке:

<a href="{$link->getPageLink('tovarsactionsuper.php')}" title="{l s='Tovarsactionsuper' mod='blockTovarsAction'}"><span class="linkText">Товары по супер цене</span></a>

выдается (как я понял в престе это стандартная страница) страница с ошибкой
"СТРАНИЦА НЕДОСТУПНА"
"Извините, запрошеной Вами страницы не существует".
Знатоков Престы прошу помочь.Объясните, пожалуйста ,как вообще в престе происходит переход на страницу(маршрутизация).и конкретно в моем случае почему видит одну страницу но не видит другую.

PrestaMan

1. blocktovarsaction.php в папке /modules/blocktovarsaction/...
и все остальные файлы модуля тоже в этой папке.

2. blocktovarsaction.tpl в папке /modules/blocktovarsaction/...
без стилей и js. Css и javascript в отдельные файлы. Если js в шаблоне tpl, то в тегах literal.

3. Контроллер в папке модуля, не нужно в корне создавать файл
require('../../config/config.inc.php');
$controller = new FrontController();
$controller->init();
//....


4. В шаблоне ссылка на страницу
<a href="{$link->getModuleLink('blocktovarsaction', 'название контроллера')|escape:'html'}"...


http://doc.prestashop.com/display/PS16/Developer+Guide
Эксперт Prestashop - решения всех проблем, написание модулей, создание тем для интернет-магазинов под Prestashop.
Эксперт Magento - создам сайт на Magento, программирование кастомных модулей для Magento, кастомизация тем Magento.
Лучшие цены!!!