vazeem Posted August 21, 2015 Share Posted August 21, 2015 how to get category_id and how to insert that into a new database.Also i want to add a new field into category page in the back office. Link to comment Share on other sites More sharing options...
NemoPS Posted August 21, 2015 Share Posted August 21, 2015 What do you mean by new database exactly?As for the new field: http://blog.arvixe.com/properly-extending-prestashop-objects/ Link to comment Share on other sites More sharing options...
vazeem Posted August 21, 2015 Author Share Posted August 21, 2015 (edited) Hi Nemo, I just created a db table to insert the category_id.Before that i need to get the category_id.Hope you understand. Edited August 21, 2015 by vazeem (see edit history) Link to comment Share on other sites More sharing options...
gabdara Posted August 21, 2015 Share Posted August 21, 2015 It depends on where you try to get the category id. Is it inside the function of a module, a module hooked on a action, a function inside your own Front/Admin controller? Try to give a more detailed scenario of what you're trying to do. 1 Link to comment Share on other sites More sharing options...
vazeem Posted August 21, 2015 Author Share Posted August 21, 2015 (edited) Its inside a module.i override the AdminCategoriesController.php to my module.In this php file i want to get the id_category. $id_category = (int)Tools::getValue('id_category'); echo $id_category; I try this.But shows displays none. Edited August 21, 2015 by vazeem (see edit history) Link to comment Share on other sites More sharing options...
gabdara Posted August 21, 2015 Share Posted August 21, 2015 The code you are trying is working in renderForm(). It also works in renderList() if you're in a parent category other than Home. Instead of echo use d($id_category) to output only the variable value. A better alternative to get the category id if you're in a function that is fired after the init() function is: $this->_category->id; 1 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