Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

New tests added for Nitesi::Cart remove method #1

Closed
wants to merge 3 commits into from

2 participants

Commits on Sep 28, 2011
  1. @racke
Commits on Sep 29, 2011
  1. @racke
Commits on Oct 4, 2011
  1. @racke
This page is out of date. Refresh to see the latest.
Showing with 35 additions and 0 deletions.
  1. +35 −0 lib/Nitesi/Cart.pm
View
35 lib/Nitesi/Cart.pm
@@ -182,6 +182,8 @@ sub remove {
my ($self, $arg) = @_;
my ($pos, $found, $item);
+ $pos = 0;
+
for $item (@{$self->{items}}) {
if ($item->{sku} eq $arg) {
$found = 1;
@@ -227,6 +229,23 @@ sub clear {
$self->{items} = [];
}
+=head2 id
+
+Get or set id of the cart. This can be used for subclasses,
+e.g. primary key value for carts in the database.
+
+=cut
+
+sub id {
+ my $self = shift;
+
+ if (@_ > 0) {
+ $self->{id} = $_[0];
+ }
+
+ return $self->{id};
+}
+
=head2 name
Get or set the name of the cart.
@@ -297,4 +316,20 @@ sub _run_hook {
return $ret;
}
+=head1 AUTHOR
+
+Stefan Hornburg (Racke), <racke@linuxia.de>
+
+=head1 LICENSE AND COPYRIGHT
+
+Copyright 2011 Stefan Hornburg (Racke) <racke@linuxia.de>.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of either: the GNU General Public License as published
+by the Free Software Foundation; or the Artistic License.
+
+See http://dev.perl.org/licenses/ for more information.
+
+=cut
+
1;
Something went wrong with that request. Please try again.