Jump to content

Module Front Controller


BBR

Recommended Posts

Hi everyone,

Im trying to do a module front controller to display some content in a page on prestashop 1.7;

I've follow many methods but all i have is a 404 error when im trying to display the page  "http://localhost:8090/prestashop/module/monmodule/controller".

I've disabled the cache on my prestashop.

 

This is my module code:

<?php
if (!defined('_PS_VERSION_'))
{
  exit;
}


class monmodule extends Module
{
  public function __construct()
  {
    $this->name = 'monmodule';
    $this->tab = 'front_office_features';
    $this->version = '1.0.0';
    $this->author = 'BBR';
    $this->need_instance = 0;
    $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
    $this->bootstrap = true;


    parent::__construct();


    $this->displayName = $this->l('Mon module');
    $this->description = $this->l('Description of my module.');


    $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');


    if (!Configuration::get('MONMODULE'))
      $this->warning = $this->l('No name provided');
  }


  public function install()
  {
    if (!parent::install())
      return false;
    return true;
  }


  public function uninstall()
  {
    if (!parent::uninstall())
      return false;
    return true;
  }

}

 

This is my controller.php

<?php
class monmoduleControllerModuleFrontController extends ModuleFrontController
{
	public function __construct();
	$this->context = Context::getContext();
}
	public function initContent()
	{
		parent::initContent();
		$this->context->smarty->assign(arrray());
		$this->setTemplate('Controller.tpl');
		
	}
}

?>

and my controller.tpl

{extends file='controller.tpl'} 

{block name='content'}
test
{/block}

 

I would like to know where are my mistakes here, thank you guys

5bb793863dd27_Sansnom-1.thumb.png.5a9733acb134487cfa070fbc475e1760.png

Edited by BBR (see edit history)
Link to comment
Share on other sites

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...