Allow visitor to remove items from their cart. Fixes bug #11667

This commit is contained in:
Colin Kuskie 2010-06-22 08:27:38 -07:00
parent da320a0313
commit 8283243823
2 changed files with 10 additions and 6 deletions

View file

@ -6,6 +6,7 @@
- fixed #11628: Message Board: Last Post doesn't show up in CS Thread List
- fixed #11646: Post and Thread Last Post
- fixed #11626: Duplicate messages from Collab Systems
- fixed #11667: Shop: unable to remove item from Cart
7.9.7
- added #11571: Allow return from photo edit view to gallery edit view

View file

@ -762,6 +762,15 @@ sub updateFromForm {
$error{id $self} = $i18n->get('mixed items warning');
}
my @cartItemIds = $form->process('remove_item', 'checkList');
foreach my $cartItemId (@cartItemIds) {
my $item = eval { $self->getItem($cartItemId); };
$item->remove if ! Exception::Class->caught();
}
##Visitor cannot have an address book, or set a payment gateway, so skip the rest of this.
return 1 if $session->user->isVisitor;
my $book = $self->getAddressBook;
my $cartProperties = {};
@ -825,12 +834,6 @@ sub updateFromForm {
$cartProperties->{ shipperId } = $form->process( 'shipperId' ) if $form->process( 'shipperId' );
$cartProperties->{ gatewayId } = $form->process( 'gatewayId' ) if $form->process( 'gatewayId' );
$self->update( $cartProperties );
my @cartItemIds = $form->process('remove_item', 'checkList');
foreach my $cartItemId (@cartItemIds) {
my $item = eval { $self->getItem($cartItemId); };
$item->remove if ! Exception::Class->caught();
}
}
#-------------------------------------------------------------------