[interchange-cvs] interchange - heins modified 2 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Thu Jan 8 17:36:31 EST 2004
User: heins
Date: 2004-01-08 22:36:31 GMT
Modified: lib/Vend/Options Matrix.pm Simple.pm
Log:
* Add blank_label="--select--" option to [item-options], allows development
of code to enforce option selection.
* Safe enough to merge to stable, but I will let the powers that be decide
on that. 8-)
Revision Changes Path
1.7 +12 -3 interchange/lib/Vend/Options/Matrix.pm
rev 1.7, prev_rev 1.6
Index: Matrix.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Options/Matrix.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Matrix.pm 4 Dec 2003 03:52:18 -0000 1.6
+++ Matrix.pm 8 Jan 2004 22:36:31 -0000 1.7
@@ -1,6 +1,6 @@
# Vend::Options::Matrix - Interchange Matrix product options
#
-# $Id: Matrix.pm,v 1.6 2003/12/04 03:52:18 mheins Exp $
+# $Id: Matrix.pm,v 1.7 2004/01/08 22:36:31 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.6 $, 10);
+$VERSION = substr(q$Revision: 1.7 $, 10);
=head1 NAME
@@ -206,6 +206,10 @@
# skip unless o_value
$phony->{mv_sku} = $def[$i];
+ my $passed = $ref->[SEP_VALUE];
+ if($opt->{blank_label}) {
+ $passed = "=$opt->{blank_label}, $passed";
+ }
if ($opt->{label}) {
$ref->[SEP_LABEL] = "<B>$ref->[SEP_LABEL]</b>" if $opt->{bold};
push @out, $ref->[SEP_LABEL];
@@ -214,7 +218,7 @@
$sku,
'',
{
- passed => $ref->[SEP_VALUE],
+ passed => $passed,
type => $opt->{type} || $ref->[SEP_WIDGET] || 'select',
attribute => 'mv_sku',
price_data => $ref->[SEP_PRICE],
@@ -301,6 +305,11 @@
$price->{$ref->[CODE]} = $ref->[PRICE];
push @out, "$ref->[CODE]=$desc";
}
+
+ if($opt->{blank_label}) {
+ unshift @out, "=$opt->{blank_label}";
+ }
+
$out .= "<td>" if $opt->{td};
$out .= Vend::Interpolate::tag_accessories(
$sku,
1.4 +8 -3 interchange/lib/Vend/Options/Simple.pm
rev 1.4, prev_rev 1.3
Index: Simple.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Options/Simple.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Simple.pm 8 Sep 2003 12:25:18 -0000 1.3
+++ Simple.pm 8 Jan 2004 22:36:31 -0000 1.4
@@ -1,6 +1,6 @@
# Vend::Options::Simple - Interchange Simple product options
#
-# $Id: Simple.pm,v 1.3 2003/09/08 12:25:18 jon Exp $
+# $Id: Simple.pm,v 1.4 2004/01/08 22:36:31 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::Simple;
-$VERSION = substr(q$Revision: 1.3 $, 10);
+$VERSION = substr(q$Revision: 1.4 $, 10);
=head1 NAME
@@ -213,6 +213,11 @@
my $precursor = $opt->{report}
? "$ref->[GROUP]$opt->{separator}"
: qq{<input type=hidden name="mv_item_option" value="$ref->[GROUP]">};
+
+ my $passed = $ref->[VALUE];
+ if($opt->{blank_label}) {
+ $passed = "=$opt->{blank_label}, $passed";
+ }
push @out, $precursor . Vend::Interpolate::tag_accessories(
$sku,
'',
@@ -224,7 +229,7 @@
js => $opt->{js},
name => $ishash ? undef : "mv_order_$ref->[GROUP]",
option_template => $opt->{option_template},
- passed => $ref->[VALUE],
+ passed => $passed,
price => $opt->{price},
price_data => $ref->[PRICE],
height => $opt->{height} || $ref->[HEIGHT],
More information about the interchange-cvs
mailing list