Jump to content

Simple module doesnt work


Recommended Posts

I created simple module following instructions in this documentation chapter:

http://doc.prestashop.com/display/PS17/Creating+a+first+module

 

This is my file /modules/steel/steel.php:

 

<?php

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

class Steel extends Module
{

public function __construct()
{
    $this->name = 'steel';
    $this->tab = 'front_office_features';
    $this->version = '1.0.0';
    $this->author = 'Firstname Lastname';
    $this->need_instance = 0;
    $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);

parent::__construct();

$this->displayName = 'xxx';
$this->description = 'desc';
$this->confirmUninstall = 'deinstall?';
}

public function install()
{
    return false;
  return true;
}

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

 

For some reason it doesnt show up in modules list so i can install it. WHen i make it into zip file and try to install it using "upload modile" function, it shows "Installation of module steel failed. The module is invalid and cannot be loaded.".

Link to comment
Share on other sites

Hello,

If you turn on the debug mode, you will see that you have some php errors, this code should works...

<?php

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

class Steel extends Module
{
    public function __construct()
    {
        $this->name = 'steel';
        $this->tab = 'front_office_features';
        $this->version = '1.0.0';
        $this->author = 'Firstname Lastname';
        $this->need_instance = 0;
        $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);

        parent::__construct();

        $this->displayName = 'xxx';
        $this->description = 'desc';
        $this->confirmUninstall = 'deinstall?';
    }

    public function install()
    {
        return parent::install();
    }

    public function uninstall()
    {
        return parent::uninstall();
    }
}

 

Regards!

Link to comment
Share on other sites

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...