[ic] pricing help needed

Peter peter at pajamian.dhs.org
Fri Mar 18 18:17:57 EST 2005

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 
(scroll down to the bit referncing &.


More information about the interchange-users mailing list