Jump to content

My first module in PS 1.7 fails to install


Recommended Posts

Hi,

I try to install a module written for PS 1.6 after modifications but the installation fails without any errors displayed.

I just add the minimum required for the installation :

notices
... folder :  install (with the sql syntax to create one table)

logo.png
notices.php with the code :

class Notices extends Module
{
  public function __construct()
  { 
 $this->name = 'notices';
    $this->tab = 'administration';
    $this->version = '1.0.0';
    $this->author = 'Jean-Marie Polain';
    $this->need_instance = 0;
    $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
    $this->bootstrap = true;

    parent::__construct();

    $this->displayName = $this->l('Notices');
    $this->description = $this->l('Création tabulation dans produits avec notice du médicament.');

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

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

  public function install()
  { 
 if (!parent::install())
      return false;
     
 if (Shop::isFeatureActive())
  Shop::setContext(Shop::CONTEXT_ALL);
 if (!parent::install() ||
  !$this->registerHook('leftColumn') ||
  !$this->registerHook('header') ||
  !Configuration::updateValue('NOTICES_NAME', 'Module Notices')
 )
  return false;
  $this->registerHook('displayProductTabContent');
  $this->registerHook('displayProductTab');   
  $sql_file=dirname(__FILE__).'/install/install.sql';
  
  if (!$this->LoadSQLFile($sql_file))
   return false;
  
  // Preset configuration values
  Configuration::updateValue('AVERTISSEMENTFR', 'Attention ...');
  Configuration::updateValue('AVERTISSEMENTNL', 'Pas op ...');
  Configuration::updateValue('TEXTEFR', 'Cliquer sur ...');
  Configuration::updateValue('TEXTENL', 'Clic on ...');
  return true;
 
 
  }

  public function uninstall()
  {
    if (!parent::uninstall())
      return false;
    return true;
  }
}
 
I do not create any config.xml like it is discribed in the doc.
 
What is wrong or missing ?
 
Jean
Link to comment
Share on other sites

  • 2 weeks later...
  • 6 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...