[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. a36eeb28d027086efef7d4d3baf3a479634d8549

Stefan Hornburg racke at rt.icdevgroup.org
Fri Apr 3 11:40:51 UTC 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange wellwell catalog".

The branch, master has been updated
       via  a36eeb28d027086efef7d4d3baf3a479634d8549 (commit)
       via  8c52fa960a04919a4dc70edcdde75766527a6868 (commit)
       via  8c640c9c42febb3a773546afdf7eb02d159a3116 (commit)
      from  0dbd811ed90fbc1cc9e0e30dac5ac9cfc9805e1d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a36eeb28d027086efef7d4d3baf3a479634d8549
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Fri Apr 3 13:23:08 2009 +0200

    new carts page for wishlist plugin

commit 8c52fa960a04919a4dc70edcdde75766527a6868
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Fri Apr 3 13:20:31 2009 +0200

    new carts function, lookup by name

commit 8c640c9c42febb3a773546afdf7eb02d159a3116
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Fri Apr 3 13:14:34 2009 +0200

    a bit more sophisticated with table and product name, still leaves room for lot of improvements

-----------------------------------------------------------------------

Summary of changes and diff:
 plugins/wishlists/code/wishlist.tag          |   26 ++++++++++++++++++++------
 plugins/wishlists/components/wishlist        |   13 +++++++++++--
 plugins/wishlists/components/wishlist_carts  |   13 +++++++++++++
 plugins/wishlists/pages/wishlists/carts.html |    3 +++
 4 files changed, 47 insertions(+), 8 deletions(-)
 create mode 100644 plugins/wishlists/components/wishlist_carts
 create mode 100644 plugins/wishlists/pages/wishlists/carts.html

diff --git a/plugins/wishlists/code/wishlist.tag b/plugins/wishlists/code/wishlist.tag
index e3e4bd0..989efc6 100644
--- a/plugins/wishlists/code/wishlist.tag
+++ b/plugins/wishlists/code/wishlist.tag
@@ -4,6 +4,7 @@ UserTag wishlist HasEndTag
 UserTag wishlist Routine <<EOR
 sub {
 	my ($function, $sku, $name, $opt, $body) = @_;
+	my ($wishlist_code, $set);
 
 	$function ||= 'list';
 	$name ||= $Variable->{WISHLISTS_DEFAULT_NAME};
@@ -14,13 +15,26 @@ sub {
 
 	$Tag->perl({tables => 'products carts cart_products'});
 
-	# check whether wishlist exists
-	my ($qname, $set, $wishlist_code);
+	if ($function eq 'carts') {
+		my @carts;
 
-	$qname = $Db{carts}->quote($name);
-	$set = $Db{carts}->query(qq{select code from carts where uid = $Session->{username} and name = $qname}); 
-	if (@$set) {
-		$wishlist_code = $set->[0]->[0];
+		$set = $Db{carts}->query(qq{select code from carts where uid = $Session->{username}}); 
+		@carts = map {$_->[0]} @$set;
+
+		return wantarray ? @carts : join(',', @carts);
+	}
+
+	if ($opt->{code}) {
+		$wishlist_code = $opt->{code};
+	} elsif ($name) {
+		# lookup wishlist
+		my $qname;
+
+		$qname = $Db{carts}->quote($name);
+		$set = $Db{carts}->query(qq{select code from carts where uid = $Session->{username} and name = $qname}); 
+		if (@$set) {
+			$wishlist_code = $set->[0]->[0];
+		}
 	}
 
 	if ($function eq 'create') {
diff --git a/plugins/wishlists/components/wishlist b/plugins/wishlists/components/wishlist
index 98888a7..cdf590c 100644
--- a/plugins/wishlists/components/wishlist
+++ b/plugins/wishlists/components/wishlist
@@ -1,3 +1,12 @@
-[wishlist function="list"]
-[item-code]<br>
+[wishlist function="list" code="__CODE__" name="__NAME__"]
+[on-match]
+<table>
+<tr><th>SKU</th><th>Name</th></tr>
+[/on-match]
+[list]
+<tr><td>[item-code]</td><td><a href="[area [item-code]]">[item-data products name]</a></td></tr>
+[/list]
+[on-match]
+</table>
+[/on-match]
 [/wishlist]
\ No newline at end of file
diff --git a/plugins/wishlists/components/wishlist_carts b/plugins/wishlists/components/wishlist_carts
new file mode 100644
index 0000000..2ddeb5f
--- /dev/null
+++ b/plugins/wishlists/components/wishlist_carts
@@ -0,0 +1,13 @@
+[seti carts][wishlist carts][/seti]
+[loop list=`$Scratch->{carts}` prefix=item]
+[on-match]
+<table class="titles">
+<tr><th>Name</th></tr>
+[/on-match]
+[list]
+<tr><td><a href="[area wishlists/list/[item-code]]">[item-data carts name]</a></td></tr>
+[/list]
+[on-match]
+</table>
+[/on-match]
+[/loop]
\ No newline at end of file
diff --git a/plugins/wishlists/pages/wishlists/carts.html b/plugins/wishlists/pages/wishlists/carts.html
new file mode 100644
index 0000000..9f23747
--- /dev/null
+++ b/plugins/wishlists/pages/wishlists/carts.html
@@ -0,0 +1,3 @@
+[compose
+	components.body="wishlist_carts"
+]


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list