Jump to content

Create module 1.7


Stolle95

Recommended Posts

Hello,

I'm new to Prestashop and have been testing creating my own module.

 

I have only found guides in 1.6 and starting to think that something is missing. My module won't get loaded automatically. Do I have to do anything more in 1.7?

 

My code:

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

class TestModule extends Module 
{
	public function __construct() 
	{
		$this->name = 'testmodule';
		$this->tab = 'front_office_features';
		$this->version = '1.0';
		$this->author = 'John Doe';
		$this->ps_versions_comliancy = array('min' => '1.5', 'max' => _PS_VERSION_);

		$this->need_instance = 0;
		$this->bootstrap = true;
		$this->displayName = $this->l('Test Module');
		$this->desctiption = $this->l('A module test');
	}
	public funtion install() 
	{
		if (!parent::install() OR $this->registerHook('displayLeftColumn'))
			return false;
		return true;
	}
	public function hookDisplayLeftColumn($params)
	{
		return 'Hello world';
	}
}

Cheers,

Stolle

Link to comment
Share on other sites

Hi Stolle95,

 

(Official) PrestaShopModule Developer Guide -> Prestashop 1.7: http://developers.prestashop.com/module/index.html

 

Sorry for my English,

Hello!

I've been following the guide and nothing happens, and I've also spotted "Here are the possible files and folders for a PrestaShop 1.6 module:" and not 1.7 in the guide, that might just be a miss in the text?

 

It's strange because the module is not being loaded. Can anyone spot something that shouldn't be there.

 

cheers,

S

 

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

  • 2 years later...
On 4/3/2017 at 11:30 PM, Stolle95 said:

Hello,

I'm new to Prestashop and have been testing creating my own module.

 

I have only found guides in 1.6 and starting to think that something is missing. My module won't get loaded automatically. Do I have to do anything more in 1.7?

 

My code:


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

class TestModule extends Module 
{
	public function __construct() 
	{
		$this->name = 'testmodule';
		$this->tab = 'front_office_features';
		$this->version = '1.0';
		$this->author = 'John Doe';
		$this->ps_versions_comliancy = array('min' => '1.5', 'max' => _PS_VERSION_);

		$this->need_instance = 0;
		$this->bootstrap = true;
		$this->displayName = $this->l('Test Module');
		$this->desctiption = $this->l('A module test');
	}
	public funtion install() 
	{
		if (!parent::install() OR $this->registerHook('displayLeftColumn'))
			return false;
		return true;
	}
	public function hookDisplayLeftColumn($params)
	{
		return 'Hello world';
	}
}

Cheers,

Stolle

Okay i am years late here but i think the error might lie with the structuring of the if condition u could try structuring it like 

if(parent::install() && $this->registerHook('displayLeftColumn'))

{

return true;

}

else

{

return false;

}

 

 

i think its a long shot it will help you now but just in case someone else like me happens across this : - D cheers!

Link to comment
Share on other sites

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