[ic] subtotal changing with total

Ed LaFrance edl@newmediaems.com
Mon, 06 Nov 2000 09:27:54 -0800


Sim -

Yeah, things are rarely as simple as we would like them to be.  This is why 
I suggested doing the discount on the final checkout page - that way it 
would most likely only be evaluated once, as intended, but this is not 
bullet proof.

Probably what you will want to do is calculated an un-discounted total for 
purposes of comparision.  You could do this on the basket or checkout page 
within the item list:

[set full_total][/set]
[item-list]
         [seti full_total][calc]
                         [scratch full_total] +
                         ([item-price noformat=1]*[item-quantity])
                         [/calc][/seti]
[/item-list]

...then substitute [scratch full_total] for [subtotal noformat=1] in the if 
block. You may also want to "reset" the discount at each level in the if, 
so that discounts don't aggregate:

[if type=explicit compare="[calc][scratch full_total] >= 350[/calc]"]
         [discount ENTIRE_ORDER][/discount]
         [discount ENTIRE_ORDER]$s - 150[/discount]
...
[/if]

I haven't played with discounts in interchange, but in earlier versions of 
Minivend, a discount was persistent for the whole session, so if someone 
got a discount, placed their order, and then immediately began another 
order, the discount was still there, and would immediately be applied as 
soon as they had something in their basket!  To prevent this, reset the 
discount at the bottom of the receipt page:

[discount ENTIRE_ORDER][/discount]

- Ed L.



At 09:58 AM 11/6/00 -0500, you wrote:
>I have added code to my basket page to apply a discount and change the 
>total cost using the following code:
>
>     [if type=explicit compare="[calc][subtotal noformat=1] >= 350[/calc]"]
>          [discount ENTIRE_ORDER]$s - 150[/discount]
>
>The problem is it changes the subtotal also. I would like the subtotal to 
>stay the same, that being the sum of all the items purchased. The problem 
>I am having is the after the discount is applied the subtotal might be 
>less then the discount price, so when the user goes back to the basket 
>page it recalculates the discount and decides it doesn't apply so it takes 
>it away. The next time they come to the page the subtotal is once again 
>above the discount price so it applies the discount.
>
>Is there a way to change the total cost without changing the subtotal?
>Currently I am handling this in the basket. Would it be better to handle 
>this on the checkout page? I would prefer the basket,  so the user can see 
>what discounts he has before going to the checkout page, but I can wrote 
>code to make it look like the discount is on the basket and in reality 
>take it off on the checkout page. That just seems like a lot of extra work.
>
>Any thoughts are greatly appreciated
>
>Sim
>
>
>_______________________________________________
>Interchange-users mailing list
>Interchange-users@www.minivend.com
>http://www.minivend.com/mailman/listinfo/interchange-users

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