[ic] Keeping track of how much a user has spent...

Ed LaFrance interchange-users@interchange.redhat.com
Tue Jan 22 15:13:01 2002


At 12:14 PM 01/22/2002 -0700, you wrote:
>Hello,
>
>I want to keep track of how much money a user has spent on my store in his
>userdb record.  In the log_transaction file, I figured I could hijack the
>credit_limit function and just reverse it.
>
>There is a line like this:
>[seti total_cost][total-cost noformat=1][/seti]
>
>then the Add main order data lines...
>
>Then this:
>
>set credit_limit: [seti credit_limit][data
>                 table=userdb
>                 col=credit_limit
>                 key="[data session username]"
>                 value="[scratch total_cost]"
>                 increment=1
>                 ][/seti]
>
>Seems like it would work right?  Well, it doesn't.
>
>I think it has something to do with a [userdb save] going on in the
>receipt.html file (to make sure that all the users newly entered data is
>saved), possibly overwriting the value with the old scratch value.  Is there
>a better way to do this?
>
>-Russ

That's probably right. I guess your options would be:

1. move the above code so that it is parsed after the [userdb save], and 
add a [userdb load] thereafter to update the values hash;

2. Leave the code in place, but add this immediately after:

[value name=credit_limit set="[scratch credit_limit]" hide=1]

- Ed L.



===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================