diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 0d80333f5..2fc0faf3b 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.7.19 + - fixed #10849: Shop: Bad behavior with no shipping drivers - fixed #10843: Ad Sales: how many do I have to buy? - fixed #10835: Ad Sales: Ad Space field not user-friendly - fixed #10841: Ad Sales: hover help spelling error diff --git a/lib/WebGUI/Shop/Cart.pm b/lib/WebGUI/Shop/Cart.pm index bfe1e4e5e..59f0fbd12 100644 --- a/lib/WebGUI/Shop/Cart.pm +++ b/lib/WebGUI/Shop/Cart.pm @@ -520,6 +520,9 @@ sub readyForCheckout { return 0 if $total < $requiredAmount; } + ##Check for any other logged errors + return 0 if $error{ id $self }; + # All checks passed so return true return 1; } @@ -799,7 +802,6 @@ sub www_view { my %var = ( %{$self->get}, items => \@items, - error => $error{id $self}, formHeader => WebGUI::Form::formHeader($session) . WebGUI::Form::hidden($session, {name=>"shop", value=>"cart"}) . WebGUI::Form::hidden($session, {name=>"method", value=>"update"}) @@ -847,9 +849,16 @@ sub www_view { $defaultOption = $option; $formOptions{$option} = $options->{$option}{label}." (".$self->formatCurrency($options->{$option}{price}).")"; } - $var{shippingOptions} = WebGUI::Form::selectBox($session, {name=>"shipperId", options=>\%formOptions, defaultValue=>$defaultOption, value=>$self->get("shipperId")}); - $var{shippingPrice} = ($self->get("shipperId") ne "") ? $options->{$self->get("shipperId")}{price} : $options->{$defaultOption}{price}; - $var{shippingPrice} = $self->formatCurrency($var{shippingPrice}); + if ($defaultOption) { + $var{shippingOptions} = WebGUI::Form::selectBox($session, {name=>"shipperId", options=>\%formOptions, defaultValue=>$defaultOption, value=>$self->get("shipperId")}); + $var{shippingPrice} = ($self->get("shipperId") ne "") ? $options->{$self->get("shipperId")}{price} : $options->{$defaultOption}{price}; + $var{shippingPrice} = $self->formatCurrency($var{shippingPrice}); + } + else { + $var{shippingOptions} = ''; + $var{shippingPrice} = 0; + $error{id $self} = $i18n->get("No shipping plugins configured"); + } } # Tax variables @@ -871,6 +880,7 @@ sub www_view { $var{ inShopCreditDeduction } = $credit->calculateDeduction($var{totalPrice}); $var{ totalPrice } = $self->formatCurrency($var{totalPrice} + $var{inShopCreditDeduction}); $var{ readyForCheckout } = $self->readyForCheckout; + $var{ error } = $error{id $self}; # render the cart my $template = WebGUI::Asset::Template->new($session, $session->setting->get("shopCartTemplateId")); diff --git a/lib/WebGUI/Shop/Ship.pm b/lib/WebGUI/Shop/Ship.pm index 0e25eacc4..5dc2f1aaf 100644 --- a/lib/WebGUI/Shop/Ship.pm +++ b/lib/WebGUI/Shop/Ship.pm @@ -265,6 +265,7 @@ sub www_manage { .WebGUI::Form::selectBox($session, {name=>"className", options=>$self->getDrivers}) .WebGUI::Form::submit($session, {value=>$i18n->get("add shipper")}) .WebGUI::Form::formFooter($session); + my $hasShipper = 0; foreach my $shipper (@{$self->getShippers}) { $output .= '