Index  Up  <<  >>  


The browse page (from the demo) is SLOW+!

(This old page is not used any more starting at 3.12.)

That is because it is only useful for small product lines. It pulls out all keys from the entire database and iterates over them, which is not reasonable for more then 50 products or so (depending on your server speed).

A better approach is to use a search and browse by category, an example of which is given in the demo.

You could also try something like:

    [perl]
            $start = $Session->{arg} || 1;
            $chunk = 1;
            if($start =~ /(\d+):(\d*)/) {
                    $start = $1;
                    $chunk = $2 || 1;
            }
            $prev = $start - $chunk;
            if($prev < 1) {
                    $prev = 0;
            }
            $Scratch->{'start'} = $start;
            $Scratch->{'chunk'} = $chunk;
            $Scratch->{'next'} = $start + $chunk;
            $Scratch->{'prev'} = $prev;
            $Scratch->{'not_shown'} = 1;        return '';
    [/perl]
  
    [search-region arg="
                        ra=yes
                        fm=[scratch first]
                        ml=[scratch chunk]
                        sp=browse
                        tf=category
                        to=f         "]
    [search-list]
    
    [item-change 1]
    [condition][item-field category][/condition]
    <TABLE WIDTH="80%"><TR BGCOLOR="#cccccc" TEXT="WHITE"><TD ALIGN=CENTER>
        <BR><H1>[item-field category]</H1>
    </TD></TR></TABLE>
    [/item-change 1]
    <P>
    [if-item-field image]
    <IMG SRC="[item-field image]">
    <P>
    [/if-item-field]
  
    <H2>[item-description]</H2>
    <P>
    [L]Catalog[/L] [L]Number[/L]: [item-code]
    <P>
    [L]Price[/L]: [item-price]
    <P>
    [page [item-code]]<IMG BORDER=0
            SRC="details.gif" ALT="[L]More Info[/L]">[/page]
    [order [item-code]]<IMG BORDER=0
        SRC="ordernow.gif" ALT="[L]ORDER NOW[/L]">[/order]
    [/search-list]
    [/search-region]

    [if scratch prev]
    [page href=browse1 arg="[scratch prev]:[scratch chunk]"]
        <B>[L]Previous[/L]</B>
        </A>&nbsp;&nbsp;
    [/if]
    [if type=explicit compare="[calc]
                [value mv_search_match_count] > [scratch next]
                [/calc]"]
    [page href=browse1 arg="[scratch next]:[scratch chunk]"]<B>[L]Next[/L]</B></A>
    [/if]

Index  Up  <<  >>