X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Need If statement help! (https://forum.x-cart.com/showthread.php?t=54977)

sharingsunshine 08-09-2010 09:02 AM

Need If statement help!
 
Hello,

I have a function for displaying a message if certain shipping criteria are met.

1. shipping address isn't blank
2. they have put PO box in their ship to
3. they haven't already selected Parcel Post

{if $po_address ne "" and $cart.shippingid ne "51"} this works fine. Now I have a new method of shipping that I have to test for called Mail Innovations.

So this is what it needs to test for

1. shipping address isn't blank
2. they have put PO box in their ship to
3. they haven't already selected Parcel Post or Mail Innovations - if they have no need to show warning.

I have tried several ways to test for it but they don't seem to be working

{$userinfo.s_address} {if $po_address ne "" and ($cart.shippingid ne "122" or $cart.shippingid ne "51")}

Can someone tell me what I am doing wrong?

Thanks,

Randal

hooter 08-09-2010 09:37 AM

Re: Need If statement help!
 
Try changing your boolean constructs - your current method of using an "or" conjunction to test for "not equals" condition will not give you desired results.
Change:
Code:


{$userinfo.s_address} {if $po_address ne "" and ($cart.shippingid ne "122" or $cart.shippingid ne "51")}

to this:
Code:


{$userinfo.s_address} {if $po_address ne "" and ($cart.shippingid eq "122" or $cart.shippingid eq "51")}{else}DISPLAY WARNING{/if}


sharingsunshine 08-09-2010 10:30 AM

Re: Need If statement help!
 
Thanks that was a big help.


All times are GMT -8. The time now is 12:00 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.