Jump to content

Creation of module unregistered by Prestashop


Recommended Posts

Hi,

 

I've this error message :

 

Parse error: syntax error, unexpected '?' in /home/amscaaf/translate/classes/Module.php(587) : eval()'d code on line 1.

 

 

followed by :

 

 

The following module(s) couldn't be loaded:

  • blockpaymentinfo (parse error in /modules/blockpaymentinfo/blockpaymentinfo.php)
  • blockpaymentinfo (class missing in /modules/blockpaymentinfo/blockpaymentinfo.php)

 

THIS IS MY SOURCE CODE :

 

<?php

if (!defined('_PS_VERSION_'))

exit;

 

class BlockPaymentInfo extends Module

{

 

function __construct()

{

$this->name = 'blockpaymentinfo';

$this->tab = 'test';

$this->version = 1.0;

$this->author = 'Gilbert Franz';

$this->need_instance = 0;

 

parent::__construct();

 

$this->displayName = $this->l( 'Block Payment Info' );

$this->description = $this->l( 'Few words about how to paye products.' );

 

$this->text = 'test du jour';

$this->titre = 'le titre du test';

 

}

 

public function install()

{

if (parent::install() == false OR !$this->registerHook('leftColumn')OR !$this->registerHook('home'))

return false;

return true;

}

 

public function uninstall()

{

if (!parent::uninstall())

Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'blockpaymentinfo`');

parent::uninstall();

}

 

 

public function hookLeftColumn($params)

{

global $smarty;

 

$smarty->assign(array(

'text' => $this->text,

'titre' => $this->titre;

));

 

return $this->display(__FILE__, $this->name.'.tpl');

}

 

public function hookHome($params)

{

global $smarty;

 

$smarty->assign(array(

'text' => $this->text,

'titre' => $this->titre;));

 

return $this->display(__FILE__, $this->name.'.tpl');

}

 

public function hookRightColumn($params)

{

return $this->hookLeftColumn($params);

}

 

public function hookleftColumn($params)

{

return $this->hookHome($params);

}

}

?>

  • Like 1
Link to comment
Share on other sites

Hello razaro,

 

I just can't understand, I've changed my source code thought :

 

<?php

if (!defined('_PS_VERSION_'))

exit;

 

class BlockPaymentInfo extends Module

{

function __construct()

{

$this->name = 'blockpaymentinfo';

$this->tab = 'front_office_features';

$this->version = 1.0;

$this->author = 'Gilbert franz';

$this->need_instance = 0;

 

parent::__construct();

 

$this->displayName = $this->l('Block Payment Info');

$this->description = $this->l('Few words about how to paye products.');

}

 

public function install()

{

return (parent::install() AND $this->registerHook('footer'));

}

 

public function hookFooter($params)

{

global $smarty;

 

$smarty->assign(array(

'text'=> 'TEXT',

'titre'=> 'TITRE'));

 

return $this->display(__FILE__, 'blockpaymentinfo.tpl');

}

 

public function hookFooter($params)

{

return $this->hookleftColumn($params);

}

}

?>

 

:mellow:

Link to comment
Share on other sites

Didn't saw this before but you declared hookFooter function twice.

Here is code that works.

<?php
if (!defined('_PS_VERSION_'))
exit;
class BlockPaymentInfo extends Module
{
function __construct()
{
 $this->name = 'blockpaymentinfo';
 $this->tab = 'front_office_features';
 $this->version = 1.0;
 $this->author = 'Gilbert franz';
 $this->need_instance = 0;
 parent::__construct();
 $this->displayName = $this->l('Block Payment Info');
 $this->description = $this->l('Few words about how to paye products.');
}
public function install()
{
 return (parent::install() AND $this->registerHook('footer'));
}
public function hookFooter($params)
{
 global $smarty;
 $smarty->assign(array(
  'text'=> 'TEXT',
  'titre'=> 'TITRE')
 );
 return $this->display(__FILE__, 'blockpaymentinfo.tpl');
}
public function hookLeftColumn($params)
{
 return $this->hookFooter($params);
}
}
?>

Link to comment
Share on other sites

×
×
  • Create New...