[ic] Minimum and batch pricing

jlgates at morningstarwebservices.net jlgates at morningstarwebservices.net
Tue Oct 21 01:11:00 EDT 2003

The instructions below are directly from the How To section on the

In Step Two as seen below [batch] is supposed to be placed before
[item-list]. The only way I could find with some help to place [batch]
before [item-list] in the basket.html was to place it above the line <!--
placeholder --> which is inside the content box on the basket.html
template page. I am not at all sure if that is correct.

In Step Three as seen below the UserTag batch Routine code is supposed to
be placed in the catalog.cfg but there is no mention where in the file it
should go. Is there a specific place in the file for this code?

I have done these steps but I do not get the desired results. I do not
know what I did wrong. Can any one point me in the right direction to get
this set up correctly?

Is the text inside of the curly brakets {message} as found below where I
would place my message?


  minimum quantity is the least number of items
  for a given sku than can be ordered.

  batch quantity always exactly divides the number of
  items (above the minimum quantity) that must be
  ordered at once

Step One:

  Change your products database to include two extra
  fields: min_qty and batch_qty

  For a SQL database, you can use this:


Step Two:

  In your shopping cart page (usually ord/basket.html
  or similar file), add a


  tag before the



  If you would like to display a message to the user of
  the catalog when quantities have to be adjusted to
  meet the minimum and batch quantity requirement, then
  include the code below in your shopping cart page at
  the location you want the message to appear.


Step Three:

  Edit your catalog.cfg and add the code below to it.
  You may want to customize the message that will be
  displayed when quantities are adjusted by [batch]

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 = 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;
	<p style="font-size: 10px">
	You must order at least $min items.
	<p style="font-size: 10px">
	Additional items must ordered in multiples of $batch.

	$Vend::Items->[$index]{quantity} = $nqty;
	$Vend::Items->[$index]{message} = $message if $oqty != $nqty;
	$Vend::Items->[$index]{message} = "" if $oqty == $nqty;

More information about the interchange-users mailing list