I am developing a module with a controller which is intended to read id_cart and do some actions. But I cannot invoke Controller, it always returns 404 error.
Module:
<?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?');
}
}
Controller
<?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();
}
}
?>
I am trying this url:
http://localhost/shop/myshop1/index.php?fc=module&module=cartportkey&controller=cartportkeyfrontcontroller&id_cart=2
I have to specify that I have enabled multistore where shop
is the main and myshop1
is one of the 3 shops.
Folder Structure:
+ cartportkey
-- +controllers
-- -- +front
-- -- -- CartPortKeyController.php
-- cartportkey.php
I have ensured that the module is installed and active in all the stores.