Gossamer Forum
Home : Products : DBMan : Customization :

If greater than or equal to then...

Quote Reply
If greater than or equal to then...
I want to check that a $rec{'quantity'} is equal to or greater than $rec{'min_quantity'}. If so print $rec{'reg_price'}, if not print $rec{'qty_price'}.
Quote Reply
Re: If greater than or equal to then... In reply to
Code:
if ($rec{'quantity'} >= $rec{'min_quantity'}){
print $rec{'reg_price'};
}
else {
print $rec{'qty_price'};
}

Although it seems from your field names that the conditions should be reversed. But the above is what you said in your post.


------------------
JPD

All my advice is offered on the basis of kindness-ware. If I've helped you to solve a problem, go out of your way to be kind to someone today.

Quote Reply
Re: If greater than or equal to then... In reply to
Ok! This works great!
NOW!

How can I say "$total_price = (If $rec{'qty_price'} then $rec{'qtyprice'} x $rec{'quantity'}

Else $rec{'reg_price'} x $rec{'quantity'})"
Quote Reply
Re: If greater than or equal to then... In reply to
Code:
if ($rec{'qty_price'}) {
$total_price = $rec{'qty_price'} * $rec{'quantity'};
}
else {
$total_price = $rec{'reg_price'} * $rec{'quantity'};
}

I still think what you said before was backwards. People ought to just get the qty_price if they are ordering at least the min_quantity, right? If that's what you want to do, you can put these two routines together:

Code:
if ($rec{'quantity'} < $rec{'min_quantity'}){
print $rec{'reg_price'};
$total_price = $rec{'reg_price'} * $rec{'quantity'};
}
else {
print $rec{'qty_price'};
$total_price = $rec{'qty_price'} * $rec{'quantity'};
}
print $total_price;


------------------
JPD

All my advice is offered on the basis of kindness-ware. If I've helped you to solve a problem, go out of your way to be kind to someone today.