create custom page prestashop 1.7

970 Views Asked by At

I have been trying for 2 days to create a custom page, but I have not been able to. What I have done is create a folder with the name of the module in the root folder (/ var / www / html / myproject / module / xav) there create the file xav.php

<?php

if (!defined('_PS_VERSION_'))
exit;

class xav extends Module
{
/* @var boolean error */
protected $_errors = false;

public function __construct()
{
$this->name = 'xav';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Xav13';
$this->need_instance = 0;

parent::__construct();

$this->displayName = $this->l('xav');
$this->description = $this->l('Custom page Xav');
$this->confirmUninstall = $this->l('Are you sure you want to delete 
this module?');
}

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

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

Also create controller / front / about.php width

<?php
class XavAboutModuleFrontController extends ModuleFrontController
{

/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
    parent::initContent();

    $this->setTemplate('module:xav/views/templates/front/about.tpl');
}
}

and views / templates / front / about.tpl width

test

Then install the module, and accessed the path http://localhost/myproject/module/xav/about, but it did not work.

0

There are 0 best solutions below