PrestashopEnthu Posted March 3, 2018 Share Posted March 3, 2018 I have created a custom module which executes an action after new order has been created. The order will be sent to delivery company via API. Currently, I am having an issue whereby the code executes when I am using payment with STRIPE while for Paypal, it is not executing the action at all. The hook I am currently using is called hookActionValidateOrder. Since this hook executes the action when an order is created, I do not understand why it is currently not working for Paypal. It should execute or not execute based on payment gateway, right? Alternatively, is there any other hooks I can use apart from hookActionValidateOrder? Thank you for your insights and guidance. Link to comment Share on other sites More sharing options...
bellini13 Posted March 24, 2018 Share Posted March 24, 2018 what is the very first order status that this order receives when using paypal? maybe the hook is bypassed for that order status? Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted March 24, 2018 Author Share Posted March 24, 2018 Hi belleni13, I have added a status called "Payment Validated" that is reflected on the order after it is created. It is the same for STRIPE or PayPal payment mode that is also being used. I have enabled DEBUG_MODE and checked in DB on the log. It has indeed logged the following: "PaymentModule::validateOrder - Hook validateOrder is about to be called" Is there anywhere else I should be looking? Thank you. Link to comment Share on other sites More sharing options...
bellini13 Posted March 24, 2018 Share Posted March 24, 2018 is this for PS v1.6 or v1.7? Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted March 26, 2018 Author Share Posted March 26, 2018 Hi Bellini, This is for PS 1.6. Thank you. Link to comment Share on other sites More sharing options...
bellini13 Posted March 26, 2018 Share Posted March 26, 2018 how do you know the hook is NOT being called? perhaps you have not properly registered the hook in your module. what kind of debugging have you done to validate that the module registered the hook properly? did you add any kind of debug statement to your module to detect if the hook is being called or not? Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted March 31, 2018 Author Share Posted March 31, 2018 (edited) Hi Bellini, I have checked in log in database that it is calling the hook - "PaymentModule::validateOrder - Hook validateOrder is about to be called" and PaymentModule::validateOrder - Function called. Thank you. Edited March 31, 2018 by Enthu86 (see edit history) Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted April 1, 2018 Author Share Posted April 1, 2018 (edited) Any clues? Thank you. Edited April 1, 2018 by Enthu86 (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted April 1, 2018 Share Posted April 1, 2018 clues? no you have not provided anything... you need to continue to debug and as I mentioned earlier... how do you know the hook is NOT being called? perhaps you have not properly registered the hook in your module. what kind of debugging have you done to validate that the module registered the hook properly? did you add any kind of debug statement to your module to detect if the hook is being called or not? Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted April 1, 2018 Author Share Posted April 1, 2018 Hi bellini13, I have checked in database - log that the hook is being called. I am using hookActionValidateOrder, so when an order is using a specific carrier, it will execute a set of codes/actions. The module I have implemented is working only when I use STRIPE payment mode. It will not run nor execute the codes if I am using PayPal. My module is hooked actionValidateOrder and I have checked from back-office - Modules > Positions. Thank you. Link to comment Share on other sites More sharing options...
bellini13 Posted April 2, 2018 Share Posted April 2, 2018 21 hours ago, Enthu86 said: I have checked in database - log that the hook is being called what does this mean? You cannot look in the database to confirm that YOUR CUSTOM MODULE hook function was called... You need to add some code in your CUSTOM MODULE hook function, make it the first thing it does, and verify that your CUSTOM MODULES hook function is actually being called or not. Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted April 2, 2018 Author Share Posted April 2, 2018 Hi bellini13, I am using hookActionValidateOrder($params) in my custom module. And that when the cart calls this, my code will execute, right? That was why I checked if the hook is being called in database. It is only working if I use STRIPE so I was wondering or how can I debug on this for PayPal? Thank you. Link to comment Share on other sites More sharing options...
bellini13 Posted April 2, 2018 Share Posted April 2, 2018 the database does not record hooks that are actually called during runtime. it only captures hooks that SHOULD be called, not ones that are ACTUALLY called. perhaps the paypal module you are using is not creating an order? and so the hook is no being called. perhaps your module is not coded properly perhaps you have some customization on your store that is preventing this from working properly IDK, there could be a million reasons why this is not working for you. you need to roll up your sleeves and start digging in the code and really see what is going on. Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted April 2, 2018 Author Share Posted April 2, 2018 Hi bellini13, I will look into this and update on my findings. Thank you for your time. 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