Jump to content

[SOLVED] [PHP] On order confirmation


mirkos90

Recommended Posts

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 by mirkos90 (see edit history)
Link to comment
Share on other sites

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 by mirkos90 (see edit history)
Link to comment
Share on other sites

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

 

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...