[ic] pricing help needed

Mark Weaver mdw1982 at mdw1982.com
Fri Mar 18 09:43:30 EST 2005


Peter wrote:
> On 03/17/05 17:11, Mark Weaver wrote:
> 
>> Peter wrote:
>>
>>> CommonAdjust    :sale_price, ;:price, ;$, ==:options, 
>>> "&($item->{code}=~/^(?:FM|WS(?:30|35|40|45))/ ? 0 : '-20%')"
>>
>>
>> I was wondering if you could walk me through your regex. I've never
>> seen one like this before and i'm not sure exactly what its saying.
> 
> 
> It's matching against the item sku.  ^ matches against the beginning of 
> a line, so it means start the match at the beginning of the sku, () is 
> grouping, the ?: means to not save the match inside the grouping and | 
> separates multiple possibilities.  So basically it's saying to match 
> against a sku that either begins with FM or begins with WS followed 
> immediately by one of 30, 35, 40 or 45.  For more information about perl 
> regular expressions see <http://search.cpan.org/dist/perl/pod/perlre.pod>.
> 

Thank you Peter. That all makes good sense to me now. some of it I 
recognized, while other parts weren't quite as familiar.

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?

-- 
Mark
-----------------------------------------------------------
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