[ic] [delete-checked] and 5.2

Grant emailgrant at gmail.com
Thu Oct 7 16:26:08 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
> >
> 
> Did you set your basket code up according to the original post?
> 
> - Ed

I've got it set just right, but it won't work when trying to delete
more than one item at a time.  Here's what I have:

-----
[item-list]
   <tr>
      <td>[item-field title]</td>
      <td>[item-price]</td>
      <td><input class="small_padding" type="text"
name="[quantity-name]" value="[item-quantity]" size="3" maxlength="2"
/></td>
      <td class="padding">[item-subtotal]</td>
      <td class="padding"><input type="checkbox"
name="^^DELETE_[item-code]" value="1" /></td>
   </tr>
[/item-list]
-----

[delete-checked] is at the top of the page.

- Grant


More information about the interchange-users mailing list