[ic] [delete-checked] and 5.2

Grant emailgrant at gmail.com
Thu Oct 7 15:31:25 EDT 2004


I'm using the delete-checked usertag, but it doesn't seem to work well
when deleting more than one line-item from the cart at a time.  It
only ends up deleting one and it leaves a strange blank-titled and
$0.00-priced item in the cart.  The tag was originally written for 4.6
but it says it should work in all future versions.

The tag is very short, does anyone see any reason it might have
problems like this in 5.2:

-----
UserTag delete-checked Order cart
UserTag delete-checked PosNumber 1
UserTag delete-checked addAttr
UserTag delete-checked Routine <<EOF
sub {
    my $cart = shift || 'main';
    my $opt = shift;
    my $key;
    my $counter = 0;
    my $removed = 0;
    foreach $key (keys %{ $CGI }) {
        next unless $key =~ s/^\^\^DELETE_//;
        do {
            if ($Carts->{$cart}[$counter]{code} eq $key) {
                $removed++;
                splice @{$Carts->{$cart}}, $counter--, 1;
            }
            ++$counter;
        } until $counter > $#{$Carts->{$cart}};
    }
}
EOF
-----

Here's the original link to the tag:

http://www.icdevgroup.org/pipermail/interchange-users/2001-April/007099.html

- Grant


More information about the interchange-users mailing list