a couple new methods to make things easier

This commit is contained in:
JT Smith 2008-03-13 20:31:32 +00:00
parent e6d42bd219
commit d47d2f2a9c

View file

@ -198,7 +198,7 @@ sub getId {
=head2 getItem ( itemId )
Returns a reference to a WebGUI::Cart::Item object.
Returns a reference to a WebGUI::Shop::CartItem object.
=head3 itemId
@ -231,6 +231,19 @@ sub getItems {
#-------------------------------------------------------------------
=head2 getShipper ()
Returns the WebGUI::Shop::ShipDriver object that is attached to this cart for shipping.
=cut
sub getShipper {
my $self = shift;
return WebGUI::Shop::Ship->new($self->session)->getShipper($self->get("shipperId"));
}
#-------------------------------------------------------------------
=head2 getShippingAddress ()
Returns the WebGUI::Shop::Address object that is attached to this cart for shipping.
@ -244,6 +257,20 @@ sub getShippingAddress {
#-------------------------------------------------------------------
=head2 getTaxes ()
Returns the tax amount on the items in the cart.
=cut
sub getTaxes {
my $self = shift;
my $tax = WebGUI::Shop::Tax->new($self->session);
return $self->formatCurrency($tax->calculate($self));
}
#-------------------------------------------------------------------
=head2 new ( session, cartId )
Constructor. Instanciates a cart based upon a cartId.
@ -421,7 +448,6 @@ sub www_view {
}
push(@items, \%properties);
}
my $tax = WebGUI::Shop::Tax->new($self->session);
my %var = (
%{$self->get},
items => \@items,
@ -455,7 +481,7 @@ sub www_view {
else {
$var{hasShippingAddress} = 1;
$var{shippingAddress} = $address->getHtmlFormatted;
$var{tax} = $self->formatCurrency($tax->calculate($self));
$var{tax} = $self->getTaxes;
my $options = WebGUI::Shop::Ship->getOptions($self);
my %formOptions = ();
my $defaultOption = "";