NAME

Mango::Order::Item - Module representing an individual order item

SYNOPSIS

my $items = $order->items;

while (my $item = $items->next) {
    print $item->sku;
};

DESCRIPTION

Mango::Order::Item represents an individual order item.

METHODS

created

Returns the date and time in UTC the order item was created as a DateTime object.

print $item->created;

description

Arguments: $description

Gets/sets the description for the current order item.

$item->description('Best Item Ever');
print $item->description;

id

Returns the id of the current order item.

print $item->id;

sku

Arguments: $sku

Gets/sets the sku (stock keeping unit/part number) for the order item.

$item->sku('ABC123');
print $item->sku;

price

Arguments: $price

Gets/sets the price for the current order item. The price is returned as a Mango::Currency object.

$item->price(12.95);
print $item->price;
print $item->price->format;

quantity

Arguments: $quantity

Gets/sets the quantity, or the number of this item being purchased.

$item->quantity(3);
print $item->quantity;

total

Returns the total price for the order item as a Mango::Currency object. This is really just quantity*total and is provided for convenience.

print $item->total;
print $item->total->format;

update

Saves any changes made to the order item back to the provider.

$item->quantity(2);
$item->update;

Whenever "update" is called, "updated" is automatically set to the current time in UTC.

updated

Returns the date and time in UTC the order item was last updated as a DateTime object.

print $item->updated;

SEE ALSO

Mango::Order, Mango::Schema::Order::Item, Mango::Currency

AUTHOR

Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/