slymatt Posted November 13, 2015 Share Posted November 13, 2015 Hello, So my issue is im trying to create a module that attaches to the hooks: actionCategoryAdd actionCategoryUpdate But when i use public function hookActionCategoryAdd($params) { return $this->display(__FILE__, 'views/templates/hook/newfieldstut.tpl'); } Nothing shows up am i doing something wrong? Cheers in advance Link to comment Share on other sites More sharing options...
razaro Posted November 13, 2015 Share Posted November 13, 2015 Well first what you are trying to accomplish with module ? Second those hooks have action in their names so they used when you want to change some data on category add or update. They do not display anything. You need to use display hooks if you want some code from tpl file to appear. Also you consider creating custom hook for your module. Link to comment Share on other sites More sharing options...
slymatt Posted November 13, 2015 Author Share Posted November 13, 2015 All im trying to do is add a single field that will be added to the database, i need all the code to be held within the module Does this help ? =P Link to comment Share on other sites More sharing options...
razaro Posted November 13, 2015 Share Posted November 13, 2015 Maybe this tutorial can help http://nemops.com/extending-prestashop-objects/#.VkYOUPmrTIU Link to comment Share on other sites More sharing options...
slymatt Posted November 13, 2015 Author Share Posted November 13, 2015 But isn't that overloading instead of adding to? Also i dont see a displayCategoryAdd displayCategoryUpdate Link to comment Share on other sites More sharing options...
razaro Posted November 13, 2015 Share Posted November 13, 2015 Yes it is overriding. If you want to add field to category admin page, you need to override correct admin tpl file and maybe AdminCategory Controller. Sorry you said all code you want within the module. But module can override files on install. But to get to your first post, maybe action hooks are good to use in your case just use them to save data not displaying form. Link to comment Share on other sites More sharing options...
slymatt Posted November 13, 2015 Author Share Posted November 13, 2015 if i override this could cause issues for other modules that may be installed couldnt it, and i cant just use an action hook as you said because i need to display the field first to get the input. I dont want to cause issues with other modules Link to comment Share on other sites More sharing options...
razaro Posted November 13, 2015 Share Posted November 13, 2015 Yeah I understand, and it is recommended to not use overrides if possible. Ok let me ask for more info. Where you want to show that input , back office or front office, can you display it in modules page? Could you maybe create new table that will save input and id of category ? Link to comment Share on other sites More sharing options...
slymatt Posted November 13, 2015 Author Share Posted November 13, 2015 (edited) Ive added an image where i wanted the new field its in the backend Where you add a new category, also update the category aswell. I could add it to the config page and loop through each category but that would be a ton more work that i was hoping wouldn't be needed Hope this clears a few more things up. Edited November 13, 2015 by slymatt (see edit history) Link to comment Share on other sites More sharing options...
slymatt Posted November 13, 2015 Author Share Posted November 13, 2015 Does that make sense? Link to comment Share on other sites More sharing options...
slymatt Posted November 14, 2015 Author Share Posted November 14, 2015 Still cant figure it out =S Link to comment Share on other sites More sharing options...
razaro Posted November 14, 2015 Share Posted November 14, 2015 Well I do not know other way then override to do that. 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