簡體   English   中英

我在 Prestashop 中看不到我的測試模塊的頁面

[英]I can't see the page of my Test Module in Prestashop

我正在按照手冊了解誰可以為 Prestashop 創建模塊(這是鏈接prestashop 開發人員)。 一切正常(我可以配置我的模塊並移動到左列)但是當我單擊我的 href 時遇到問題,總是看到“錯誤 404:頁面不存在”。

我閱讀了文檔,並沒有在我的代碼中發現一些錯誤:我將文件 display.php 和 display.tpl 放在模塊根文件夾中。

我的 display.php 代碼是:

class mymoduledisplayModuleFrontController extends ModuleFrontController{
  public function initContent(){
    parent::initContent();
    $this->setTemplate('display.tpl');
  }
}

display.tpl 的代碼是:

<h4>Hi!!!!!</h4>

我的錯誤是什么? 我沒發現!

非常感謝你的幫忙

據我所知display.php應該在模塊主文件夾的/controllers/front文件夾中。 所以你應該有 2 個display.php文件:

  1. 在具有模塊配置和鈎子的根文件夾中顯示如下內容:
public function hookDisplayLeftColumn($params)
{
  $this->context->smarty->assign(
      array(
          'my_module_name' => Configuration::get('MYMODULE_NAME'),
          'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display')
      )
  );
  return $this->display(__FILE__, 'mymodule.tpl');
}
  1. 在控制器/模塊主文件夾的前面,用於顯示在主要內容中。
class mymoduledisplayModuleFrontController extends ModuleFrontController
{
  public function initContent()
  {
    parent::initContent();
    $this->setTemplate('display.tpl');
  }
}

更仔細地閱讀文檔。 都在這里!

我認為您需要在控制器(controllers/front/display.php)中創建顯示文件,文件的內容應該類似於

class MyModuleDisplayModuleFrontController extends ModuleFrontController
{
    public function initContent()
    {
        parent::initContent();
        //do some stuff
   }   
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM