close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Can't use a php IF test in UniversalEMail?

Thread began 12/13/2010 7:04 pm by SaladoGuy | Last modified 12/16/2010 9:45 am by SaladoGuy | 1338 views | 8 replies

SaladoGuyBeta Tester

Can't use a php IF test in UniversalEMail?

Hello,

For almost a week I've been working on this simple problem and can't figure it out ...

On this website that I'm building (done with eCart and other WA extentions), customers buy classes. It may be a one day class or a multi-day class. In the email confirmation receipt it is important for the customer to see the dates of the class they just bought so they know when to show up :-)

It's easy enough to print both dates:

<?php //echo $eCart1->DisplayInfo("Date"); . " - " . $eCart1->DisplayInfo("Through"); ?>


( FYI $eCart1->DisplayInfo("Through") is a cart attribute that I created and it does work, perfectly, everywhere else on the site )

I can also assign those dates to variables and format them nicely:

$bdate = $eCart1->DisplayInfo("Date");
$edate = $eCart1->DisplayInfo("Through");
print date('l F jS, Y', strtotime($bdate));

And all of that works great both on the site pages and in the confirmation email. The email is a UE4 object, but I believe it was created as part of the eCart checkout wizard.

With these functions I can get a nice looking date such as:

Thursday December 21st, 2023
through —
Fri., Dec. 22nd


The breakdown occurs on one-day classes. I don't want to print 2 dates on the one day classes, it looks bad and confuses the customers.

On the php web pages this is is to do, I simply put the "through -" and the second date inside an if statement and only display them if the start date and end dates don't match:


<?php //echo $eCart1->DisplayInfo("Date"); . " - " . <?php echo $eCart1->DisplayInfo("Through"); ?>
<?php
$bdate = $eCart1->DisplayInfo("Date");
$edate = $eCart1->DisplayInfo("Through");
print date('l F jS, Y', strtotime($bdate));
//echo $eCart1->DisplayInfo("Date");

if ($bdate != $edate) { // Show if date doens't match
print "<br /><em>&nbsp;&nbsp; through &nbsp; &mdash;</em><br />" . date('D., M. jS', strtotime($edate));
//print "&nbsp;-&nbsp;to&nbsp;-&nbsp;" . date('D., M. jS', strtotime($edate));
} // Show if date doens't match
?>

However, not matter what I try, I cannot get an if statement to work correctly in an email.

I've tried all kinds of things, my last try was:



<?php if ($bdate != $edate) { echo "does not match"; }?>
<?php if ($bdate == $edate) { echo "does match"; }?>
<?php if ($bdate != $edate) { print "does not match"; }?>
<?php if ($bdate == $edate) { print "does match"; }?>

<!--Show if date doens't match-->
<?php if ($eCart1->DisplayInfo("Date") != $eCart1->DisplayInfo("Through")) { "<br /><em>&nbsp;&nbsp; through &nbsp; &mdash;</em><br />" . date('D., M. jS', strtotime($edate)); }?>
<?php // alternate print line:// print "&nbsp;-&nbsp;to&nbsp;-&nbsp;" . date('D., M. jS', strtotime($edate)); ?>
<!--Show if date doens't match-->

Does anyone know how to do this in an email?

Thanks

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