cart should be pretty much working at this point...now need to test and whatnot

This commit is contained in:
JT Smith 2008-02-26 02:12:31 +00:00
parent fa52bf1aef
commit d207994e90
4 changed files with 13 additions and 26 deletions

View file

@ -67,12 +67,7 @@ sub create {
return $class->new($session, $cartId) if (defined $cartId);
my $cartId = $session->id->generate;
$session->db->write('insert into cart (cartId, sessionId) values (?,?)', [$cartId, $session->getId]);
bless my $self, $class;
register $self;
my $id = id $self;
$session{ $id } = $session;
$properties{ $id } = {cartId=>$cartId, sessionId=>$session->getId};
return $self;
return $class->new($session, $cartId);
}
#-------------------------------------------------------------------

View file

@ -121,24 +121,14 @@ sub incrementQuantity {
my ($self, $quantity) = @_;
$quantity ||= 1;
my $id = $self;
if ($self->get("quantity") + $quantity > $self->getSku->getMaxAllowedInCart) {
croak "Cannot have that many in cart.";
}
$properties{$id}{quantity} += $quantity;
$cart->session->db->setRow("cartItems","itemId", $properties{$id});
}
#-------------------------------------------------------------------
=head2 isAtMaxQuantity ( )
Returns a boolean indicating whether the item is already at max quantity in the cart.
=cut
sub isAtMaxQuantity {
my ($self) = @_;
}
#-------------------------------------------------------------------
=head2 new ( session, cart, itemId )