Jump to content

Merchandise returns status emails

Recommended Posts



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



Share this post

Link to post
Share on other sites

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.


Edited by PascalVG (see edit history)
  • Like 1

Share this post

Link to post
Share on other sites

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 !!

Share this post

Link to post
Share on other sites

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!




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More