[ic] Sold Out Help

jojo@buchonline.net jojo@buchonline.net
Mon, 4 Dec 2000 16:11:21 +0100 (CET)


On  4 Dec, Victor Nolton wrote:
> For the sold out items in my current store I just have a column 
> titled SOLDOUT. Putting a X in there makes the item unorderable on 
> all pages. The problem is the client just wanted me to incorperate a 
> fast order system where they enter the item number and the quantity. 
> Well that works wonderfully. But the problem with this is,  if the 
> item is SOLDOUT it still shows up in the basket.
> 
> Is there any kind of subroutine or anything SIMPLE I could do to the 
> shopping cart that says
> [if-item-field SOLDOUT]
> Do nothing aka don't add to cart
> [else]
> Add the item as usual
> [/else]
> [/if-item-field]
> 
> There are only 2 bugs keeping this store offline right now  and this is one.
> Suggestions? or previous posts I might of overlooked?
> 
> Ven
> 
> http://www.vensnews.com


Not tested....

######## set quantity of item to 0, if field SOLDOUT exist
#
#
#
UserTag soldold Interpolate 1
UserTag soldold Routine <<EOF
sub {
	package Vend::Interpolate;
        my $cart;
	$cart = $Vend::Items;
        my $code; 
        my $out;
        my $db = 'products';
        my $field = 'SOLDOUT';
        foreach my $item (@$cart){
                $code = $item->{code}; 
                $out = Vend::Interpolate::tag_data($db, $field, $code);
                if($out) { $item->{quantity} = 0; }
                # or if($out =~/X/} { $item->{quantity} = 0; }

        }
        return '';
}
EOF


Store this as a file "usertag/soldout" and call it at the top of your
basket and/or checkout page like

[soldout]


Joachim

-- 
Hans-Joachim Leidinger
buch online                 jojo@buchonline.net
Munscheidstr. 14            FAX: +49 209 1671441
45886 Gelsenkirchen         FAX: 0209 1671441