[interchange-cvs] interchange - heins modified lib/Vend/Options/Matrix.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon May 9 15:17:20 EDT 2005


User:      heins
Date:      2005-05-09 19:17:20 GMT
Modified:  lib/Vend/Options Matrix.pm
Log:
* Add translate option that translates the labels of options in matrix
  mode.

* TODO: Same for Simple.

Revision  Changes    Path
1.10      +17 -5     interchange/lib/Vend/Options/Matrix.pm


rev 1.10, prev_rev 1.9
Index: Matrix.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Options/Matrix.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Matrix.pm	12 Apr 2005 15:14:39 -0000	1.9
+++ Matrix.pm	9 May 2005 19:17:20 -0000	1.10
@@ -1,6 +1,6 @@
 # Vend::Options::Matrix - Interchange Matrix product options
 #
-# $Id: Matrix.pm,v 1.9 2005/04/12 15:14:39 mheins Exp $
+# $Id: Matrix.pm,v 1.10 2005/05/09 19:17:20 mheins Exp $
 #
 # Copyright (C) 2002-2003 Mike Heins <mikeh at perusion.net>
 # Copyright (C) 2002-2003 Interchange Development Group <interchange at icdevgroup.org>
@@ -23,7 +23,7 @@
 
 package Vend::Options::Matrix;
 
-$VERSION = substr(q$Revision: 1.9 $, 10);
+$VERSION = substr(q$Revision: 1.10 $, 10);
 
 =head1 NAME
 
@@ -125,6 +125,7 @@
 	$opt->{display_type} ||= $record->{display_type};
 
 	$opt->{display_type} = lc $opt->{display_type};
+	$opt->{translate} = $loc->{translate} unless defined $opt->{translate};
 
 	my @rf;
 	my @out;
@@ -211,14 +212,25 @@
 				$passed = "=$opt->{blank_label}, $passed";
 			}
 			if ($opt->{label}) {
-				$ref->[SEP_LABEL] = "<B>$ref->[SEP_LABEL]</b>" if $opt->{bold};
-				push @out, $ref->[SEP_LABEL];
+				my $lab = $ref->[SEP_LABEL];
+				$lab = errmsg($lab) if $opt->{translate};
+				$lab = "<B>$lab</b>" if $opt->{bold};
+				push @out, $lab;
 			}
+
+			my $ary = Vend::Form::options_to_array($passed);
+
+			if($opt->{translate}) {
+				for(@$ary) {
+					$_->[1] = errmsg($_->[1]);
+				}
+			}
+
 			push @out, Vend::Interpolate::tag_accessories(
 							$sku,
 							'',
 							{ 
-								passed => $passed,
+								passed => $ary,
 								type => $opt->{type} || $ref->[SEP_WIDGET] || 'select',
 								attribute => 'mv_sku',
 								price_data => $ref->[SEP_PRICE],








More information about the interchange-cvs mailing list