[ic] minimum buy user tag
Crystal Park
service at crystalpark.com.au
Sun Jun 26 23:46:03 EDT 2005
Hey Guys
How can I make this work on the options table rather than products..
interchange 4.8.9
UserTag batch Routine <<EOR
sub {
foreach my $index (0 .. $#$Vend::Items) {
my $code = $Vend::Items->[$index]{code};
my $oqty = $Vend::Items->[$index]{quantity};
my $base = $Vend::Items->[$index]{mv_ib};
my $nqty = $oqty;
my $batches = undef;
my $min = Vend::Data::database_field($base, $code,
"min_qty", undef);
my $batch = Vend::Data::database_field($base, $code,
"batch_qty",
undef);
$batch = 1 if $batch <= 1;
$min = 1 if $min <= 1;
$nqty = 0 if $nqty <= $min;
$nqty = $nqty - $min if $nqty > $min;
$batches = int($nqty / $batch);
$nqty = $min + $batches * $batch;
my $message = <<EOM;
<br>
<p style="font-size: 10px">
You must order at least $min items.
</p>
<p style="font-size: 10px">
Additional items must ordered in multiples of $batch.
</p>
EOM
$Vend::Items->[$index]{quantity} = $nqty;
$Vend::Items->[$index]{message} = $message if $oqty != $nqty;
$Vend::Items->[$index]{message} = "" if $oqty == $nqty;
}}
EOR
Many thanks!
Antony
www.crystalpark.com.au
More information about the interchange-users
mailing list