MiniVend Akopia Services

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

RE: MV3:12 Discount Help Needed/ Gift Certificate



******    message to minivend-users from "Russ" <russ@khouse.org>     ******

How can I get the discount variables to scope correctly?  I've tried using
the [set] and [scratch] methods, but can't get that to work.

Here's an example of something else I tried:

[set currbal]
[data base="userdb" field="balance" key="[data session username]"]
[/set]
[perl]
if ([subtotal] > [scratch currbal])
{
[set discamt][scratch currbal]
}
if ([subtotal]<[scratch currbal])
{
[set discamt][subtotal][/set]
}
[/perl]
[discount ENTIRE_ORDER]$s-[scratch discamt][/discount]
[/if]

This just returned errors like this:
xxx.xxx.xxx.xxx 3gyda9C4:xxx.xxx.xxx.xxx - [04/May/1999:09:45:25 -0700]
newcb /shop/
newcb/ord/basket Discount ENTIRE_ORDER has bad formula. Returning normal
subtota
l.
> Can't locate object method "scratch" via package "discamt" at (eval 95)
line 1
.
>

Any more clues?

Russ

-----Original Message-----
From: owner-minivend-users@minivend.com
[mailto:owner-minivend-users@minivend.com]On Behalf Of Ryan Hertz
Sent: Monday, May 03, 1999 4:55 PM
To: minivend-users@minivend.com
Subject: Re: MV3:12 Discount Help Needed/ Gift Certificate


******    message to minivend-users from Ryan Hertz <rhertz@gyb.baits.com>
******

At 04:18 PM 5/3/99 , Russ wrote:
>******    message to minivend-users from "Russ" <russ@khouse.org>
******
>
>Hello,
>
>I am trying to implement a gift certificate system on a minivend store.  I
>am tyeing the gift certificate to a login name on the userdb.  Incidently,
I
>give users a $5.00 discount just for creating an account, which I put in
>their userdb file as a gift certificate.  This isn't the hard part.  The
>hard part is getting the gift certificate amount to discount on the order.
>The logic I have in place is this:
>
>[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]
>
>This checks to make sure the subtotal is greater than the balance of their
>account (gift certificate amount).  It makes the discount amount no larger
>than the subtotal and no larger than the balance of the account.
>
>The most recent problem I'm having is the discount ENTIRE_ORDER doesn't
>carry through the checkout process.  It only shows up on the basket.html
>page where I originally code it.  The only way to get the discount to show
>up for the entire order is to put this code on every page in the checkout
>process, including the report and reciept.  That doesn't jive with the
>documentation, which indicates 'once discounted, always discounted'.

Your variables are not scoping correctly - I imagine that inside a [calc]
routine minivend will assume the variables to be local.  ??

>
>Any ideas?  Another problem is how to carry a value in the session to
>multiple pages.  I want the $currentbalance and $discountamount to be
>carried to more pages than the basket.html.  I'll need the discountamount
at
>the reciept page so I know how much to decrement the gift certificate field
>in the userdb.
>
>Thanks in advance for any help,
>
>Russ
>--------------------------
>Earn Money to surf the Internet Click Here!
>http://www.alladvantage.com/refhome.asp?refid=AWW-495


Ryan Hertz                                              tel  520-645-3812
Webmaster                                               tel  800-645-BAIT
Advertising Director                                    fax  520-645-2588
Gary Yamamoto Custom Baits, Inc.            http://www.yamamoto.baits.com
-
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


Search for: Match: Format: Sort by: