[ic] Backorders on One-of-a-kind items (I don't want 'em!)

Mike Heins mikeh@minivend.com
Thu, 11 Jan 2001 14:49:00 -0500

Quoting Tim (tim@mateosian.com):
> First let me state that I searched the archives before emailing thr gruop.

Hmm, this type of thing has been discussed extensively on the list.

> In many cases I find the preorder and backorder functionaility in
> Interchange4.6 to be useful.  Question is, how do I deal with one-of-a-kind
> items, which I have in many cases?  For instance, someone just ordered 2 of
> something that I have only have 1 of.   I have no way of fulfilling the
> backorder and would like to be able to restrict this from happening for
> one-of-a-kind items.

All of this type of thing needs to be done with cart manipulation. There
are many, many, examples of this that I have posted to the list. Here is
yet another one.

Probably the easiest thing is to preload the inventory type with this
in catalog.cfg:

    AutoModifier  inventory:no_backorder

You would have to add a DB field to inventory for that one.
It is a flag to signal that it is a one-of-a-kind item.

Then parse the cart at the top of checkout, and:

[perl tables=inventory]
    my @messages;
    foreach my $item (@$Items) {
	next unless $item->{no_backorder};
	my $onhand = tag_data('inventory', 'quantity', $item->{code});
	if($item->{quantity} > $onhand) {
	    $item->{quantity} = $onhand;
	    my $msg =
		"$item->{code} quantity adjusted to $onhand, one of a kind item";
	    push @messages, $msg;

    $Scratch->{cart_adjustment} = join "<BR>", @messages;

[if scratch cart_adjustment]
	We adjusted your basket:
	<BLOCKQUOTE>[scratchd cart_adjustment]</BLOCKQUOTE>

You will want to do this in a checkout profile as well. You cannot
stop the border cases of two people ordering at exactly the same moment
without a lot of work, but even that could be done if you tried hard.

Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Few blame themselves until they have exhausted all other possibilities.
 -- anonymous