[ic] discount based on total quantity ordered

Paul Jordan paul at gishnetwork.com
Wed Mar 24 19:03:28 EST 2004


webteam at wes-state.com wrote:
> Good day list
>
> I'm trying to figure out how to discount the ENTIRE_ORDER if different
> quantity of items are ordered. I have different discounts if the user
> has order 2,3, or 4 total items I have placed in catalog.cfg
>
> [if type=explicit compare="[calc][nitems] == 2 [/calc]"]
>     [discount ENTIRE_ORDER]$s - 20.00[/discount]
> [else]
>     [discount ENTIRE_ORDER][/discount]
> [/else]
> [/if]
> [if type=explicit compare="[calc][nitems] == 3 [/calc]"]
>     [discount ENTIRE_ORDER]$s - 50.00[/discount]
> [else]
>     [discount ENTIRE_ORDER][/discount]
> [/else]
> [/if]
> [if type=explicit compare="[calc][nitems] == 4 [/calc]"]
>     [discount ENTIRE_ORDER]$s - 65.00[/discount]
> [else]
>     [discount ENTIRE_ORDER][/discount]
> [/else]
> [/if]
> but this really doesn't work correctly
>
> Also, how do I get this discount amount to appear on the
> basket/checkout page?
>
>
> REDHAT 7.2
> IC 5.0


That is just not right. This type of code belongs in a processing page, or
checkout page. However, look at the code. Only a 4 item cart will get
discounted correctly. Each subsequent checks "else" wipes all your hard work
away.

You need to rethink your flow of if-else's. There are alot of better ways to do
this, but if you can get your above code to work, it will benefit you great in
understanding ITL.

One hint would be to use your code as a in-between process page. Delete ALL you
"else" statments except for the last one, and after each successful
[discount]foo[/discount] pair, place a [bounce foo] to stop processing further
checks.


Paul



More information about the interchange-users mailing list