[interchange-cvs] interchange - kwalsh modified lib/Vend/Cart.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Sun Feb 10 20:04:13 EST 2008
User: kwalsh
Date: 2008-02-11 01:04:12 GMT
Modified: lib/Vend Cart.pm
Log:
* Added a cache to save on data lookups in the min/max quantity
enforcement code.
Revision Changes Path
2.21 +5 -4 interchange/lib/Vend/Cart.pm
rev 2.21, prev_rev 2.20
Index: Cart.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Cart.pm,v
retrieving revision 2.20
retrieving revision 2.21
diff -u -r2.20 -r2.21
--- Cart.pm 8 Feb 2008 09:47:09 -0000 2.20
+++ Cart.pm 11 Feb 2008 01:04:12 -0000 2.21
@@ -1,6 +1,6 @@
# Vend::Cart - Interchange shopping cart management routines
#
-# $Id: Cart.pm,v 2.20 2008/02/08 09:47:09 kwalsh Exp $
+# $Id: Cart.pm,v 2.21 2008/02/11 01:04:12 kwalsh Exp $
#
# Copyright (C) 2002-2007 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -25,7 +25,7 @@
package Vend::Cart;
-$VERSION = substr(q$Revision: 2.20 $, 10);
+$VERSION = substr(q$Revision: 2.21 $, 10);
use strict;
@@ -189,6 +189,7 @@
$quantity_raise_event = $raise_event && $quantity_raise_event;
my $event_cartname = $cartname || $Vend::CurrentCart;
my $old_item;
+ my %quantity_cache;
DELETE: for (;;) {
my %total_quantity = ();
@@ -224,7 +225,7 @@
$col = $tab;
$tab = $item->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
}
- $item->{mv_min_quantity} = ::tag_data($tab, $col, $item->{code})
+ $item->{mv_min_quantity} = $quantity_cache{"$tab.$col.$item->{code}"} || ::tag_data($tab, $col, $item->{code})
|| '';
}
@@ -257,7 +258,7 @@
$col = $tab;
$tab = $item->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
}
- $item->{mv_max_quantity} += ::tag_data($tab, $col, $item->{code});
+ $item->{mv_max_quantity} += $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;
More information about the interchange-cvs
mailing list