[interchange-cvs] interchange - docelic modified lib/Vend/Cart.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Thu Jun 26 08:45:08 UTC 2008
User: docelic
Date: 2008-06-26 08:45:08 GMT
Modified: lib/Vend Cart.pm
Log:
- Extend MaxQuantityField config directive to support fields
prefixed with '=' or '?'.
By default, there's no behavior change and specification of
'MaxQuantityField f1 f2' sets max quantity to f1 + f2.
With f1 =f2, max quantity is unconditionally set to f2.
With f1 ?f2, max quantity is set to f2 only if f2 > 0.
Courtesy of Cameron B. Prince <cameron at princeinternet.com>
Revision Changes Path
2.24 interchange/lib/Vend/Cart.pm
rev 2.24, prev_rev 2.23
Index: Cart.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Cart.pm,v
retrieving revision 2.23
retrieving revision 2.24
diff -u -r2.23 -r2.24
--- Cart.pm 25 Mar 2008 17:13:21 -0000 2.23
+++ Cart.pm 26 Jun 2008 08:45:08 -0000 2.24
@@ -1,6 +1,6 @@
# Vend::Cart - Interchange shopping cart management routines
#
-# $Id: Cart.pm,v 2.23 2008-03-25 17:13:21 jon Exp $
+# $Id: Cart.pm,v 2.24 2008-06-26 08:45:08 docelic Exp $
#
# Copyright (C) 2002-2008 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -25,7 +25,7 @@
package Vend::Cart;
-$VERSION = substr(q$Revision: 2.23 $, 10);
+$VERSION = substr(q$Revision: 2.24 $, 10);
use strict;
@@ -258,11 +258,26 @@
$col = $tab;
$tab = $item->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
}
- $item->{mv_max_quantity} += $quantity_cache{"$tab.$col.$item->{code}"} || ($quantity_cache{"$tab.$col.$item->{code}"} = ::tag_data($tab, $col, $item->{code}));
+ if ( $tab =~ s/^=// ) {
+ $item->{mv_max_quantity} = $quantity_cache{"$tab.$col.$item->{code}"} = ::tag_data($tab, $col, $item->{code});
+ goto DONE_QUANTITY_ADJUST;
+ }
+ elsif ( $tab =~ s/^\?// ) {
+ if ( $item->{mv_max_quantity} ) {
+ $item->{mv_max_quantity} = $quantity_cache{"$tab.$col.$item->{code}"} = ::tag_data($tab, $col, $item->{code}) if
+ ::tag_data($tab, $col, $item->{code});
+ goto DONE_QUANTITY_ADJUST;
+ }
+ }
+ else {
+ $item->{mv_max_quantity} += $quantity_cache{"$tab.$col.$item->{code}"} || ($quantity_cache{"$tab.$col.$item->{code}"} = ::tag_data($tab, $col, $item->{code}));
+ }
}
$item->{mv_max_quantity} -= $total_quantity{$item->{code}};
$item->{mv_max_quantity} = 0 if $item->{mv_max_quantity} < 0;
+ DONE_QUANTITY_ADJUST:
+
if(
length $item->{mv_max_quantity}
and
More information about the interchange-cvs
mailing list