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

Stefan Hornburg racke at rt.icdevgroup.org
Tue Sep 29 11:30:42 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  c135eba278ff654b7ca8f6595fd00f3195f27120 (commit)
      from  b5dd5802bbfe4739c8f77cb6df64e5b14e38f1d8 (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 c135eba278ff654b7ca8f6595fd00f3195f27120
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Tue Sep 29 13:29:54 2009 +0200

    allow plugins to add content to product view, new tags [call-hooks] and [product-display]

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

Summary of changes and diff:
 code/call_hooks.tag      |   23 +++++++++++++++++++++++
 code/product_display.tag |   23 +++++++++++++++++++++++
 components/product_info  |    4 ++--
 3 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 code/call_hooks.tag
 create mode 100644 code/product_display.tag

diff --git a/code/call_hooks.tag b/code/call_hooks.tag
new file mode 100644
index 0000000..7843455
--- /dev/null
+++ b/code/call_hooks.tag
@@ -0,0 +1,23 @@
+UserTag call_hooks Order name mode
+UserTag call_hooks AddAttr
+UserTag call_hooks Routine <<EOR
+sub {
+	my ($name, $mode, $opt) = @_;
+	my (@plugins, @ret);
+
+	@plugins = split(/,/, $Variable->{PLUGINS});
+
+	for my $plugin (@plugins) {
+		Log("Checkin for function ${plugin}_$name");
+		if ($sub = $Config->{Sub}->{"${plugin}_$name"}) {
+			push(@ret, $sub->($opt));
+		}
+	}
+
+	if ($mode eq 'collect') {
+		return @ret;
+	}
+
+	return;	
+}
+EOR
diff --git a/code/product_display.tag b/code/product_display.tag
new file mode 100644
index 0000000..d286c73
--- /dev/null
+++ b/code/product_display.tag
@@ -0,0 +1,23 @@
+UserTag product_display Order sku format
+UserTag product_display HasEndTag
+UserTag product_display Routine <<EOR
+sub {
+	my ($sku, $format, $body) = @_;
+	my ($main, @content, $disp);
+
+	# determine main content
+	$main = $Tag->fly_list({code => $sku, body => $body});
+
+	# let plugins add their own content
+	@content = $Tag->call_hooks({name => 'node_view', 
+		mode => 'collect',
+		type => 'products',
+		code => $sku});
+
+	if (@content) {
+		return $main . join('', @content);
+	}
+
+	return $main;
+}
+EOR
diff --git a/components/product_info b/components/product_info
index 12f8191..35c345b 100644
--- a/components/product_info
+++ b/components/product_info
@@ -1,4 +1,4 @@
-[fly-list code="[either][data session arg][or]__SKU__[/either]"]
+[product-display sku="[either][data session arg][or]__SKU__[/either]"]
 
 <h2>[item-field manufacturer] [item-field name]</h2>
 
@@ -21,4 +21,4 @@
 [item-field long_description]
 </p>
 
-[/fly-list]
+[/product-display]


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list