[ic] pricing help needed

Mark Weaver mdw1982 at mdw1982.com
Fri Mar 18 11:08:18 EST 2005

Peter wrote:
> On 03/18/05 06:43, Mark Weaver wrote:
>> Here's what I've got now for the CommonAdjust directive:
>> CommonAdjust    products:price, -50%, ;$,
>> ==products, "&($item->{prod_group}=~/Gifts/ ? 0 : '-20%')"
>> The problem I'm running into is that "first" it applies the 50% 
>> discount to the item's retail price and then applies the 20% discount 
>> on top of that. I'm still working on wraping my brain around 
>> everything thats going on with CommonAdjust, atoms and the like, so 
>> its not all making sense yet.
>> At any rate, now for all items who have a prod_group value of "Gifts" 
>> I've got a 70% discount happening. Might you have an idea where I'm 
>> going wrong?
> Take out the first -50% and replace the 0 in your if operation with it 
> (the ( ... ? ... : ... ) is an if statement).
> Peter

Ok... I have *got* to be missing something here. The CommonAdjust is now 

CommonAdjust    :sale_price, ;:price, ;$,
==products, "&($item->{prod_group}=~/Gifts/ ? '-50%' : '-20%')"

the "-50%" value appears to get ignored and 20% discount is being 
applied to all items even though I'm telling it "if the product group is 
*Gifts*." If I reverse to the two discount percentages then 50% discount 
is applied to all items.

At the moment I'm feeling dumber than a stump, but I do very much 
appreciate your assistance and indulgence.

BTW... I tried using the grouping regex looking at the sku:
==products, "&($item->{sku}=~/^(?:90|40|94)/ ? '-50%' : '-20%')"
but received the same results and behavior as mentioned above. The only 
thing it appears to be acting on is the "last" discount value that 
appears in the expression.

Paid for by Penguins against modern appliances(R)
Linux User Since 1996
Powered by Mandrake Linux 8.2, 10.0 & RH Fedora Core 3

More information about the interchange-users mailing list