close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

dynamic email message sending on an IF condition of order status

Thread began 8/13/2014 7:46 pm by Christopher West | Last modified 8/14/2014 1:20 pm by Christopher West | 474 views | 3 replies

Christopher WestCommunity Expert

dynamic email message sending on an IF condition of order status

Hello, ok I wanted to see if the following method would work before I start adjusting my code and testing.

I have a page where the Admin can update a customers order (this will then update the database and send out an email to that customer, letting them know the current status of their order (the different statuses are: Kit Dispatched, Kit Received, Order in Progress, Order Dispatched and Order Complete) - Side note I need to put in an IF statement so that any customer that has an order status of 'Order Complete' does NOT received an email).

currently in my code I am using Create Email Message server behaviour and in the server behaviour I have ticked the checkbox to use my own php file with HTML layout file (Manage email body from file option).

each of the statuses in the admin has its own page as this displays all those statuses separately but they all use the same email file and the corresponding WAUE_file-name.php thats stored in the webassist/email folder.

What I was wondering is in this WAUE_ file there is a section that is:

php:
//Start Mail Body

$MailBody = $MailBody . "";
$MailBody = $MailBody . (GetFromPage("templates/order-progress.php"));
$MailBody = $MailBody . "";
//End Mail Body



my question is could I wrap a series of IF...IF ELSE statements around the part that reads:

php:
$MailBody = $MailBody . (GetFromPage("templates/order-progress.php"));



so that it checks for the form POST and then loads up a different template?

for example:

php:
if ("".((isset($_POST["order-update"]))?$_POST["order-update"]:"")  ."" == "Kit Dispatched") {


$MailBody = $MailBody . (GetFromPage("templates/order-kit-dispatched.php"));

}

ELSE

if ("".((isset($_POST["order-update"]))?$_POST["order-update"]:"")  ."" == "Kit Received") {  

$MailBody = $MailBody . (GetFromPage("templates/order-kit-received.php"));

}

ELSE

if ("".((isset($_POST["order-update"]))?$_POST["order-update"]:"")  ."" == "Order in Progress") { 

$MailBody = $MailBody . (GetFromPage("templates/order-progress.php"));

}

ELSE

if ("".((isset($_POST["order-update"]))?$_POST["order-update"]:"")  ."" == "Order Dispatched") { 

$MailBody = $MailBody . (GetFromPage("templates/order-dispatched.php"));

}



Would my code example be feasible for what I want to do? or is it totally the wrong approach?

Regards

Chris

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...