[ic] IC 4.6.1 possible bug & fix for price_group feature

Randy Moore ramoore@axion-it.net
Sat, 13 Jan 2001 15:53:10 -0500

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.]+$/;

This leaves $regex (which contains the group to match) blank if the 
price_group field contains only digits.

But, the example given in the 'simple' demo explicitly uses digits to 
define the groups.  (And, according to my testing, the 'simple' demo does 
treat all products as being in one big group despite there being different 
values in the price_group fields for various products.)

But if I change ALL the values in the price_groups fields to letters rather 
than digits, the Mix and Match groups work like I think they should.

Any item with just digits in it's price_group field will be group with all 
products in the cart that have ANY value at all (digits or not) it the 
price_group field.


I think that changing  lines 1289-90 of Data.pm in the chain_cost 
subroutine to the following should allow the price_groups to work properly:
   $regex = $item->{$attribute}
            unless $item->{$attribute} =~ /^$/;
or maybe just:
   $regex = $item->{$attribute};
	(I don't think we get this far if the $item->{$attribute} is blank.)

Or, am I misunderstanding how this is supposed to work?  Maybe it is 
intended to only allow letters in the price_groups, but then why does the 
demo use digits?

Any comments or corrections would be much appreciated.
Randy Moore
Axion Information Technologies, Inc.

email     ramoore@axion-it.net
phone   301-408-1200
fax        301-445-3947