[interchange-cvs] interchange - heins modified
code/UserTag/weight.tag
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Thu Feb 26 13:07:12 EST 2004
User: heins
Date: 2004-02-26 18:07:12 GMT
Modified: code/UserTag weight.tag
Log:
* Make the weight tag a bit smarter -- added matrix=1 option to automatically
fall back to the base SKU weight if not filled in for the variant.
Revision Changes Path
1.3 +15 -1 interchange/code/UserTag/weight.tag
rev 1.3, prev_rev 1.2
Index: weight.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/weight.tag,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- weight.tag 10 Jul 2003 22:23:46 -0000 1.2
+++ weight.tag 26 Feb 2004 18:07:11 -0000 1.3
@@ -67,6 +67,9 @@
return $it->{$attr} if defined $it->{$attr};
my $tab = $table || $it->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
$it->{$attr} = tag_data($tab,$field,$it->{code}) || 0;
+ if($opt->{matrix} and ! $it->{$attr} and $it->{mv_sku}) {
+ $it->{$attr} = Vend::Data::product_field($field,$it->{mv_sku});
+ }
return $it->{$attr};
};
}
@@ -74,7 +77,11 @@
$wsub = sub {
my $it = shift;
my $tab = $table || $it->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
- return tag_data($tab,$field,$it->{code});
+ my $w = tag_data($tab,$field,$it->{code}) || 0;
+ if(! $w and $opt->{matrix} and $it->{mv_sku}) {
+ $w = Vend::Data::product_field($field,$it->{mv_sku});
+ }
+ return $w;
};
}
@@ -108,6 +115,7 @@
field=sh_weight*
fill-attribute=weight*
hide=1|0*
+ matrix=1
no-set=1|0*
table=weights*
weight-scratch=sh_weight*
@@ -150,6 +158,12 @@
Don't display the weight, only set in Scratch. It makes no sense to
use hide=1 and no-set=1.
+
+=item matrix
+
+If set, will get the weight from the ProductFiles for the mv_sku
+attribute of the item. In other words, if the weight for a variant
+is not set, it will use the weight for the base SKU.
=item no-set
More information about the interchange-cvs
mailing list