Fab*_*pet 2 php prestashop prestashop-1.5
我的Prestashop有问题,我想在不使用CMS的情况下在模块中创建网页.
但是,当我想使用此Url访问控制器时:http://example.com/comparateur/module/ProduitsMarchand/ProductList
我有这个消息,当我点击链接时,我有404错误
[Debug] This page has moved
Please use the following URL instead: http://example.com/comparateur/index.php?controller=ProductList&module=ProduitsMarchand
Run Code Online (Sandbox Code Playgroud)
我的控制器看起来像这样
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");
}
}
Run Code Online (Sandbox Code Playgroud)
首选项> SEO和URL
Page: produitsmarchands - productlist
URL: product-list
Run Code Online (Sandbox Code Playgroud)
你有一些基本的错误.
首先,你不应该使用FrontController而是使用ModuleFrontController.因为您正在扩展模块而不是完全独立的新控制器.
接下来是你的班级错了.它应该与此类似.
YourModuleNameYourControllerNameModuleFrontcontroller
YourModuleName =模块的名称
YourControllername =控制器的名称,应位于yourmodule/controllers/front中
最后但并非最不重要的是,这是完全错误的
$this->setTemplate(__FILE__.'/../../../views/templates/front/ProductList.tpl');
Run Code Online (Sandbox Code Playgroud)
你应该用它
$this->setTemplate('ProductList.tpl');
Run Code Online (Sandbox Code Playgroud)
这样,您的文件将位于yourmodule/views/templates/front中
如果您已遵循所有这些准则,您应该能够在首选项 - > SEO和URL中为您的moduelController设置友好的URL
BR的
| 归档时间: |
|
| 查看次数: |
5030 次 |
| 最近记录: |