zAy Posted February 7, 2013 Share Posted February 7, 2013 Hello, I am trying to stop sending email when a merchandise return state is changed to "return completed", because i'm emailing my customer already a complete mail when i generate a credit slip. Return Completed ID in db is number 5.. so i'm modifying the following within AdminReturnController.php in controllers/admin folder. at line 221: i added the if statement to avoid email being sent when status is 5 if (!$orderReturnState == '5') { Mail::Send((int)$order->id_lang, 'order_return_state', Mail::l('Your order return state has changed', $order->id_lang), $vars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop); } i also tried $orderReturn->state.. but whatever i do.. just the fact of putting the if statement, is cancelling the emails for all statuses. What am i doing wrong. any help is much appreciated. Thanks PS 1.5.3.1 Link to comment Share on other sites More sharing options...
PascalVG Posted February 7, 2013 Share Posted February 7, 2013 (edited) I think it helps if you do this: if (!($orderReturnState == '5')) I think in your line it first calculates "!$orderReturnState" (= False) then compares to 5 (false == '5') being false, so this statement is never done. If you add the brackets, it first checks if $orderReturnStat == '5', and THEN NOTs it using the '!", which is what you want. I hope I'm right here... give it a try. Pascal Edited February 7, 2013 by PascalVG (see edit history) 1 Link to comment Share on other sites More sharing options...
zAy Posted February 7, 2013 Author Share Posted February 7, 2013 Hi Pascal, Thanks, your explanation helped me go further.. Actually it didn't work, this time it kept sending mails for all statuses.. so i tried this: if (!(($orderReturn->state = (int)(Tools::getValue('state'))) == '5')) and it worked ! Cheers !! Link to comment Share on other sites More sharing options...
PascalVG Posted February 7, 2013 Share Posted February 7, 2013 Ha! I didn't go as far as to check the statement itself, just the correctness of the sentence as given... Good that you found it! Cheers, Pascal 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