Jump to content

[solved] Creating module for Prestashop


Recommended Posts

My .php file look's like this, i just copy/paste from this tutorial , just want to see how it work's.

 

mojmodul.php

 

<?php

if (!defined('_PS_VERSION_'))

exit;

 

class MojModul extends Module

{

public function __construct()

{

$this->name = 'mojmodul';

$this->tab = 'front_office_features';

$this->version = '1.0';

$this->author = 'Neme name';

$this->need_instance = 0;

$this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.5');

// $this->dependencies = array('blockcart');

 

parent::__construct();

 

$this->displayName = $this->l('Moj Modul');

$this->description = $this->l('News če bo le šlo.');

 

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

 

if (!Configuration::get('mojmodul'))

$this->warning = $this->l('No name provided');

}

}

 

 

public function install()

{

if (Shop::isFeatureActive())

Shop::setContext(Shop::CONTEXT_ALL);

 

return parent::install() &&

$this->registerHook('leftColumn') &&

$this->registerHook('header') &&

Configuration::updateValue('mojmodul', 'my friend');

}

}

 

public function uninstall()

{

if (!parent::uninstall() ||

!Configuration::deleteByName('mojmodul'))

return false;

return true;

}

 

 

public function hookDisplayLeftColumn($params)

{

$this->context->smarty->assign(

array(

'my_module_name' => Configuration::get('MYMODULE_NAME'),

'my_module_link' => $this->context->link->getModuleLink('mojmodul', 'display')

)

);

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

}

 

public function hookDisplayRightColumn($params)

{

return $this->hookDisplayLeftColumn($params);

}

 

public function hookDisplayHeader()

{

$this->context->controller->addCSS($this->_path.'css/mojmodul.css', 'all');

}

 

 

 

?>

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

×
×
  • Create New...