Kevin Posted August 1, 2019 Share Posted August 1, 2019 Hi Guys, Since 1.7.6 the AdminCategoriesController.php doesn't seemed to be used anymore. Therefore they use core functionality like the file src/PrestaShopBundle/Controller/Admin/Sell/Catalog/CategoryController.php But i cannot find a way how to override this and add an extra field to the category overview in the backend. For products you got the hooks you can use(listingModifier) but for the categories these hooks aren't there. Anyone has a suggestion? Thanks! Regards, Kevin Link to comment Share on other sites More sharing options...
ITDWX Andras Posted January 3, 2020 Share Posted January 3, 2020 You need to create a custom module to do this: https://stackoverflow.com/questions/57552868/add-custom-field-in-prestashop-1-7-6-category-with-a-module-how-to-save-in-data 1 Link to comment Share on other sites More sharing options...
pawan_911 Posted April 2, 2020 Share Posted April 2, 2020 (edited) Hi https://stackoverflow.com/questions/57552868/add-custom-field-in-prestashop-1-7-6-category-with-a-module-how-to-save-in-data this module is not working. it's not displaying any field in the category in the admin and the db table. Edited April 2, 2020 by pawan_911 (see edit history) Link to comment Share on other sites More sharing options...
D.EINS Posted July 3, 2020 Share Posted July 3, 2020 (edited) Hi, I'm experiencing exactly the same problem right now. Has a solution been found in the meantime? My goal is to add an additional textarea field to the category form in the backoffice to create a second category description. Since my PrestaShop version is 1.7.6.5, it seems not to be able anymore to override the controllers/admin/AdminCategoriesController.php class. I also found the stackoverflow question linked above, but it seemed to me to be kind of incomplete, because on the one hand probably the new field has to be created in the database and on the other hand the hooks "actionAdminCategoriesControllerSaveAfter" and "actionAdminCategoriesFormModifier" do not seem to exist. Edited July 3, 2020 by D.EINS (see edit history) Link to comment Share on other sites More sharing options...
Kevin Posted July 3, 2020 Author Share Posted July 3, 2020 I didn't test this yet, but i suppose it works since it works with manufacturers(which also don't have a controller anymore). In your custom module create a hook function hookActionManufacturerGridPresenterModifier, in the categories case something like hookActionCategoryGridPresenterModifier(not 100% sure about this name). In that function you can modify the $params['presented_grid']['data'] which includes all grid data. In your custom module, create a structure like this: /views/PrestaShop/Admin/Common/Grid/Blocks/ In that folder create a file table.html.twig and another folder Table In that folder /views/PrestaShop/Admin/Common/Grid/Blocks/Table add filters_row.html.twig and headers_row.html.twig Doing that you override the core files on this location: /src/PrestaShopBundle/Resources/views/Admin/Common/Grid/Blocks/ To make sure you only change the twig files for the manufacturer(or category in this case) i've added this in the twig files: {% if grid.id == "manufacturer" %} Hope this helps a bit. 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