Jump to content

Create Moudule with Database


Recommended Posts

Hi everyone,

Im developing a module in Prestashop 1.5 with database. But the problem is:

When i go to install the module, it says that wasnt installed properly.

 

The install is here:

 

public function install()
 {
 if (parent::install() == false OR !$this->registerHook('leftColumn'))
return false;


 if (!$sql = file_get_contents(dirname(__FILE__).'/install.sql'))
  die(Tools::displayError('File install.sql is not readable'));
 $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql);
 $sql = preg_split("/;\s*[\r\n]+/", $sql);
 foreach ($sql as $query)
  if ($query AND sizeof($query) AND !Db::getInstance()->execute(trim($query)))
return false;
 return true

 

http://papelariavelo...ias/install.sql

Link to comment
Share on other sites

×
×
  • Create New...