
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Matrix options
Quoting Jerry (jerry@digitalfm.com):
> Using IC 4.8.3 inventory control works great.
> Using matrix options w/inventory is also no
> problem. Removing the buy button on items
> without options is simple enough.
>
> Does anyone have a method of excluding an option
> from the drop down when that particular option
> is out of stock? Currently we are using
> [item-options td=1 label=1 bold=1 price=1]
> to build the drop down when the item is in
> the options database.
>
> We could, of course, just build this with a little
> perl instead of the item-options tag, but thought
> maybe there was a simple way to accomplish this and
> still utilize the item-options tag.
Hmm. I don't think there is a way right now. I will think about
this and see if it makes sense to add an option to exclude based
on a field, something like:
[item-options inventory="inventory:quantity"]
In fact, I thought I would take a couple of minutes and try it.
This patch seems to work (if you don't use separate widgets):
--- /r/Interpolate.pm Wed Nov 21 14:33:10 2001
+++ /rt/Interpolate.pm Fri Dec 14 14:41:42 2001
@@ -2017,6 +2019,14 @@
my $remap;
my %map;
+ my $inv_func;
+ if($opt->{inventory}) {
+ my ($t, $c) = split /[.:]+/, $opt->{inventory};
+ if($db = database_exists_ref($t)) {
+ $inv_func = $db->field_accessor($c);
+ }
+ }
+
if($::Variable->{MV_OPTION_TABLE_MAP}) {
$remap = $::Variable->{MV_OPTION_TABLE_MAP};
$remap =~ s/^\s+//;
@@ -2079,6 +2089,10 @@
next unless $ref->[3];
$i++;
+ if($inv_func) {
+ next if $inv_func->($ref->[0]) <= 0;
+ }
+
# skip unless o_value
$phony->{mv_sku} = $def[$i];
@@ -2146,6 +2160,13 @@
next unless $ref->[1];
# skip unless description
next unless $ref->[3];
+
+ if($inv_func) {
+ my $oh = $inv_func->($ref->[0]);
+::logDebug("on hand for sku=$ref->[0] qty=$oh");
+ next if $oh <= 0;
+ }
+
$ref->[3] =~ s/,/,/g;
$ref->[3] =~ s/=/=/g;
$price->{$ref->[0]} = $ref->[4];
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Fast, reliable, cheap. Pick two and we'll talk. -- unknown
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users