Jump to content

Module installation problem


Recommended Posts

Hi guys, this is the code of my module:

<?php

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

class Skema extends Module{

	public function __construct(){
		$this->name = 'skema';
		$this->tab = 'front_office_features';
		$this->version = '1.0';
		$this->author = 'Ivano Mercuri';
		$this->need_instance = 0;
		$this->ps_versions_compliancy = array( 'min' => '1.5.4.1' , 'max' => '1.6');
	 
		parent::__construct();
	 
		$this->displayName = $this->l('Modulo: Skema');
		$this->description = $this->l('Apporta modifiche al Front End');
	 
		$this->confirmUninstall = $this->l('Lo vuoi disinstallare?');
	}
	
	public function install(){
		if( Shop::isFeatureActive() ){
			Shop::setContext( Shop::CONTEXT_ALL );
		}
		return parent::install() &&
                $this->registerHook( 'displayFooter' ) &&
                $this->registerHook( 'top' );
	}
	
	public function uninstall(){
		return parent::uninstall();
	}
	
	public function hookDisplayFooter( $params ){
		if( $_COOKIE['popup_isw'] != 'yes' ){
			return $this->display( __FILE__ , 'skema.tpl' );
		}
	}
	
	public function hookTop( $params ){
		$this->context->controller->addCSS( $this->_path . 'css/skema.css' , 'all' );
		$this->context->controller->addJS( $this->_path . 'js/skema.js' , 'all' );
	}
}

It's a poorly code i edited from the documentation about the development of a module.

 

If I install the module by clicking install, the BO shows me the successful installation of the module, without any errors... But the module itself is still uninstalled.

 

These are two screenshots about this problem:

 

1) At the module line, it is installed, but the label next to the module title says it is not

modulo-installato.png

 

2) At the top of Admin it says the module has been installed with no other warnings

modulo-installato-2.png

 

There are no php errors or other errors for PS.

 

Any help to resolve this problem?

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

can you try to return true in install function() ?

 

Are you suggesting me to implement this way to see what will happen?

public function install(){
        /*
	if( Shop::isFeatureActive() ){
		Shop::setContext( Shop::CONTEXT_ALL );
	}
	return parent::install() &&
        $this->registerHook( 'displayFooter' ) &&
        $this->registerHook( 'top' );
        */
        return true;
}
Link to comment
Share on other sites

 

soemthing like:

if (parent::install() &&
$this->registerHook( 'displayFooter' ) &&
$this->registerHook( 'top' )){
return true;
} else{
return false;
}

 

Actually, it worked... but it is the same algorithm, is it?

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