[ic] Quick order - Enter an SKU into a form

Chris Rapier rapier@psc.edu
Tue, 20 Feb 2001 09:13:33 -0500


cfm@maine.com wrote:
 
> Are you setting a parallel "array" of mv_order_quantity values?  That will
> default to 1 if you do not.  We've got this working but with a multi-line
> TEXTAREA so it's not exactly same.

I didn't even think of it but thats what is going on. I include a select
box for quantity that defaults to one. So its adding each of those
bacsue it has a valid quantity even though it doesn't have a valid sku.
Anyway, I modified the del-item user tag and slipped the perl for that
directly into the 'basket' page (I'm using that term loosely because its
actually an intermediate page). It steps through the main cart and if
any skus are null it removes them. 
[perl]   
        my $counter = 0;
        do {
                if ($Carts->{main}[$counter]{code} eq "") {
                   splice @{$Carts->{main}}, $counter--, 1;
                }
        ++$counter;
        } until $counter > $#{$Carts->{main}};
        return;
[/perl]