ejectcore Posted June 8, 2008 Share Posted June 8, 2008 Not sure if this one is possible, currently when you transplant a module you can enter exceptions for pages where the module will not appear, this is a really good idea but I want to enhance the positions block by being able to select several categories where this module will appear, in the same way that exceptions works, but the opposite rule, I have started this hack but seem to be struggerling to work out how some of the coding structure works added to module.php below line 255 /* Module linked by Categories */ /* Add categories for module->Hook */ public function registerCategoiresModule$id_hook, $categoireslinks) { foreach ($categoireslinks AS $categoireslink) { if (!empty($categoireslink)) { $result = Db::getInstance()->Execute(' INSERT INTO `'._DB_PREFIX_.'hook_module_category` (`id_module`, `id_hook`, `id_category`) VALUES ('.intval($this->id).', '.intval($id_hook).', ''.strval($categoireslink).'')'); if (!$result) return false; } } return true; } added to AdminModulesPositions.php changes marked in bold // Getting vars... $id_module = intval(Tools::getValue('id_module')); $module = Module::getInstanceById($id_module); $id_hook = intval(Tools::getValue('id_hook')); $hook = new Hook($id_hook); $excepts = explode(',', str_replace(' ', '', Tools::getValue('exceptions'))); $categoireslinks = explode(',', str_replace(' ', '', Tools::getValue('CategoiresModule'))); // Checking vars... foreach ($excepts AS $except) if (!Validate::isFileName($except)) $this->_errors[] = Tools::displayError('no valid value for field exceptions'); if (!Validate::isFileName($categoireslink)) $this->_errors[] = Tools::displayError('no valid value for field Categories Link'); <label>'.$this->l('Exceptions').' :</label> <label>'.$this->l('CategoiresModule').' :</label> Can anyone point out where I am going wrong with this ??? and yes I have already created the additonal MYSQL table Link to comment Share on other sites More sharing options...
Recommended Posts