Author |
Topic |
|
Agravane
Starting Member
34 Posts |
Posted - May 09 2005 : 17:08:21
|
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: Sub Displayrandomproducts With: Sub DisplayrandomproductsFA(Search,CTemplate) *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 replace: template="tmp_frontpage.htm" with: template= CTemplate
Go to line 37 Replace: selectvalue=getconfig("xfrontpagevalue") With: selectvalue=Search
Save and close the file.
To display your featured items You need to make sure the following files are included in your page.
<!--#include file="shop$db.asp"--> <!--#include file="shoprandomproductsFeatureItem.asp"--> <!--#include file="shopfileio.asp"-->
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"
If you have any questions, you can email me at [email protected]
Edited by - Agravane on May 09 2005 17:50:51 |
|
dcwebman
VP-CART New User
USA
127 Posts |
Posted - May 10 2005 : 07:01:37
|
Thanks for sharing. Can you give your website URL so we can see what it looks like in action?
|
|
|
Agravane
Starting Member
34 Posts |
|
webyhost
Starting Member
USA
35 Posts |
Posted - October 02 2009 : 16:05:13
|
Hello,
I am trying this out and I am getting the following error.
http://www.miamibeachnutrition.com/defaulttest.asp
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'shopopendatabaseP'
/shoprandomproductsFeatureItem.asp, line 12
Any help would be greatly appreciated.
Thank you! |
|
|
|
Topic |
|