Jump to content

namnguyen2091

Members
  • Posts

    3
  • Joined

  • Last visited

About namnguyen2091

  • Birthday 11/20/1991

Profile Information

  • Location
    Việt Nam
  • Activity
    Developer

namnguyen2091's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I create an object model like this: public function __construct($id_video = null, $id_lang = null, $id_shop = null, Context $context = null) { parent::__construct($id_video, $id_lang, $id_shop, $context); } I get an error "Useless method overriding detected" when try to validate module. Please help me fix this error! I searched but no result found.
  2. "Your fuctions like __construct, install(), etc. aren't public" I see many __construct functions in modules in default source wrote like I wrote above :v
  3. I tried to use the code below to create a new module but I got an error as the same title. Please help me check! <?php if (!defined('_PS_VERSION_')) exit; include_once(_PS_MODULE_DIR_ . 'era_widget/widgetModel.php'); /** * Description of era_widget * * @author nguye_000 */ class era_widget extends Module { private $_html = ''; function __construct() { $this->name = 'era_widget'; $this->tab = 'other'; $this->version = '1.0'; $this->author = 'Nam Nguyen'; $this->need_instance = 1; $this->secure_key = Tools::encrypt($this->name); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Era Widget'); $this->description = $this->l('Display widgets for sidebar or something'); } function install() { if (parent::install() && $this->registerHook('displayHeader')){ $res = $this->createTable(); if ($res) { $this->installSamples(); } return $res; } return false; } function uninstall() { if (parent::uninstall()) { $res = $this->deleteTable(); return (bool)$res; } return false; } function hookdisplayHeader() { return $this->display(__FILE__, 'frontend.tpl'); } private function createTable() { $sql = "DROP TABLE IF EXISTS " . _DB_PREFIX_ . "`awidget`;CREATE TABLE " . _DB_PREFIX_ . "`awidget` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `key` varchar(255) NOT NULL, `value` longtext NOT NULL, `area` text NOT NULL COMMENT 'where to contains widget', `position` int(5) NOT NULL COMMENT 'order', `parent` bigint(20) NOT NULL COMMENT 'wrapper is parent or not', PRIMARY KEY (`id`), KEY `meta_key` (`key`) ) ENGINE=". _MYSQL_ENGINE_ ." DEFAULT CHARSET=utf8;"; $res = (bool) Db::getInstance()->execute($sql); return $res; } private function installSamples() { $sql = "insert into ". _DB_PREFIX_ . "`awidget`(`id`,`key`,`value`,`area`,`position`,`parent`) " . "values (1,'textwidget','a:2:{s:5:\"title\";s:14:\"The first text\";s:7:\"content\";s:232:\"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\";}','widget-area-sample',1,0);"; DB::getInstance()->execute($sql); } private function deleteTable() { return Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'awidget`'); } }
×
×
  • Create New...