SantiPixel Posted October 1, 2013 Share Posted October 1, 2013 Hi, I never worked with hooks on Prestashop so I'm still confused. What is wrong? <?php class AuthController extends AuthControllerCore { public function hookActionCustomerAccountAdd($params) { var_dump($params); } } File: override/controllers/front/AuthController.php Thanks! Link to comment Share on other sites More sharing options...
vekia Posted October 1, 2013 Share Posted October 1, 2013 nothing wrong, everything works fine, this is an "action" hook, it means that this isn't visible hook. try to break script after var_dump($params);, you should see dump then Link to comment Share on other sites More sharing options...
SantiPixel Posted October 1, 2013 Author Share Posted October 1, 2013 (edited) nothing wrong, everything works fine, this is an "action" hook, it means that this isn't visible hook. try to break script after var_dump($params);, you should see dump then Hi thanks for your reply. I also tried this: public function hookActionCustomerAccountAdd($params) { $customer = $params['newCustomer']; $info = $params['_POST']; return Mail::Send( 4, 'account', 'Test', array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => $info['passwd']), '[email protected]', $customer->firstname.' '.$customer->lastname ); } I receive the welcome email on the registered account but not in my mail. EDIT: nothing happens when I "break" the script. Thanks again Edited October 1, 2013 by SantiPixel (see edit history) Link to comment Share on other sites More sharing options...
SantiPixel Posted October 1, 2013 Author Share Posted October 1, 2013 (edited) Hi, sorry for the bump. Temporaly I'm using the "sendConfirmationMail" because that hook doesn't work for me. class AuthController extends AuthControllerCore { protected function sendConfirmationMail(Customer $customer) { /* Lo registramos como vendedor ¿? */ $sql = 'INSERT INTO '. _DB_PREFIX_ .'employee (id_profile, id_lang, lastname, firstname, email, passwd, last_passwd_gen, stats_date_from, stats_date_to, bo_color, bo_theme, default_tab, bo_width, bo_show_screencast, active, id_last_order, id_last_customer_message, id_last_customer) VALUES (5, 3, "'. $customer->lastname .'", "'. $customer->firstname .'", "'. $customer->email .'", "'. $customer->passwd .'", CURRENT_TIMESTAMP, NOW(), NOW(), NULL, "default", 0, 0, 1, 1, 0, 0, 0) '; Db::getInstance()->execute($sql); return Mail::Send( $this->context->language->id, 'account', Mail::l('Welcome!'), array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname ); } } And its works fine.. Edited October 1, 2013 by SantiPixel (see edit history) Link to comment Share on other sites More sharing options...
[email protected] Posted December 3, 2013 Share Posted December 3, 2013 (edited) Hi, sorry for the bump. Temporaly I'm using the "sendConfirmationMail" because that hook doesn't work for me. class AuthController extends AuthControllerCore { protected function sendConfirmationMail(Customer $customer) { /* Lo registramos como vendedor ¿? */ $sql = 'INSERT INTO '. _DB_PREFIX_ .'employee (id_profile, id_lang, lastname, firstname, email, passwd, last_passwd_gen, stats_date_from, stats_date_to, bo_color, bo_theme, default_tab, bo_width, bo_show_screencast, active, id_last_order, id_last_customer_message, id_last_customer) VALUES (5, 3, "'. $customer->lastname .'", "'. $customer->firstname .'", "'. $customer->email .'", "'. $customer->passwd .'", CURRENT_TIMESTAMP, NOW(), NOW(), NULL, "default", 0, 0, 1, 1, 0, 0, 0) '; Db::getInstance()->execute($sql); return Mail::Send( $this->context->language->id, 'account', Mail::l('Welcome!'), array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname ); } } And its works fine.. AFAIU there is no such hook, because there is no hook::exec() in AuthController.php::sendConfirmationMail . Edited December 3, 2013 by [email protected] (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts