1
我正在開發一個帶有控制器的模塊,該模塊用於讀取id_cart並執行一些操作。但我無法調用Controller,它總是返回404錯誤。帶控制器的Prestashop模塊拋出404
模塊:
<?php
if (!defined('_PS_VERSION_'))
exit;
class CartPortkey extends Module
{
public function __construct()
{
$this->name = 'cartportkey';
$this->tab = 'checkout';
$this->version = '1.0.0';
$this->author = 'Me and nobody else';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('My Module Name');
$this->description = $this->l('My Module Description.');
$this->confirmUninstall = $this->l('Estás seguro de desinstalar?');
}
}
控制器
<?php
if (!defined('_PS_VERSION_'))
exit;
class CartPortkeyFrontController extends ModuleFrontController {
public function init(){
parent::init();
$id_cart = (int)Tools::getValue('id_cart');
$this->context->cookie->id_cart = $id_cart;
$link_order = $this->context->link->getPageLink('order');
Tools::redirect($link_order);
}
public function initContent() {
parent::initContent();
}
}
?>
我想這個網址: http://localhost/shop/myshop1/index.php?fc=module&module=cartportkey&controller=cartportkeyfrontcontroller&id_cart=2
我指定我已經啓用了MultiStore其中shop
是主要的和myshop1
是三家商店之一。
文件夾結構:
+ cartportkey
-- +controllers
-- -- +front
-- -- -- CartPortKeyController.php
-- cartportkey.php
我已經確保將模塊安裝和活躍在所有的商店。
安永加載控制器!非常感謝你,讓我朝着正確的方向努力! –