NAME
Handel::Cart::Item - Module representing an indivudal shopping cart line item
VERSION
$Id: Item.pm 34 2004-12-31 02:13:03Z claco $
SYNOPSIS
use Handel::Cart::Item;
my $item = Handel::Cart::Item->new({
sku => '1234',
price => 1.23,
quantity => 1
});
$cart->add($item);
DESCRIPTION
Handel::Cart::Item
is used in two main ways. First, you can create new line items and add them to an existing cart object:
use Handel::Cart::Item;
my $item = Handel::Cart::Item->new({
sku => '1234',
price => 1.23,
quantity => 1
});
$cart->add($item);
Second, the items
method of any valid Handel::Cart
object returns a collection of Handel::Cart::Item
objects:
my @items = $cart->items;
foreach (@items) {
print $_->sku;
};
CONSTRUCTOR
You can create a new Handel::Cart::Item
object by call the new
method:
my $item = Handel::Cart::Item->new({
sku => '1234',
price => 1.23,
quantity => 1
});
This is a lazy operation. No actual item record is created until the item object is passed into the carts add
method.
METHODS
$item->total
Returns the total price for the cart item. This is really just quantity*total and is provided for convenience.
SEE ALSO
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
cpan@chrislaco.com
http://today.icantfocus.com/blog/