VP-ASP New User
Posted - October 04 2012 : 15:57:27
| how can i make this work in v7?
This code is simple and allows you to use the routine in shoprandomproducts.asp to display featured items anywhere on your site.
Example of how we used this code
We treat each catagory as a seperate store and each store has it own look and featured items. By using this code we can have random or set items display anywhere and with their own look.
First thing to do is make a copy of the file shoprandomproducts.asp and rename it to something meaningfull. In this example we named it shoprandomproductsFeatureItem.asp
Open your new file (shoprandomproductsFeatureItem.asp) and on line 2 replace:
*note I changed the name of the function just in case you need to call this procedure from your home page so it wont mess up your normal featured products.
Now go to line 17
Go to line 37
Save and close the file.
To display your featured items You need to make sure the following files are included in your page.
To display your product just paste the following code where you would like the items to apear.
<% DisplayrandomProductsFA "Specials","tmp_frontpageSpecials.htm" %>
The code above makes a call to the random product generator but passes along criteria that tells it only show products that have the word "Specials" in the frontpage field on the product table. It also passes along a template to display the product. If you want to call this procedure multiple times and display different products, simply change the name of the criteria you pass.
Example you may want to show christmass specials on one page and Halloween on another. To do that go into your products table and enter the word"Christmass" in the "Frontpage" field. Do the same for a halloween item but type "Halloween" in the frontpage field.
When you make your function calls they would look like this:
<% DisplayrandomProductsFA "Christmass","tmp_Christmass.htm" %>
<% DisplayrandomProductsFA "Halloween","tmp_Halloween.htm" %>
Note you dont have to use seperate templates, you can just pass the standard template Tmp_frontpage.
If you do want to generate random products sometimes, then pass the criteria "Random"