[ic] Trying to add products using non-numeric quantities...

Mike Heins interchange-users@lists.akopia.com
Thu Jun 28 09:23:01 2001


Quoting Jeff Carnahan (jcarnahan@networq.com):
> I've found a similar problem when trying to add products using non-numeric
> quantities with the mv_order_item and mv_order_quantity mechanism.
> 
> This concerns 4.6.5, I haven't looked at 4.7.x
> 
> sub add_items in Order.pm properly creates @quantities, however later when
> it comes time to adding the specified quantity to the cart, it uses:
> 
> $quantity = defined $quantities[$j] ? $quantities[$j] : 1;
> 
> (Line #1779)
> 
> So, if the user entered "1a" (as I did to test this) in mv_order_quantity,
> "1a" is assumed to be the price, since it meets the defined criteria.
> 
> I think that after @quantities is determined, in order to remain consistent
> with 4.7.x's behavior of stripping non-numerics, Order.pm should:
> 
> @quantities = map { if (/^=/) { s/\D//g; '=' . $_ } else { s/\D//g; $_ } }
> @quantities;

I will make a change like this in 4.7.x. 4.6.5 will just have to struggle
along....thanks for the suggestion.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Nature, to be commanded, must be obeyed. -- Francis Bacon