Prestashop 1.7模块前置控制器404
Prestashop 1.7 module front controller 404
我正在开发 Prestashop 1.7 模块,但前端控制器模块有问题。当我尝试访问该页面时出现 404 错误。
文件如下:
modules/cbd_calculator/cbd_calculator.php
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class Cbd_Calculator extends Module
{
public function __construct()
{
$this->name = 'cbd_calculator';
$this->tab = 'front_office_features';
$this->version = '1.0.0';
$this->author = 'jojo';
$this->need_instance = 0;
$this->controllers = ['display'];
$this->ps_versions_compliancy = [
'min' => '1.6',
'max' => '1.7.99',
];
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('title module');
$this->description = $this->l('description module');
$this->confirmUninstall = $this->l('Êtes-vous sûr de vouloir désinstaller ?');
}
public function install()
{
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
Logger::addLog($this->context->link->getModuleLink('cbd_calculator', 'display'));
return parent::install() && $this->registerHook('displayHome') &&
$this->registerHook('actionFrontControllerSetMedia');
}
}
modules/cbd_calculator/controller/front/display.php :
<?php
class Cbd_CalculatorDisplayModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$this->context->smarty->assign([
'title' => 'kappa',
'text' => 'test kappa'
]);
$this->setTemplate('module:cbd_calculator/views/templates/front/display.tpl');
}
}
modules/cbd_calculator/views/templates/front/display.tpl :
<div>
Kappa
</div>
我调用uri:
http:///localhost/modules/cbd_calculator/display 或 http:///localhost/index.php?fc=module&module=cbd_calculator&controller=display
他们给我一个 404 错误...
我遇到了这个问题,我该如何解决
谢谢大家
路径好像不对:
modules/cbd_calculator/controller/front/display.php
您必须添加 [s] 个字符:modules/cbd_calculator/controllers/front/display.php
我正在开发 Prestashop 1.7 模块,但前端控制器模块有问题。当我尝试访问该页面时出现 404 错误。
文件如下: modules/cbd_calculator/cbd_calculator.php
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class Cbd_Calculator extends Module
{
public function __construct()
{
$this->name = 'cbd_calculator';
$this->tab = 'front_office_features';
$this->version = '1.0.0';
$this->author = 'jojo';
$this->need_instance = 0;
$this->controllers = ['display'];
$this->ps_versions_compliancy = [
'min' => '1.6',
'max' => '1.7.99',
];
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('title module');
$this->description = $this->l('description module');
$this->confirmUninstall = $this->l('Êtes-vous sûr de vouloir désinstaller ?');
}
public function install()
{
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
Logger::addLog($this->context->link->getModuleLink('cbd_calculator', 'display'));
return parent::install() && $this->registerHook('displayHome') &&
$this->registerHook('actionFrontControllerSetMedia');
}
}
modules/cbd_calculator/controller/front/display.php :
<?php
class Cbd_CalculatorDisplayModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$this->context->smarty->assign([
'title' => 'kappa',
'text' => 'test kappa'
]);
$this->setTemplate('module:cbd_calculator/views/templates/front/display.tpl');
}
}
modules/cbd_calculator/views/templates/front/display.tpl :
<div>
Kappa
</div>
我调用uri: http:///localhost/modules/cbd_calculator/display 或 http:///localhost/index.php?fc=module&module=cbd_calculator&controller=display
他们给我一个 404 错误...
我遇到了这个问题,我该如何解决
谢谢大家
路径好像不对:
modules/cbd_calculator/controller/front/display.php
您必须添加 [s] 个字符:modules/cbd_calculator/controllers/front/display.php