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

Stefan Hornburg racke at rt.icdevgroup.org
Fri Jul 17 08:15:25 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  5b395a9448fbaac8571faffc9987f7b727707b4d (commit)
      from  ab45a47ca0ec773847872a44fdf70dc0bbce77fe (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 5b395a9448fbaac8571faffc9987f7b727707b4d
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Fri Jul 17 10:14:51 2009 +0200

    implementing clearing of wishlists (e.g. removing all items)

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

Summary of changes and diff:
 plugins/wishlists/code/wishlist.tag  |   16 ++++++++++++++++
 plugins/wishlists/code/wishlists.sub |    6 ++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/plugins/wishlists/code/wishlist.tag b/plugins/wishlists/code/wishlist.tag
index f594e63..0505722 100644
--- a/plugins/wishlists/code/wishlist.tag
+++ b/plugins/wishlists/code/wishlist.tag
@@ -131,6 +131,22 @@ sub {
 
 		$Db{cart_products}->set_slice([$wishlist_code, $sku], %data);
 	}
+	elsif ($function eq 'clear') {
+		if ($status eq 'final') {
+			# not allowed for finalized wishlists
+			$Tag->error({name => 'wishlist', set => 'Wishlist finalized'});
+			return;
+		}
+		# clear wishlist (remove all items)
+		my $ret;
+
+		$ret = $Db{cart_products}->query(q{delete from cart_products where cart = %s}, $wishlist_code);
+
+		if ($ret) {
+			# items were removed, update timestamp on cart
+			$Db{carts}->set_field($wishlist_code, 'last_modified', $Tag->time({format => '%s'}));			
+		}
+	}
 	elsif ($function eq 'remove') {
 		if ($status eq 'final') {
 			# no updates allowed to finalized wishlists
diff --git a/plugins/wishlists/code/wishlists.sub b/plugins/wishlists/code/wishlists.sub
index d8de00e..47fb884 100644
--- a/plugins/wishlists/code/wishlists.sub
+++ b/plugins/wishlists/code/wishlists.sub
@@ -86,6 +86,12 @@ sub {
 			code => $wishlist_code, status => 'final'});
 	}
 
+	# whether to clear wishlist
+	if ($CGI->{clear}) {
+		$Tag->wishlist({function => 'clear', name => $wishlist_name,
+			code => $wishlist_code});
+	}
+
 	# show wishlist for the current user
 	if ($args[0] eq 'carts') {
 		$CGI->{mv_nextpage} = 'wishlists/carts';


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list