mathlef0u Posted January 6, 2014 Share Posted January 6, 2014 Hello everyone, I wanna increment a counter on every order in my module. I tried to hook newOrder but it seems that when i order a product by credit card (VADS module or Paypal) the counter does not increment. So i searched on the official documentation and i found the hook actionPaymentConfirmation which will be executed anytime the order status is changed to "Payment Accepted". But i doesn't wan't it. actionValidateOrder is newer than newOrder but it's apparently the same. And OrderConfirmation is not a solution because it's a hook on confirmation page and users doesn't pass necessarily through this page. So what can i use to increment a counter on order creation ? Sorry for my bad english Thanks by advance, Link to comment Share on other sites More sharing options...
krisives Posted January 6, 2014 Share Posted January 6, 2014 Howdy, Anything that extends ObjectModel in PrestaShop automatically gets hooks for Create Read Update and Delete (CRUD) operations. https://github.com/PrestaShop/PrestaShop/blob/1.6/classes/ObjectModel.php#L433 Two hooks are ran here: actionObjectAddBefore is executed and passed the object. This is so you can hook ALL objects being added to the database generically. actionObject{$class}AddBefore is executed after and passed the object. This is so you can hook on objects of a specific type, in your case 'Order' Try registering for the hook "actionObjectOrderAddAfter" which should be called after every order is added. The order may not be validated etc. I am unsure of that. Cheers, Kris Link to comment Share on other sites More sharing options...
mathlef0u Posted January 7, 2014 Author Share Posted January 7, 2014 Thanks krisives, But this features is not available on Prestashop 1.3 and i try to develop a module which will be compatible with 1.3 version. Do you have any idea ? Thanks by advance, 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