Hello David,
In /html/product.php you use excellent IF construction what allows to show a field if, for example, field ["coupon"] is not empty
{code saved}
Is it possible to extend this code to print something detecting the values of TWO fields with OR/AND terms, for example
{code saved}
will print End Date if BOTH fields ["coupon"] AND ["voucher_code"] are not empty.
Another variant with OR, for example
{code saved}will print End Date if ANY of the fields ["coupon"] AND ["voucher_code"] are not empty.
Thanks in advance for the hint useful for all PT community !
Have a nice weekend !
Best regards,
Serge
Hello David, thank you very much, now I've catch the right syntax.
Let me extend a little my question to finalize the matter - what is correct code syntax for the condition - IF price equal to 0.00
<?php if($product_main["price=0.00"]: ?>
Hi,
In PHP, "==" is the comparison operator, so you would use:
<?php if($product_main["price"] == "0.00"): ?>
Cheers,
David.
--
PriceTapestry.com
Dear David, thanks a lot for your support !
With such a small code changes your PriceTapestry is very flexible for content creation !
Best regards,
Good morning, David !
One more question about this topic and PHP PT syntax - is it possible to detect the term IF EMPTY ?
Because
<?php if($product_main["voucher_code"] && $product_main["coupon"]): ?>
detects IF both fields are NOT EMPTY - then do something.
But how to use the same code but vise versa ? - IF both fields ARE EMPTY - then do something.
As always, thanks a lot in advance for a tooltip !
Best regards,
Serge
Hello Serge,
Prefix each expression with "!" (the NOT) operator to detect if both empty, e.g.
<?php if(!$product_main["voucher_code"] && !$product_main["coupon"]): ?>
Cheers,
David.
--
PriceTapestry.com
Thanks a lot for the hint, everything works in a perfect way.
Have a nice day !
Best regards,
Serge
Hello Serge,
In PHP, logic AND is && and logic OR is || so you could use as the IF conditions, for example:
<?php if($product_main["voucher_code"] && $product_main["coupon"]): ?>
~or~
<?php if($product_main["voucher_code"] || $product_main["coupon"]): ?>
Cheers,
David.
--
PriceTapestry.com