doushou1298 2014-02-25 08:58
浏览 128
已采纳

模块控制器重定向到404 Prestashop

I have a problem with my Prestashop, i would like to create a webpage in a module without using the CMS.

But when I want to access the controller by using this Url : http://example.com/comparateur/module/ProduitsMarchand/ProductList

I have that message & when i click on the link, i have a 404 error

[Debug] This page has moved
Please use the following URL instead: http://example.com/comparateur/index.php?controller=ProductList&module=ProduitsMarchand

My controller looks like this

class ProduitsMarchandProductListModuleFrontController extends ModuleFrontController {

    public $php_self ="ProductList";
    /**
     *  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("ProductList.tpl");
    }
}

Preferences > SEO & URLs

Page: produitsmarchands - productlist
URL: product-list
  • 写回答

1条回答 默认 最新

  • dqo58772 2014-02-25 12:13
    关注

    You got a few fundamental mistakes.

    First of all you should'nt be using FrontController but rather ModuleFrontController. Since you are extending a module not a fully sepearate new controller.

    Next thing is that your class is wrong. It should be something similar to this.

    YourModuleNameYourControllerNameModuleFrontcontroller

    YourModuleName = name of your module

    YourControllername = name of your controller and should be located in yourmodule/controllers/front

    And last but not least this is completely wrong

    $this->setTemplate(__FILE__.'/../../../views/templates/front/ProductList.tpl');
    

    You should use this

    $this->setTemplate('ProductList.tpl');
    

    That way your file will be located in yourmodule/views/templates/front

    And if you have followed all of those guidelines you should be able to set a friendly url for your moduelController in Preferences -> SEO & URL

    BR's

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料