[ic] pricing help needed

Mark Weaver mdw1982 at mdw1982.com
Fri Mar 18 22:14:28 EST 2005

Peter wrote:
> On 03/18/05 08:08, Mark Weaver wrote:
>> Ok... I have *got* to be missing something here. The CommonAdjust is 
>> now this:
>> 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.
> I think you need to have UseModifier prod_group above the CommonAdjust 
> but not exactly sure or even if that's how you access it.  Try it, 
> though.  Worst case scenario you can use the &tag_data function to fetch 
> the prod_group value from the db.
>> 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.
> Use $item->{code} instead.
> Keep in mind that $item is not a direct refernce to the products 
> database.  You need to either explicitly include ceartain fields with 
> UseModifier or fetch them with &tag_data().  I know of only these fields 
> that are included by default: code, quantity, price, and any attributes 
> (code being the sku).
> See <http://www.interchange.rtfm.info/docs/rtfm_ic_ecommerce.html> and 
> specifically 
> <http://www.interchange.rtfm.info/docs/frames/ic_ecommerce_11.html> 
> (scroll down to the bit referncing &.
> Peter

Hi Peter,

thank you SO much for your help. That last one got it. Placing the 
UseModifier in there I mean. I switched the discount percentages around 
and am using the regex grouping to test for specific sku numbers. Its 
finally working like a charm. You ROCK!

Thanks again.

UseModifier prod_group
CommonAdjust    :sale_price, ;:price, ;$, ==products,
"&($item->{code}=~/^(?:90|94|40)/ ? '-20%' : '-50%')"

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