MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Doing a search using a scratch variable as the key



I am running minivend 3.12 on Red Hat Linuix 5.2.  I plan to have a mall
where  merchants can give points/stamps to their customers for purchases and
to their affiliates for refering customers. I am at the  beginning of
learning minivend.  I have the following code in a new report that is run
when a merchant manually gives stamps/points to a customer: I have added the
field "sponser" to userdb to track the sponser of a customer. "fv_shopperID"
is from the previous form where the merchant can assign points/stamps to
customer. The merchant (who is logged in as the user) is assigning
points/stamps to a customer "fv_shopperID' who has a sponser who needs to
receive bonus points/stamps.

[set sponserID interpolate=1][data
        table=userdb
        column=sponser
        key="[value fv_shopperID]"
][/set]

This seems to return the proper sponserID of the shopper making a purchase
and being assigned points. Now I need to assign the bonus points to the
sponser/affiliate. Later in the report I have the following code.

[data
        table=userdb
        column=totalstamps
        key=[scratch sponserID]
        value="[calc interpolate=1][subtotal
noformat=1]*__AFFILIATELEVEL1__[/ca
lc]"
increment=1
]

"totalstamps" is a field I have added to userdb to reflect the total number
of points/stamps a customer has in his account. "subtotal" is the actual
number of stamps/points to give. ( In effect the merchant is ordering stamps
from our store). I can not get the data routine to accept the "[scratch
sponserID]" even though it seems to interpolate properly and appears in the
report and receipt. "__AFFILIATELEVEL1__ " is the variable set in
catalog.cfg that determines what percentage of "override" to give to the
affiliate or sponser.

What I am trying to do is to lookup the sponser of a customer and to give
the sponser bonus points/stamps.
When I manually put an actual customer in the  key  such as:
key="customer1".  Then the report routine works and assigns the bonus points
to customer1.  But when I try to put in the results of a database lookup I
can not get it to work.

I am sure that there is a much better way to do this.  However, .I am trying
to learn minivend and this logically appears to me it should work.  Can you
use a scratch variable in the key of a data statement?  How do I pass a the
result of a search (finding who is the sponser of a customer) to the key
field so I can then add bonus points/stamps to the sponsers totalstamps
field.

I am very impressed with minivend and its capabilities.  However, it does
take a while to understand what is going on.

Jimmy Eaton
jeaton@swampsucka.com






Search for: Match: Format: Sort by: