Jump to content
zAy

Merchandise returns status emails

Recommended Posts

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

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.

Pascal

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!

 

Cheers,

Pascal

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

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