[ic] discount ALL_ITEMS based on DB entry

Brian Kosick interchange-users@interchange.redhat.com
Fri May 31 14:40:02 2002


Hello Everyone,
         Once again, I'm asking the list for help.  On my site, I have 
implemented a Global discount based on variable that the client/admin can 
change through the admin interface.  It works fine, and works just like it 
should according to clients original specs.  Here's my code.

[if scratch threefor1act eq "y"]
         [discount code="ENTIRE_ORDER" interpolate=1]$s * [scratch 
threefor1dis][/discount]
[elsif scratch twofor1act eq "y"]
         [discount code="ENTIRE_ORDER" interpolate=1]$s * [scratch 
twofor1dis][/discount]
[/elsif]
[/if]

They would like to have a new column in the db called disc_exempt that they 
can put a value in to have it NOT included in the discount.  Based on what 
I've understand and have read on the discount function, I should be able to 
do something like this.

[if scratch threefor1act eq "y"]
         [discount code="ALL_ITEMS" interpolate=1]
         return $s if [item-field disc_exempt] eq "y";
         return $s * [scratch threefor1dis];
         [/discount]
[/if]

However, I get errors that look like this.

Discount for GADAS has bad formula. Not applied.
 > Can't locate object method "field" via package "disc_exempt" (perhaps 
you forgot to load "disc_exempt"?) at (eval 636) line 2.

So it seems to me that IC doesn't like the item-field tag inside the 
discount tag, however, in examples, I've seen things like item-code used 
inside of discount.
Has anyone implemented something like this before?


Brian Kosick
Web Programmer
New Age Consulting Service, Inc.
216-619-2000
briank@nacs.net