Ikoshop Posted November 26, 2024 Share Posted November 26, 2024 I've created a module with the Validator (https://validator.prestashop.com/generator#) Prestashop version is 8.2.0. For now, the module should do nothing except display an alert to show that it exists and has been called. It should work on the Create Product hook (hookActionProductAdd) I added the module, installed it and configured in the back office. When I go to the Catalog and Add a new product nothing happens. Is there some way to debug it? Maybe it fails on the first line if _PS_VERSION_ is not defined? I presume this should be 8.2.0 ? ikoproductcreate.zip Link to comment Share on other sites More sharing options...
Andrei H Posted December 1, 2024 Share Posted December 1, 2024 Hello, Unfortunately, it seems like the hook is never called indeed. If you try and search it, it looks like other users are complaining about this as well. The _PS_VERSION_ check is used only when you try and manually access the file directly into a browser context. Even if the hook would have worked, I don't think it would be a viable option for you if you are using the new Product page (you can find that under Advanced Parameters -> New & Experimental Features). The way this page works, PrestaShop creates the product when you click 'Add new product', so you will not be able to get the title/price etc. If you only need the id of the product, you can use the actionObjectProductAddAfter hook. If you need the title/price etc, I think the hook you might need to go with is actionProductSave. You will also need to create a table in the database that keeps track of which products were sent to the external API (or maybe there is some functionality in there that shows if the product is already present or not, in which case you will not need the table) Link to comment Share on other sites More sharing options...
Ikoshop Posted December 2, 2024 Author Share Posted December 2, 2024 Thank you very much for the feedback. I feel a bit less like I'm going nuts! I tried updating the php file with the other hook names but nothing doing there either. So, I really wonder if the Validator tool actually creates working files or if it's compatible with the latest version. I tried creating a bunch of other modules based on various hooks but not one of them does anything. I think I need to somehow get hold of a working module, compatible with 8.2, that does anything at all based on any hook, and see how it all works because I'm pretty sure the validator tool is useless for this version and I'm just blindly hoping something will work. I might just start over from scratch with a lower version of Prestashop. Link to comment Share on other sites More sharing options...
Ikoshop Posted December 3, 2024 Author Share Posted December 3, 2024 Just to confirm, the hook hookActionProductAdd works on 1.6 but not on 1.7 hookActionProductSave works on 1.7 but not on 8.2 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