banditbirds Posted April 4, 2014 Share Posted April 4, 2014 (edited) Hi guys! I am trying to create a table in my prestashop database using the install function of a module. It creates the table, but not the fields. Could anyone give us any advice on what I'm doing wrong?? Many thanks in advance!! Simon public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); $sql = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."custom_order`( `id_custom_order` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `request_details` VARCHAR(256) )"; if(!$result=Db::getInstance()->Execute($sql)) return false; return parent::install() && $this->registerHook('leftColumn') && $this->registerHook('header') && Configuration::updateValue('MYMODULE_NAME', 'my friend'); } Edited April 4, 2014 by banditbirds (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 4, 2014 Share Posted April 4, 2014 hello so, when you use this code you've got problem with: 1) database creation ? 2) installation function (don't see that module was installed) ? Link to comment Share on other sites More sharing options...
banditbirds Posted April 4, 2014 Author Share Posted April 4, 2014 hi, database creation. The module installs fine. And the table ps_custom_order is created ok in my database. But there are no columns/fields = id_custom_order, request_details (pic attached). Maybe these only appear when I input data in the fields?? Link to comment Share on other sites More sharing options...
banditbirds Posted April 4, 2014 Author Share Posted April 4, 2014 I dropped the table in phpMyAdmin and re-installed the module. It has created the table with both fields now (pic attached) 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