clarkk Posted December 11, 2012 Share Posted December 11, 2012 Hi I have coded af very simple module which works in version 1.5.. But when trying to install the module in version 1.4.0.17 an error is returned The following module(s) were not installed successfully: Could anyone tell me whats not compatible in the code? <?php if(!defined('_PS_VERSION_')) exit; class Dynaccount extends Module { const TBL_CACHE = 'dynaccount_cache'; const TBL_LOG = 'dynaccount_log'; public function __construct(){ $this->name = 'dynaccount'; $this->version = 1.0; $this->author = 'Dynaccount'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Dynaccount'); $this->description = $this->l('Dynaccount API integration'); } private function install_tabs(){ if(!Tab::getIdFromClassName('AdminDynaccountCache')){ $tab = new Tab(); $tab->class_name = 'AdminDynaccountCache'; $tab->id_parent = 10; $tab->module = $this->name; $languages = Language::getLanguages(false); foreach($languages as $lang){ $tab->name[$lang['id_lang']] = 'Dynaccount cache'; } $tab->save(); } if(!Tab::getIdFromClassName('AdminDynaccountLog')){ $tab = new Tab(); $tab->class_name = 'AdminDynaccountLog'; $tab->id_parent = 10; $tab->module = $this->name; $languages = Language::getLanguages(false); foreach($languages as $lang){ $tab->name[$lang['id_lang']] = 'Dynaccount log'; } $tab->save(); } } public function install(){ if(!parent::install() || !$this->registerHook('actionPaymentConfirmation')){ return false; } $this->install_tabs(); Db::getInstance()->Execute("CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_.self::TBL_CACHE."` (" ."`id` int(10) unsigned NOT NULL AUTO_INCREMENT," ."`is_booked` tinyint(1) unsigned NOT NULL," ."`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP," ."`order_id` int(10) unsigned NOT NULL," ."`invoice_number` int(10) unsigned NOT NULL," ."`total` decimal(8,2) NOT NULL," ."`vat` decimal(8,2) NOT NULL," ."PRIMARY KEY (`id`)," ."KEY `is_booked` (`is_booked`))"); Db::getInstance()->Execute("CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_.self::TBL_LOG."` (" ."`id` int(10) unsigned NOT NULL AUTO_INCREMENT," ."`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," ."`msg` varchar(255) NOT NULL," ."PRIMARY KEY (`id`))"); return true; } public function hookActionPaymentConfirmation($params){ } public function uninstall(){ Db::getInstance()->Execute("DROP TABLE `"._DB_PREFIX_.self::TBL_CACHE."`"); Db::getInstance()->Execute("DROP TABLE `"._DB_PREFIX_.self::TBL_LOG."`"); $tab = new Tab(Tab::getIdFromClassName('AdminDynaccountCache')); $tab->delete(); $tab = new Tab(Tab::getIdFromClassName('AdminDynaccountLog')); $tab->delete(); parent::uninstall(); } } 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