From 36f818ed5e984d5f0e85be3f68defc76ca509f5b Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 30 Aug 2011 08:45:57 -0700 Subject: [PATCH] Check for mixed items in the cart AFTER processing delete requests. Fixes bug #12239. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Shop/Cart.pm | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index bee6a966e..f1122a081 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -4,6 +4,7 @@ - fixed #12195: Visitor group by scratch membership shared among all Visitors (Dale Trexel) - fixed #12227: Corrected AssetReport such that OrderBy works correctly. - fixed #12238: Old template attachement in search template slows down sites + - fixed #12239: Still get cart error message after removing extra recurring items from the cart 7.10.22 - rfe #12223: Add date type to content profiling (metadata) diff --git a/lib/WebGUI/Shop/Cart.pm b/lib/WebGUI/Shop/Cart.pm index 90c244e73..45d89602d 100644 --- a/lib/WebGUI/Shop/Cart.pm +++ b/lib/WebGUI/Shop/Cart.pm @@ -758,17 +758,18 @@ sub updateFromForm { $item->update({shippingAddressId => $itemAddressId}); } } - if ($self->hasMixedItems) { - my $i18n = WebGUI::International->new($self->session, "Shop"); - $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(); } + ##Remove the items BEFORE we check to see if there are duplicates. + if ($self->hasMixedItems) { + my $i18n = WebGUI::International->new($self->session, "Shop"); + $error{id $self} = $i18n->get('mixed items warning'); + } + ##Visitor cannot have an address book, or set a payment gateway, so skip the rest of this. return 1 if $session->user->isVisitor;