When a Sku is purged, delete it from all carts. Better handling for cartItems whose assets have been deleted. Fixes bug #12213
This commit is contained in:
parent
44f62c9884
commit
3b7dd524db
5 changed files with 32 additions and 4 deletions
|
|
@ -628,6 +628,22 @@ sub processStyle {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 purge ( )
|
||||
|
||||
Extent the base class to clean out any items using this Sku in all Carts.
|
||||
|
||||
=cut
|
||||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $assetId = $self->getId;
|
||||
my $success = $self->SUPER::purge;
|
||||
return $success unless $success;
|
||||
$self->session->db->write('delete from cartItem where assetId=?',[$assetId]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setTaxConfiguration ($namespace, $configuration)
|
||||
|
||||
=head3 $namespace
|
||||
|
|
|
|||
|
|
@ -676,8 +676,11 @@ sub requiresShipping {
|
|||
my $self = shift;
|
||||
|
||||
# Look for recurring items in the cart
|
||||
foreach my $item (@{ $self->getItems }) {
|
||||
return 1 if $item->getSku->isShippingRequired;
|
||||
ITEM: foreach my $item (@{ $self->getItems }) {
|
||||
my $sku = $item->getSku;
|
||||
next ITEM unless $sku;
|
||||
return 1 if $sku->isShippingRequired;
|
||||
|
||||
}
|
||||
|
||||
# No recurring items in cart so return false
|
||||
|
|
|
|||
|
|
@ -175,7 +175,8 @@ sub getSku {
|
|||
my ($self) = @_;
|
||||
my $asset = '';
|
||||
$asset = WebGUI::Asset->newByDynamicClass($self->cart->session, $self->get("assetId"));
|
||||
$asset->applyOptions($self->get("options")) if $asset;
|
||||
return undef if ! $asset;
|
||||
$asset->applyOptions($self->get("options"));
|
||||
return $asset;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue