mirkos90 Posted April 22, 2014 Share Posted April 22, 2014 (edited) Hi, I'm writing a module to synchronize a warehouse software with prestashop, but now I've a trouble: how I can write a function (in the module) that is executed when an customer purchase for an item in prestashop? Can anyone write an example of this? Prestashop version: 1.5 Thank you Mirko Edited April 22, 2014 by mirkos90 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 22, 2014 Share Posted April 22, 2014 you can use actionOrderStatusUpdate hook Link to comment Share on other sites More sharing options...
mirkos90 Posted April 22, 2014 Author Share Posted April 22, 2014 (edited) you can use actionOrderStatusUpdate hook Hi vekia and thank you for your answer, i've added this to my module class, why this didn't work? public function hookActionOrderStatusUpdate($params){ $h = fopen("log.txt","a+"); fwrite($h,print_r($params,true)); fclose($h); } I've tried also this: public function hookActionOrderStatusUpdate($params){ print_r($params);exit(); } Thank you! Mirko Edited April 22, 2014 by mirkos90 (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted April 22, 2014 Share Posted April 22, 2014 hi mirkos, did you actually 'register' the hook? Something like this: public function install() { if (!parent::install() || !$this->registerHook('actionOrderStatusUpdate') ) return false; } Look at some other modules and see what functions they define like create, destroy, install, uninstall, initForm, displayForm etc. My 2 cents, pascal Link to comment Share on other sites More sharing options...
mirkos90 Posted April 22, 2014 Author Share Posted April 22, 2014 hi mirkos, did you actually 'register' the hook? Something like this: public function install() { if (!parent::install() || !$this->registerHook('actionOrderStatusUpdate') ) return false; } Look at some other modules and see what functions they define like create, destroy, install, uninstall, initForm, displayForm etc. My 2 cents, pascal Thank you! It's work fine! Mirko Link to comment Share on other sites More sharing options...
PascalVG Posted April 22, 2014 Share Posted April 22, 2014 Perfect! If all your questions are answered, please mark the topic (in title) as solved (See my footer text on how). Happy selling, pascal. Link to comment Share on other sites More sharing options...
mirkos90 Posted April 22, 2014 Author Share Posted April 22, 2014 Perfect! If all your questions are answered, please mark the topic (in title) as solved (See my footer text on how). Happy selling, pascal. Done Thank you again Mirko 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