made event handlers for cart/sku
created baseline emsbadge and emsticket added completePurchase() and denyPurchase() utility methods for transaction
This commit is contained in:
parent
f3fd67378f
commit
2a2e683dd9
9 changed files with 884 additions and 170 deletions
|
|
@ -101,7 +101,7 @@ sub create {
|
|||
|
||||
=head2 delete ()
|
||||
|
||||
Deletes this cart and all cartItems contained in it.
|
||||
Deletes this cart and removes all cartItems contained in it. Also see onCompletePurchase() and empty().
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ sub delete {
|
|||
|
||||
=head2 empty ()
|
||||
|
||||
Removes all items from this cart.
|
||||
Removes all items from this cart. Also see onCompletePurchase() and delete().
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -322,6 +322,23 @@ sub new {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 onCompletePurchase ()
|
||||
|
||||
Calls onCompletePurchase() on all the items in the cart. Then deletes all the items in the cart without calling $item->remove() on them which would affect inventory levels. See also delete() and empty().
|
||||
|
||||
=cut
|
||||
|
||||
sub onCompletePurchase {
|
||||
my $self = shift;
|
||||
foreach my $item (@{$self->getItems}) {
|
||||
$item->getSku->completePurchase($item);
|
||||
$item->delete;
|
||||
}
|
||||
$self->delete;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 update ( properties )
|
||||
|
||||
Sets properties in the cart.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue