[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
How to rotate select items on a page/frameset
****** message to minivend-users from Kyle Cook <kyle@invisio.com> ******
At 08:10 AM 4/21/99 -0400, you wrote:
>****** message to minivend-users from Larry Leszczynski
><larryl@furph.com> ******
>
>Hi Kyle -
>
>> [perl]$Safe{'scratch'}{'ncount'} = 27;[/perl]<br>
>
>This should be:
>
> [perl scratch]$Safe{'scratch'}{'ncount'} = 27;[/perl]<br>
> ^^^^^^^
Thanks to Larry pointing out the [perl scratch] (which I could not
find in the docs) I have a working bit of code that rotates products
based on a search of the database (in my case a special field
that is set with 'new stock' when new items are added to the
database). I include this code in a footer.html file which I [include page]
on every page so that as the customer navigates through the site each
page includes the next 'new stock' item and then starts over at the
beginning. This could also be easily modified to display the "top x"
selling products. It could also be used in frame sets which have
a meta refresh tag.
Here is the code for those who are interested. Please don't criticize
me too much as I have only been working with Minivend for a few
weeks now ;)
Rotate code:
-----------------------------------------------------------------
[if scratch pcount eq ""][set pcount]0[/set][/if]
[if scratch pfound != 2]
[set pcount]0[/set]
[else]
[perl scratch interpolate=1]$Safe{'scratch'}{'pcount'} =
$Safe{'scratch'}{'pcount'} + 1; return '';[/perl]
[/else]
[/if]
[set pfound]0[/set]
[loop search="
se=new stock
sf=13
fm=[scratch pcount]
ml=2
"]
[if scratch pfound == 1]
[set pfound]2[/set]
[else]
[set pfound]1[/set]
<!-- insert displayed item here -->
[page href="[loop-code]"]
[loop-description]
Price: [loop-price]
<!-- end displayed item here -->
[/else]
[/if]
[/loop]
-----------------------------------------------------------------
Note: the line with the perl tag should be on 1 line, that way you
don't have to upload via ascii
Enjoy!
Kyle Cook
http://www.invisio.com
Web site design, database driven sites,
and shopping cart programming.
Great sites, value priced!
-
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