spc Posted January 12, 2013 Share Posted January 12, 2013 (edited) Hej Ändrat lite i koden: nu får jag ett fel: Fatal error: Cannot make static method ModuleCore::display() non static in class searchbyvehicle in \modules\searchbyvehicle\searchbyvehicle.php on line 13 Nu får jag mera fel: Table 'presta.ps_searchbyvehicle' doesn't exist SELECT * FROM `ps_searchbyvehicle Och den instaleras inte... Och jag får den inte att listas ut, e det något jag glömt eller ?? Hoppas någon kan hjälpa mig.. Nya koden som den ser ut nu och funkar. <?php class searchbyvehicle extends Module { private $_html = ''; private $_postErrors = array(); public $path; private $_pagination = array(20,50,100,300); function __construct() { $this->name = 'searchbyvehicle'; $this->tab = 'front_office_features'; $this->version = 0.1; $this->author = 'Niklas'; $this->table = 'searchbyvehicle'; $this->className = 'Searchbyvehicle'; $this->lang = false; $this->edit = true; $this->view = true; $this->delete = true; $this->deleted = true; $this->requiredDatabase = true; parent::__construct(); $this->page = basename(__FILE__, '.php'); $this->displayName = $this->l('Search by vehicle'); $this->description = $this->l('Search tire and rims'); $this->_errors = array(); $this->path = $this->_path; $modDesc = $this->l('<fieldset>This module allows you to include as many banners as you like.'); $modStatus = $this->l('You can upload, order, activate or deactivate as many banners and select if you want them in the right or left columns.</fieldset>'); $this->_html .= "<b>{$modDesc}</b><br /><br /> {$modStatus}<br /><br /><br /><br />"; $this->_select = 'SELECT Regnr FROM '._DB_PREFIX_.'searchbyvehicle ORDER BY Regnr DESC LIMIT 1'; $this-> fieldsDisplay = array ( 'Regnr' => array('title' => $this->l('Regnr'), 'align' => 'center', 'width' => 25), 'Fordonstyp' => array('title' => $this->l('Fordonstyp'), 'width' => 25), 'Marke' => array('title' => $this->l('Marke'), 'width' => 80), 'Modell' => array('title' => $this->l('Modell'), 'width' => 60), 'Arsmodell' => array('title' => $this->l('Arsmodell'), 'width' => 120, 'maxlength' => 19)); parent::__construct(); } function getContent() { $this->_html = '<h2>'.$this->displayName.'</h2>'; //Display Header if (!empty($_POST)){ if (!sizeof($this->_postErrors)) $this->_postProcess(); else foreach ($this->_postErrors AS $err) $this->_html .= "<div class='alert error'>{$err}</div>"; } else $this->_html .= "<br />"; $this->display(); return $this->_html; } public function display() { global $cookie; if (isset($_GET['view'.$this->table])) $this->viewDetails(); else { $this->getList((int)($cookie->id_lang), !Tools::getValue($this->table.'Orderby') ? 'DESC' : NULL); $this->displayList(); } } ## INSTALL ############################################## function install() { if (parent::install() == false OR !$this->registerHook('home') OR $this->_createTables() == false ) return false; return true; } /** * createTables() * Called when intalling */ public function _createTables() { $db = Db::getInstance(); /* Create banners card table */ $query = 'CREATE TABLE `'._DB_PREFIX_.'searchbyvehicle` ( `Regnr` char(6) NOT NULL, `Fordonstyp` char(2) NOT NULL default "", `Marke` char(255) NOT NULL default "", `Modell` char(255) NOT NULL default "", `Arsmodell` char(255) NOT NULL default "", PRIMARY KEY (`Regnr`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8'; $result = $db->Execute($query); if (!$result) return false; return true; } function uninstall() { $db = Db::getInstance(); $query = 'DROP TABLE `'._DB_PREFIX_.'searchbyvehicle`'; $result = $db->Execute($query); if (!$result) return false; if (!parent::uninstall()) return false; return true; } ## HOOK ############################################## function hookHome($params) { global $cookie, $smarty; $smarty->assign(array( 'searchbyvehicle_class' => 'home', 'searchbyvehicle' => $this->getBanners('3'), )); return $this->display(__FILE__, 'searchbyvehicle.tpl'); } } Vill lista ut dom som customer list i BO jag får den bara att visas så här: Edited January 16, 2013 by spc (see edit history) 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