Quoting Randy Moore (ramoore@axion-it.net):
> Hello all,
>> I've been having trouble getting the Mix and Match feature to work as I
> thought it should using the price_group feature (but maybe I'm
> misunderstanding the intent here). So, I started tracing through the code
> of the chain_cost & tag_nitems subroutines to see what was happening.
>> It appears that for the Mix and Match to work, we have to use non-digits to
> define the groups in the pricing:price_group field. According to lines
> 1289-90 of Data.pm in the chain_cost subroutine:
> $regex = $item->{$attribute}
> unless $item->{$attribute} =~ /^[\d.]+$/;
No, this is as intended. I will admit the reasoning behind the code
is a bit obscure...I can't remember how I documented it, but when
checking it appears that the entire description of how CommonAdjust
atoms work was removed from the docs. I will check on that....
It is intended to operate as a boolean grouping only if the price group is
a number. The $regex is passed to the tag_nitems function, which if
that is not defined (as it would be if the contents were only a number)
then it just groups the items if they are non-zero, and exempts
them from grouping if the value is 0.
In other words, if the group is a number the only values that pertain
are the absolute values 0 and 1 in the sense of true and false. If the
absolute value is 1 or any non-zero number, the Mix/Match is applied,
and if it is 0 the item is not applicable to Mix/Match.
If the contents have a non-digit/non-decimal, then they can be used
as a regex like /jewelry.*/ to group all jewelry items. If there are
no special characters, it is equivalent to an "eq" operator.
I think it is also quite possible you are being bitten by a problem
with the field definitions in the construct skeleton (which has now
been corrected in CVS) whereby the field type of price_group is char(2)
and the price group may not work with some values.
As I look at this, I think I tried to get too fancy. I often do that. 8-\
--
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH 45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>
Any man who is under 30, and is not liberal, has not heart; and any man
who is over 30, and is not a conservative, has not brains.
-- Winston Churchill