close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

dynamic email message sending on an IF condition of order status

Thread began 8/13/2014 10:46 pm by Christopher West | Last modified 8/14/2014 4:20 pm by Jason Byrnes | 211 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

Sign in to reply to this post

Jason ByrnesWebAssist

looks like that should work.

Sign in to reply to this post

Christopher WestCommunity Expert

Hmm, after testing it does go a bit wrong. what's now happening is it will send blank emails to all the order customers i selected via ticking the check box.

What would I need to do to bug test this?

Sign in to reply to this post

Jason ByrnesWebAssist

your if ... elseif syntax is wrong

correct syntax is:
if(condition) {
do something
} elsif(another condition) {
do something else
} else {
do default action
}


http://php.net/manual/en/control-structures.elseif.php

Sign in to reply to this post

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