close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Converting ColdFusion CFIF to PHP IF statement

Thread begun 3/13/2009 10:10 am by grantr281040 | Last modified 4/02/2009 1:31 pm by Ray Borduin | 15687 views | 26 replies |

grantr281040

Converting ColdFusion CFIF to PHP IF statement

Hi there!

To stay with ecart I am switching my life from CFM to PHP. In my cart I have a coldfusion IF statement that displays a discount amount (or amount the customer has saved by buying more product) and if the client has not bought enough to qualify for a discount it displays "buy more and save" with a couple price break options.

The question is how do I convert my CFIF statement to PHP to achieve the same result.

Any help is appreciated.

Here is my current code....

<cfif WA_eCart_TotalColumn(CardCart, "TotalDiscount") GT 0>
<br />
<span class="style75 style64"><span class="style54 style76">Congratulations!!! Your Volume Discount <strong>Savings</strong> is... </span></span> <span class="style91">$<cfoutput>#LSCurrencyFormat(WA_eCart_TotalColumn(CardCart, "TotalDiscount"),'none')#</cfoutput>
</span>
<p>
<cfelse>
</p>
<p class="style52 style64 style58"><strong><span class="style78">BUY MORE and SAVE</span><br />
<span class="style75"><span class="style76 style54">Increase your Quantity Now to 50 Cards and Pay Only</span> <span class="style91">$1.38 each </span><span class="style76 style54">!</span><br />
<span class="style76 style54">or get 100 Cards for Only</span> </span><span class="style91">$1.17 each </span><span class="style54 style76"><em>!</em></span></strong><br />
Discounts apply to same card purchases only. <br />
<span class="style81">(Change quantity and click on the &quot;Update Cart&quot; button)</span></p>
</cfif>

Sign in to reply to this post

Ray BorduinWebAssist

<?php
if ($CardCart->TotalColumn("TotalDiscount") > 0) {
?>

Sign in to reply to this post
Did this help? Tips are appreciated...

grantr281040

cool! so what do I repalce </cfoutput> with.

Thanks Ray!

Sign in to reply to this post

Ray BorduinWebAssist

<?php echo($code) ?>

will output the variable $code

Sign in to reply to this post
Did this help? Tips are appreciated...

grantr281040

Man I just can't seem to make it work so I just started over as not to confuse myself with the coldfusion elements.

So what I have is this...

Congratulations!!! Your Volume Discount <strong>Savings</strong> is... </span></span> <span class="style91">$</span><?php echo $GCcart->DisplayInfo("TotalDiscount"); ?><br />
</p>
<p><span class="style52 style64 style58"><strong><span class="style78">BUY MORE and SAVE</span><br />
<span class="style75"><span class="style76 style54">Increase your Quantity Now to 50 Cards and Pay Only</span> <span class="style91">$1.38 each </span><span class="style76 style54">!</span><br />
<span class="style76 style54">or get 100 Cards for Only</span> </span><span class="style91">$1.17 each </span><span class="style54 style76"><em>!</em></span></strong><br />
<span class="style33 style114">Discounts apply to same card purchases only. </span><br />
<span class="style81">(Change quantity and click on the &quot;Update Cart&quot; button)</span></span>


What I want it to say is....

IF TotalDiscount is > 0

Then....

Congratulations!!! Your Volume Discount <strong>Savings</strong> is... </span></span> <span class="style91">$</span><?php echo $GCcart->DisplayInfo("TotalDiscount"); ?><br />



If TotalDiscount is == 0

Then.....

<p><span class="style52 style64 style58"><strong><span class="style78">BUY MORE and SAVE</span><br />
<span class="style75"><span class="style76 style54">Increase your Quantity Now to 50 Cards and Pay Only</span> <span class="style91">$1.38 each </span><span class="style76 style54">!</span><br />
<span class="style76 style54">or get 100 Cards for Only</span> </span><span class="style91">$1.17 each </span><span class="style54 style76"><em>!</em></span></strong><br />
<span class="style33 style114">Discounts apply to same card purchases only. </span><br />
<span class="style81">(Change quantity and click on the &quot;Update Cart&quot; button)</span></span>


Sorry for all the rookie questions but I just haven't gotten my head around this PHP yet.

Thanks,

Grant

Sign in to reply to this post

Ray BorduinWebAssist

What is the problem? Error?

Sign in to reply to this post
Did this help? Tips are appreciated...

grantr281040

All I would bet is...

Parse error: parse error in C:\xampp\htdocs\IndustryGreetings\shopping_cart.php on line 542

Sign in to reply to this post

grantr281040

Sorry...I meant to say all I would GET is...

Parse error: parse error in C:\xampp\htdocs\IndustryGreetings\shopping_cart.ph p on line 542

Sign in to reply to this post

Ray BorduinWebAssist

What is on line 542?

Sign in to reply to this post
Did this help? Tips are appreciated...

grantr281040

Well I've change it now so I am not getting that error but now I do not have an IF statement. I have this...

Congratulations!!! Your Volume Discount Savings is... </span> <span class="style91">$</span><?php echo $GCcart->DisplayInfo("TotalDiscount"); ?><br />
</p>
<p><span class="style52 style64 style58"><strong><span class="style78">BUY MORE and SAVE</span><br />
<span class="style75"><span class="style76 style54">Increase your Quantity Now to 50 Cards and Pay Only</span> <span class="style91">$1.38 each </span><span class="style76 style54">!</span><br />
<span class="style76 style54">or get 100 Cards for Only</span> </span><span class="style91">$1.17 each </span><span class="style54 style76"><em>!</em></span></strong><br />
<span class="style33 style114">Discounts apply to same card purchases only. </span><br />
<span class="style81">(Change quantity and click on the &quot;Update Cart&quot; button)</span></span>



What I want it to say is........

IF TotalDiscount is > 0

Then....

Congratulations!!! Your Volume Discount <strong>Savings</strong> is... </span></span> <span class="style91">$</span><?php echo $GCcart->DisplayInfo("TotalDiscount"); ?><br />



If TotalDiscount is == 0

Then.....

<p><span class="style52 style64 style58"><strong><span class="style78">BUY MORE and SAVE</span><br />
<span class="style75"><span class="style76 style54">Increase your Quantity Now to 50 Cards and Pay Only</span> <span class="style91">$1.38 each </span><span class="style76 style54">!</span><br />
<span class="style76 style54">or get 100 Cards for Only</span> </span><span class="style91">$1.17 each </span><span class="style54 style76"><em>!</em></span></strong><br />
<span class="style33 style114">Discounts apply to same card purchases only. </span><br />
<span class="style81">(Change quantity and click on the &quot;Update Cart&quot; button)</span></span>

Sign in to reply to this post
loading

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