polcoder Posted August 9, 2013 Share Posted August 9, 2013 Hello everyone, Im building a module which will send an email to user and redirect him right after the account is created. Email is fine, it is sent but I have stuck with redirect... here is the code public function hookActionCustomerAccountAdd($params) { ................ Mail::Send($this->context->language->id, 'aktywacja_konta', 'Aktywacja konta klienta', $tplVars, $email , $z['firstname'].' '.$z['lastname'],Configuration::Get('PS_SHOP_NAME'), NULL, NULL, NULL, dirname(__FILE__).'/mails/'); Tools::redirect('http://sklep.pl/some_site.php'); } Can anybody tell me why code runs fine to Mail::Send but stops at Tools::redirect??? Thanks in advance. Link to comment Share on other sites More sharing options...
NemoPS Posted August 9, 2013 Share Posted August 9, 2013 I assume that some_site.php is a placeholder. Can you try redirecting somewhere else, say, to google.com? Also, if it doesn't work, try with header("Location:http://yourpage.com"); Link to comment Share on other sites More sharing options...
polcoder Posted August 9, 2013 Author Share Posted August 9, 2013 Tested both, no result. Link to comment Share on other sites More sharing options...
NemoPS Posted August 9, 2013 Share Posted August 9, 2013 Try die('here I am") If it doesn't work, something's wrong at somepoint before, or pehaps another Mail::Send is firing instead of that one Link to comment Share on other sites More sharing options...
polcoder Posted August 9, 2013 Author Share Posted August 9, 2013 die works great Link to comment Share on other sites More sharing options...
NemoPS Posted August 9, 2013 Share Posted August 9, 2013 hm, so you can't redirect. Are you echoing something before? If so, redirect won't work, try removing any var dump, echo or print_r Link to comment Share on other sites More sharing options...
polcoder Posted August 9, 2013 Author Share Posted August 9, 2013 yes, this is the good clue, its something in the code above couse when i send email only (without code above) than it works. thank you so much... now i know which part is wrong... Link to comment Share on other sites More sharing options...
NemoPS Posted August 9, 2013 Share Posted August 9, 2013 Great! Can I mark this as solved? Link to comment Share on other sites More sharing options...
polcoder Posted August 9, 2013 Author Share Posted August 9, 2013 yes, thanks again Link to comment Share on other sites More sharing options...
Recommended Posts