[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Partly SOLVED: Account Balance/Gift Certificate/Discount MV:3.12
****** message to minivend-users from "Russ" <russ@khouse.org> ******
I still need to work on the backend, but--
Here's the code I'm using to deal with the discounts:
[if session logged_in]
<!--
[calc]
$currentbalance = [data base="userdb" field="balance" key="[data session
username]"]
[/calc]
[calc]
if ([subtotal] > $currentbalance)
{
$discountamount = $currentbalance
}
if ([subtotal]<$currentbalance)
{
$discountamount = [subtotal]
}
[/calc]
-->
[discount ENTIRE_ORDER]$s-$discountamount[/discount]
[/if]
****** message to minivend-users from "Russ" <russ@khouse.org> ******
Hello,
I am working to implement a gift certificate system. I am tying a gift
certificate to the userdb login to account for these things:
1. Multiple gift certificates.
2. Not spending the whole thing at once.
3. Maintaining 'Account Balances'.
4. Transfering Account Balances from the affiliate program.
I have setup a field in the userdb called 'balance'. When someone first
logs in, they get 5 buck added to their balance.
I do that with this code:
<!--
[calc]
$currentbalance = [data base="userdb" field="balance" key="[data session
username]"]
[/calc]
[data
table=userdb
column=balance
key="[data session username]"
value=" [calc]$currentbalance+5[/calc]"
append=1]
[tag export userdb][/tag]
-->
Works like a charm. Now I want to actually discount an order using this
balance from the userdb 'balance' field. The code I have written for the
basket.html page is this:
[calc]
$currentbalance = [data base="userdb" field="balance" key="[data session
username]"]
[/calc]
[if explicit]
[condition]
return 1 if $currentbalance > 0;
return 0;
[/condition]
[if explicit]
[condition]
return 1 if $s >= $currentbalance;
return 0;
[/condition]
$discountamount = $currentbalance
[else]
$discountamount = $s
[/else]
[/if]
[discount ENTIRE_ORDER] $s - $discountamount [/discount]
[/if]
And to display the discount I use this code:
[if discount ENTIRE_ORDER]Credit of
$[currency][calc]$discountamount[/calc][/currency] for this order.[/if]
The problem I'm having is with the code to calculate the discount and
implement it. This is what I get in the error.log:
xxx.xxx.xxx.xxx 9HzwfpnS:xxx.xxx.xxx.xxx - [29/April/1999:10:34:55 -0700]
newcb /sho
p/newcb/ord/basket Bad if '0 ': No such comparison available
xxx.xxx.xxx.xxx 9HzwfpnS:xxx.xxx.xxx.xxx - [29/April/1999:10:34:55 -0700]
newcb /sho
p/newcb/ord/basket Bad if '0 ': No such comparison available
There are two identical entries in the error.log and the discount does not
get calculated.
Any clues? Is the [if explicit] the wrong way to implement the logic?
Anyone else doing this? I only want it do have a discount if there is money
in the account, and I don't want it to discount more than the actual amount
of the order!
Thanks,
Russ
--------------------------
Earn Money to surf the Internet Click Here!
http://www.alladvantage.com/refhome.asp?refid=AWW-495
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to
Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list