MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: Total number of products in DB?



******    message to minivend-users from Frank Miedreich <miedreich@acm.org>     ******

At 05:54 PM 4/15/99 , August Detlefsen wrote:
>******    message to minivend-users from August Detlefsen
<augustd@idiom.com>     ******
>
>Is there a tag for displaying the total number of products in the products
database?
>
>For example if you wanted your first page to say "We have 12,398 products
for you to choose from!"
>
>-August
>--
>mailto:augustd@idiom.com

The Maker has provided you with a solution to your problem in 3.12.

In minivend.cfg you will find:

# [db-count table]
#
# This tag returns the number of records in a database table,
# 'products' by default.
#
UserTag  db-count  Order table
UserTag  db-count  PosNumber 1
UserTag  db-count  Routine <<EOF
sub {
    my ($db) = @_;

    $db = 'products' unless $db;

    my $ref = Vend::Data::database_exists_ref($db)
        or return "Bad table $db";
    $ref = $ref->ref();
    my $count;
    while ($ref->each_record()) {
        $count++;
    }
    return $count;
}
EOF


Personally I would cheat and hard code a statement like this if your
catalog has more than 10k products.

Cheers, Frank

--
Frank Miedreich
Max-Planck-Institut fuer psychologische Forschung


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: