Force the user to pick a shipping method before checking out. Implements RFE #10940

If there is only 1 shipping method, automatically choose it.  Displays
an message to the user if they have an address, but no shipping method.
This commit is contained in:
Colin Kuskie 2009-09-28 10:04:52 -07:00
parent cad1d99844
commit e5ead13da3
4 changed files with 48 additions and 16 deletions

View file

@ -33,7 +33,7 @@ my $i18n = WebGUI::International->new($session, "Shop");
#----------------------------------------------------------------------------
# Tests
plan tests => 29; # Increment this number for each test you create
plan tests => 30; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -105,13 +105,15 @@ my $ship = WebGUI::Shop::Ship->new( $session );
my $shipper = $ship->addShipper( 'WebGUI::Shop::ShipDriver::FlatRate', {flatFee => 1 } );
$cart->update( {
shippingAddressId => $address->getId,
shipperId => $shipper->getId,
} );
is($cart->readyForCheckout, 1, 'Cart is ready for checkout');
ok(! $cart->readyForCheckout, 'readyForCheckout: returns false due to no shipperId');
$cart->update( { shipperId => $shipper->getId, } );
ok($cart->readyForCheckout, '... returns true when it has shipperId, and shipping address');
# Check shipping address constraint
$cart->update( {shippingAddressId => 'Does Not Exist'} );
is( $cart->readyForCheckout, 0, 'Cannot checkout cart without shipping address' );
ok( ! $cart->readyForCheckout, '... Cannot checkout cart without shipping address' );
# Check minimum transaction amount
$session->setting->set( 'shopCartCheckoutMinimum', 1000 );