JoelWebsites Posted June 27, 2014 Share Posted June 27, 2014 <?php if (!defined('_PS_VERSION_')) exit; class DisplayBill extends Module { public function __construct() { $this->name = 'displaybill'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'Joel Fernandes'; $this->need_instance = 0; $this->push_filename = _PS_CACHE_DIR_.'push/activity'; $this->allow_push = true; $this->push_time_limit = 180; parent::__construct(); $this->displayName = $this->l('Displaybill'); $this->description = $this->l('This Module will display data about the customer'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_NAME')) $this->warning = $this->l('No name provided'); } // this also works, and is more future-proof public function install() { if (!parent::install() || !$this->registerHook('dashboardZoneOne') || !$this->registerHook('dashboardData')) return false; return true; } public function uninstall() { if (!parent::uninstall()) Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'displaybill`'); parent::uninstall(); } public function hookDashboardZoneOne($params) { $links = $this->getLinks(); foreach($links as $link){ $this->_html .= '<p>'.$link['id_employee'].'<br />'.$link['name'].'<br /></p>' ; } $this->_html .='</fieldset>'; } public function _displayForm(){ } public function getLinks() { $result = array(); $sql = 'SELECT * FROM '._DB_PREFIX_.'employee'; $links = Db::getInstance()->execute($sql); $i=0; foreach ($links AS $link) { $result ['id_employee'] = $link['id_employee']; $result ['name'] = $link['name']; $i++ ; } return $result; } public function addLinks() { } public function updateLinks() { } public function deleteLinks() { } public function hookDisplayLeftColumn($params) { global $smarty; return $this->display(__FILE__,'mymodule.tpl'); } } ?> Link to comment Share on other sites More sharing options...
vekia Posted June 27, 2014 Share Posted June 27, 2014 your module isn;t attached to hookDisplayLeftColumn installation function doesnt contains registerhook for this hook. Link to comment Share on other sites More sharing options...
JoelWebsites Posted June 27, 2014 Author Share Posted June 27, 2014 Actually I cannot see any output on the page for hookDashboardZoneOne Link to comment Share on other sites More sharing options...
vekia Posted June 27, 2014 Share Posted June 27, 2014 in your hook function there is no 'return' value, and it's necessary. take a look how other modules uses this hook public function hookDashboardZoneOne($params) { $gapi_mode = 'configure'; if (!Module::isInstalled('gapi')) $gapi_mode = 'install'; elseif (($gapi = Module::getInstanceByName('gapi')) && Validate::isLoadedObject($gapi) && $gapi->isConfigured()) $gapi_mode = false; $this->context->smarty->assign($this->getConfigFieldsValues()); $this->context->smarty->assign( array( 'gapi_mode' => $gapi_mode, 'dashactivity_config_form' => $this->renderConfigForm(), 'date_subtitle' => $this->l('(from %s to %s)'), 'date_format' => $this->context->language->date_format_lite, 'link' => $this->context->link, ) ); return $this->display(__FILE__, 'dashboard_zone_one.tpl'); } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now