[interchange-cvs] interchange - heins modified 4 files
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Fri Jun 28 01:01:01 2002
User: heins
Date: 2002-06-28 05:00:25 GMT
Modified: lib/Vend Cart.pm Config.pm
Modified: dist/foundation/templates/components cart
Modified: dist/foundation/templates/sampledata/tools/products
Modified: inventory.txt
Log:
* Add support for minimum and maximum order quantities defined in
database.
- MinQuantityField determines minimum order quantity. (New
field min_order added to tools sample data inventory file).
Example setting:
MinOrderQuantity inventory:min_order
- MaxQuantityField determines maximum order quantity. (Existing
field quantity used in tools sample data inventory file).
MinOrderQuantity inventory:quantity
- Check is enforced in toss_cart routine, so items that are added
via embedded Perl will not be updated until next recalculate (or
standard order via supplied routines).
- The quantities are set in the item attributes mv_min_quantity and
mv_max_quantity.
- If a quantity less than the minimum is detected, the flag
mv_min_under will be set in the item and persist until deleted
manually. This value is only checked once.
- If a quantity more than the maximum is detected, the flag
mv_max_under will be set in the item and persist until deleted
manually. This order is checked on every toss, and if the
maximum order quantity decreases $item->{mv_max_quantity} will
be adjusted.
Revision Changes Path
2.4 +56 -12 interchange/lib/Vend/Cart.pm
rev 2.4, prev_rev 2.3
Index: Cart.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Cart.pm,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -r2.3 -r2.4
--- Cart.pm 27 Jun 2002 22:24:10 -0000 2.3
+++ Cart.pm 28 Jun 2002 05:00:25 -0000 2.4
@@ -1,6 +1,6 @@
# Vend::Cart - Interchange shopping cart management routines
#
-# $Id: Cart.pm,v 2.3 2002/06/27 22:24:10 jon Exp $
+# $Id: Cart.pm,v 2.4 2002/06/28 05:00:25 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -24,7 +24,7 @@
package Vend::Cart;
-$VERSION = substr(q$Revision: 2.3 $, 10);
+$VERSION = substr(q$Revision: 2.4 $, 10);
use strict;
@@ -142,26 +142,70 @@
my (@cascade);
DELETE: for (;;) {
foreach $i (0 .. $#$s) {
+ my $item = $s->[$i];
if ($sub = $Vend::Cfg->{ItemAction}{$s->[$i]{code}}) {
- $sub->($s->[$i]);
+ $sub->($item);
}
- if ($s->[$i]->{quantity} <= 0) {
- next if defined $s->[$i]->{mv_control} and
- $s->[$i]->{mv_control} =~ /\bnotoss\b/;
- if ($s->[$i]->{mv_mi} && ! $s->[$i]->{mv_si}) {
- push (@master, $s->[$i]->{mv_mi});
+ if ($item->{quantity} <= 0) {
+ next if defined $item->{mv_control} and
+ $item->{mv_control} =~ /\bnotoss\b/;
+ if ($item->{mv_mi} && ! $item->{mv_si}) {
+ push (@master, $item->{mv_mi});
}
- elsif ( $s->[$i]->{mv_ci} ) {
- push (@master, $s->[$i]->{mv_ci});
+ elsif ( $item->{mv_ci} ) {
+ push (@master, $item->{mv_ci});
}
splice(@$s, $i, 1);
next DELETE;
}
+
+ if($Vend::Cfg->{MinQuantityField}) {
+ if(! defined $item->{mv_min_quantity}) {
+ my ($tab, $col) = split /:+/, $Vend::Cfg->{MinQuantityField};
+ if(! length $col) {
+ $col = $tab;
+ $tab = $item->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
+ }
+ $item->{mv_min_quantity} = ::tag_data($tab, $col, $item->{code})
+ || '';
+ }
+
+ if(
+ length $item->{mv_min_quantity}
+ and
+ $item->{quantity} < $item->{mv_min_quantity}
+ )
+ {
+ $item->{quantity} = $item->{mv_min_quantity};
+ $item->{mv_min_under} = 1;
+ }
+ }
+
+ if($Vend::Cfg->{MaxQuantityField}) {
+ my ($tab, $col) = split /:+/, $Vend::Cfg->{MaxQuantityField};
+ if(! length $col) {
+ $col = $tab;
+ $tab = $item->{mv_ib} || $Vend::Cfg->{ProductFiles}[0];
+ }
+ $item->{mv_max_quantity} = ::tag_data($tab, $col, $item->{code})
+ || '';
+
+ if(
+ length $item->{mv_max_quantity}
+ and
+ $item->{quantity} > $item->{mv_max_quantity}
+ )
+ {
+ $item->{quantity} = $item->{mv_max_quantity};
+ $item->{mv_max_over} = 1;
+ }
+ }
+
next unless $Vend::Cfg->{Limit}{cart_quantity_per_line};
- $s->[$i]->{quantity} = $Vend::Cfg->{Limit}{cart_quantity_per_line}
+ $item->{quantity} = $Vend::Cfg->{Limit}{cart_quantity_per_line}
if
- $s->[$i]->{quantity}
+ $item->{quantity}
>
$Vend::Cfg->{Limit}{cart_quantity_per_line};
}
2.50 +4 -2 interchange/lib/Vend/Config.pm
rev 2.50, prev_rev 2.49
Index: Config.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Config.pm,v
retrieving revision 2.49
retrieving revision 2.50
diff -u -r2.49 -r2.50
--- Config.pm 27 Jun 2002 22:24:10 -0000 2.49
+++ Config.pm 28 Jun 2002 05:00:25 -0000 2.50
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.49 2002/06/27 22:24:10 jon Exp $
+# $Id: Config.pm,v 2.50 2002/06/28 05:00:25 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -44,7 +44,7 @@
use Vend::Parse;
use Vend::Util;
-$VERSION = substr(q$Revision: 2.49 $, 10);
+$VERSION = substr(q$Revision: 2.50 $, 10);
my %CDname;
@@ -407,6 +407,8 @@
['SetGroup', 'valid_group', ''],
['UseModifier', 'array', ''],
['AutoModifier', 'array', ''],
+ ['MaxQuantityField', undef, ''],
+ ['MinQuantityField', undef, ''],
['LogFile', undef, 'etc/log'],
['Pragma', 'boolean', ''],
['DynamicData', 'boolean', ''],
2.8 +12 -0 interchange/dist/foundation/templates/components/cart
rev 2.8, prev_rev 2.7
Index: cart
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/foundation/templates/components/cart,v
retrieving revision 2.7
retrieving revision 2.8
diff -u -r2.7 -r2.8
--- cart 22 Jun 2002 14:47:05 -0000 2.7
+++ cart 28 Jun 2002 05:00:25 -0000 2.8
@@ -118,6 +118,18 @@
[if-item-field weight]
[seti weight][summary amount=`[item-quantity] * [item-field weight]`][/seti]
[/if-item-field]
+ [if-item-param mv_min_under]
+ <br>
+ <span style="color: __CONTRAST__; font-size: 8pt">
+ Minimum order quantity of [item-param mv_min_quantity] enforced.
+ </span>
+ [/if-item-param]
+ [if-item-param mv_max_over]
+ <br>
+ <span style="color: __CONTRAST__; font-size: 8pt">
+ Maximum order quantity of [item-param mv_max_quantity] enforced.
+ </span>
+ [/if-item-param]
[if type=explicit compare="[control others_bought]"]
[if-item-data merchandising others_bought]
2.1 +41 -41 interchange/dist/foundation/templates/sampledata/tools/products/inventory.txt
rev 2.1, prev_rev 2.0
Index: inventory.txt
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/foundation/templates/sampledata/tools/products/inventory.txt,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- inventory.txt 18 Jul 2001 02:21:51 -0000 2.0
+++ inventory.txt 28 Jun 2002 05:00:25 -0000 2.1
@@ -1,41 +1,41 @@
-sku quantity stock_message account cogs_account
-gift_cert 1 In Stock
-os28004 93 Ships in 3-5 days
-os28005 100 Ships in 3-5 days
-os28006 90 Ships in 3-5 days
-os28007 85 Ships in 3-5 days
-os28008 100 Ships in 3-5 days
-os28009 95 Ships in 3-5 days
-os28011 40 Ships in 3-5 days
-os28044 100 Ships in 3-5 days
-os28057a 100 Ships in 3-5 days
-os28057b 29 Ships in 3-5 days
-os28057c 50 Ships in 3-5 days
-os28062 88 Ships in 3-5 days
-os28064 94 Ships in 3-5 days
-os28065 100 Ships in 3-5 days
-os28066 100 Ships in 3-5 days
-os28068a 100 Ships in 3-5 days
-os28068b 99 Ships in 3-5 days
-os28069 100 Ships in 3-5 days
-os28070 0 Ships in 3-5 days
-os28072 100 Ships in 3-5 days
-os28073 0 Ships in 3-5 days
-os28074 95 Ships in 3-5 days
-os28075 100 Ships in 3-5 days
-os28076 100 Ships in 3-5 days
-os28077 97 Ships in 3-5 days
-os28080 84 Ships in 3-5 days
-os28081 100 Ships in 3-5 days
-os28082 99 Ships in 3-5 days
-os28084 95 Ships in 3-5 days
-os28085 1 Ships in 3-5 days
-os28086 100 Ships in 3-5 days
-os28087 30 Ships in 3-5 days
-os28108 90 Ships in 3-5 days
-os28109 100 Ships in 3-5 days
-os28110 99 Ships in 3-5 days
-os28111 99 Ships in 3-5 days
-os28112 100 Ships in 3-5 days
-os28113 100 Ships in 3-5 days
-os29000 97 Ships in 3-5 days
+sku quantity stock_message account cogs_account min_order
+gift_cert 10000 In Stock
+os28004 92 Ships in 3-5 days
+os28005 100 Ships in 3-5 days
+os28006 90 Ships in 3-5 days
+os28007 85 Ships in 3-5 days
+os28008 100 Ships in 3-5 days
+os28009 95 Ships in 3-5 days
+os28011 40 Ships in 3-5 days
+os28044 100 Ships in 3-5 days
+os28057a 100 Ships in 3-5 days
+os28057b 29 Ships in 3-5 days
+os28057c 50 Ships in 3-5 days
+os28062 88 Ships in 3-5 days
+os28064 94 Ships in 3-5 days
+os28065 100 Ships in 3-5 days
+os28066 100 Ships in 3-5 days
+os28068a 100 Ships in 3-5 days
+os28068b 99 Ships in 3-5 days
+os28069 100 Ships in 3-5 days
+os28070 0 Ships in 3-5 days
+os28072 100 Ships in 3-5 days
+os28073 0 Ships in 3-5 days
+os28074 95 Ships in 3-5 days
+os28075 100 Ships in 3-5 days
+os28076 100 Ships in 3-5 days
+os28077 97 Ships in 3-5 days
+os28080 84 Ships in 3-5 days
+os28081 100 Ships in 3-5 days
+os28082 99 Ships in 3-5 days
+os28084 95 Ships in 3-5 days
+os28085 1 Ships in 3-5 days
+os28086 100 Ships in 3-5 days
+os28087 30 Ships in 3-5 days
+os28108 90 Ships in 3-5 days
+os28109 100 Ships in 3-5 days
+os28110 99 Ships in 3-5 days
+os28111 99 Ships in 3-5 days
+os28112 100 Ships in 3-5 days
+os28113 100 Ships in 3-5 days
+os29000 97 Ships in 3-5 days