drunkenmyno Posted February 23, 2015 Share Posted February 23, 2015 (edited) Hello Prestashop Developers, I'm using PS 1.6 and trying to develop a module whichs overrides AdminCategorieController.php and adding a new Row action to the list i using this code <?php class AdminCategoriesController extends AdminCategoriesControllerCore { public function renderList() { if (isset($this->_filter) && trim($this->_filter) == '') $this->_filter = $this->original_filter; $this->addRowAction('view'); $this->addRowAction('add'); $this->addRowAction('edit'); $this->addRowAction('testaction'); $this->addRowAction('delete'); $count_categories_without_parent = count(Category::getCategoriesWithoutParent()); $categories_tree = $this->_category->getParentsCategories(); if (empty($categories_tree) && ($this->_category->id != (int) Configuration::get('PS_ROOT_CATEGORY') || Tools::isSubmit('id_category')) && (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::isFeatureActive() && $count_categories_without_parent > 1)) $categories_tree = array(array('name' => $this->_category->name[$this->context->language->id])); $categories_tree = array_reverse($categories_tree); $this->tpl_list_vars['categories_tree'] = $categories_tree; $this->tpl_list_vars['categories_tree_current_id'] = $this->_category->id; if (Tools::isSubmit('submitBulkdelete' . $this->table) || Tools::isSubmit('delete' . $this->table)) { $category = new Category(Tools::getValue('id_category')); if ($category->is_root_category) $this->tpl_list_vars['need_delete_mode'] = false; else $this->tpl_list_vars['need_delete_mode'] = true; $this->tpl_list_vars['delete_category'] = true; $this->tpl_list_vars['REQUEST_URI'] = $_SERVER['REQUEST_URI']; $this->tpl_list_vars['POST'] = $_POST; } return AdminController::renderList(); } public function initProcess() { parent::initProcess(); if ($this->action == 'testaction') { if (Tools::getIsset('cancel')) Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminCategories')); $this->action = 'testaction'; } } public function initContent() { if ($this->action == 'select_delete') $this->context->smarty->assign(array( 'delete_form' => true, 'url_delete' => htmlentities($_SERVER['REQUEST_URI']), 'boxes' => $this->boxes, )); if ($this->action == 'testaction') { $this->tpl_form = $this->initForm(); } AdminController::initContent(); } public function initForm() { $tpl_path = _PS_MODULE_DIR_ . '/mymodule/myodule.tpl'; $data = $this->context->smarty->createTemplate($tpl_path, $this->context->smarty); $this->tpl_form = $data->fetch(); } public function displayTestactionLink($token = null, $id, $name = null) { $tpl_path = _PS_MODULE_DIR_ . 'geoinformation/geo/geo.tpl'; $data = $this->context->smarty->createTemplate($tpl_path, $this->context->smarty); if (!array_key_exists('kml', self::$cache_lang)) self::$cache_lang['kml'] = $this->l('Test Action', 'Helper'); $data->assign(array( 'href' => self::$currentIndex . '&' . $this->identifier . '=' . $id . '&kml' . $this->table . '&token=' . ($token != null ? $token : $this->token), 'action' => self::$cache_lang['testaction'], 'id' => $id )); return $data->fetch(); } ... the action is added to the list but if i click on my action nothing happens it should render the tpl that i give him.. what did i forget or what did i wrong ? Thank you Edit: Btw what i want to do is i click on my action on a Category, a new form should be displayed with an table information ... i figured out how i can catch the action to call but my page is always blank Edited February 23, 2015 by drunkenmyno (see edit history) 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