gonandriy Posted October 22, 2010 Share Posted October 22, 2010 How you see into idea add hooks for add/update/delete object? They may be called in postProcess method of AdminTab. It may be usefull for developers, because help simply add new functional. Params of hook handler may be instance of object (returned by loadObject method). May create different hook for different kind of events (add/update/move/delete etc.) or one hook and pass type of modification into handler as parameter. Link to comment Share on other sites More sharing options...
pldtm Posted December 19, 2010 Share Posted December 19, 2010 +1 for mei want to add a modifyobject hook handlerDo i just need to add my hook in presta db, or do i need something elsethanks a loti didn't find any documentation for hooks handlerthanks a lotpldtm Link to comment Share on other sites More sharing options...
gonandriy Posted December 19, 2010 Author Share Posted December 19, 2010 It's not enough add your hook in presta DB. You also need add piece of code, which run this hook in prestashop core filesIn general some chages can be doing in AdminTab->postProcess(). But in particular cases (picture upload), can be need something else. Link to comment Share on other sites More sharing options...
pldtm Posted December 19, 2010 Share Posted December 19, 2010 i tried to find for "adminorders.php" the "cancelproduct" hook for examplei didn't find any reference to "cancelproduct" in postprocess.Just data in ps_hook hook_id 39. And i can't find what's inside this hook. It could help me understand how it works Link to comment Share on other sites More sharing options...
gonandriy Posted December 20, 2010 Author Share Posted December 20, 2010 Is hook_id 39 your own created hook?What you mean about inside of hook? after hook run by call Module::hookExec($hook_name, $hookArgs = array(), $id_module = NULL) will be executed all modules, registered in this hook (with name $hook_name)In your case seems you need add call of Module::hookExec() in AdminOrder::postProcess(), somewhere after /* Cancel product from order */ elseif (Tools::isSubmit('cancelProduct') AND Validate::isLoadedObject($order = new Order(intval(Tools::getValue('id_order'))))) and every modules, registered in this hook will be executed. Also I recommend you carefuly investigate code of Module::hookExec() method. This help you understand some things inside.if you have any more questions, you can write me private message or over ICQ. Link to comment Share on other sites More sharing options...
Sr.Colas Posted December 22, 2010 Share Posted December 22, 2010 So there is any way to add a new hook with a module? i create few extra hooks in db and that, also i assing at Frontcontroller.php like 'HOOK_EXTRA1' => Module::hookExec('extra1'), i don't like this way because tomorrow or something a new frontcontroller.php will be release by prestashop and that is a mess!Regards 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