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

Stefan Hornburg racke at rt.icdevgroup.org
Wed Feb 11 09:14:20 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  bbf3b253664f0a68565f3f3c22f34a3537557da3 (commit)
      from  5f457ff6058b5d124604bcffeedc5c25cd5c98d9 (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 bbf3b253664f0a68565f3f3c22f34a3537557da3
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Wed Feb 11 10:13:53 2009 +0100

    create and fill categories

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

Summary of changes and diff:
 jobs/migrate/standard |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/jobs/migrate/standard b/jobs/migrate/standard
index 2d5b717..a0cadf8 100644
--- a/jobs/migrate/standard
+++ b/jobs/migrate/standard
@@ -4,8 +4,8 @@
 [/comment]
 [anydata table="standard_products" format="TAB" name="database/standard/products.txt" hide=1]
 [query table="standard_products" sql="select * from standard_products" hashref="products"/]
-[perl tables="products"]
-my ($sku, %count);
+[perl tables="products categories product_categories" short_errors="1"]
+my ($sku, %count, $group, %prod_groups, $cat, %categories, $code);
 
 for my $productref (@{$Tmp->{products}}) {
 	$sku = delete $productref->{sku};
@@ -16,6 +16,31 @@ for my $productref (@{$Tmp->{products}}) {
 							 price => $productref->{price},
 							 inactive => $productref->{inactive});
 	$count{products}++;
+
+	next if $productref->{inactive};
+
+	# create categories
+	$group = $productref->{prod_group};
+	$cat = $productref->{category};
+
+	if ($group =~ /\S/) {
+		# determine/create first level category (product group)
+		unless (exists $prod_groups{$group}) {
+			$prod_groups{$group} = $Tag->category_master($group, 0, 'category');
+		}
+		$code = $prod_groups{$group};
+
+		if ($cat =~ /\S/) {
+			# determine/create second level category
+			unless (exists $categories{$cat}) {
+				$categories{$cat} = $Tag->category_master($cat, $code, 'category');
+			}
+			$code = $categories{$cat};
+		}
+
+		# let product join this category
+		$Db{product_categories}->query(qq{insert into product_categories values('%s', %s, '%s')}, $sku, $code, 'category');
+	}
 }
 
 return "$count{products} products migrated.";


hooks/post-receive
-- 
Interchange wellwell catalog



More information about the wellwell-devel mailing list