carfin
VP-CART Expert
United Kingdom
948 Posts |
Posted - November 17 2009 : 06:36:12
|
Hi,
I'm pretty sure that you can't set up dynamic category display on your default.asp (home) page, unless Simon at Big Yellow Zone has something that can do this. However there is a way round it by modifying tmp_default.htm to include your welcome message and your categories with hand coded links to shopdisplaycategories.asp or shopdisplayproducts.asp, and then add this file to the template file field in the Home Content record instead of the welcome information in the Home Content Body field. It's a fair amount of extra work to alter the template any time you change your categories and I would not recommend it for a site with a large number of categories.
Regards,
Carrol www.deanston-electrical.co.uk |
|
|
devshb
Senior Member
United Kingdom
1904 Posts |
Posted - November 17 2009 : 08:34:43
|
The closest we've got is: BYZ093 - Product ShowCase (Enhanced Front-Page) Functions for VP-ASP: http://www.bigyellowkey.com/mysoftware_product_details.asp?prdid=222&opu=n
Which, inside it, has an example call which shows the full list of categories with random products from each category as images (the last/bottom example at the bottom of the demo page that's linked from the url above). by default it links to shopdiplayproducts instead of shopdisplaycategories (ie it doesn't consider the hassubcategory value), but it could in theory be used as a base for showing a list of categories within default.asp etc. the example isn't perfect, it's only used as a rough guide/template, but in case anyone wants to use logic which can show categories dynamically using a set number of columns across the page, here's a copy of the sample call (make sure you change the "5000" in the arrays to something smaller which is relevant to your site, or change it to display the html within the actual loop without using arrays), you'd replace the "BYZShowCaseProducts" function call with a straight-forward display of the category image. This is a very very rough template/example of some of the relevant logic, you can't just use it as-is, but it might help some people. For example, the row/column logic (ie when it breaks to a new row) is quite handy.
Sub BYZShowCaseDemoCategoryBox Dim tsql Dim tconn Dim trs Dim tcategoryids(5000) Dim tcategorydescs(5000) Dim tcategoryurls(5000) Dim tcategorycount Dim i Dim tcols Dim maxcols Dim tlinkstart Dim tlinkend tsql="SELECT categoryid,catdescription FROM categories" tsql=tsql&",prodcategories,products" tsql=tsql&" where intcategoryid=categoryid" tsql=tsql&" and catalogid=intcatalogid" tsql=tsql&" and cathide is null" tsql=tsql&" and (hide=0 or hide is null)" tsql=tsql&" group by categoryid,catdescription" ShopOpendatabase tconn Set trs=Server.CreateObject("ADODB.Recordset") trs.LockType=adLockReadOnly trs.CursorType=adOpenForwardOnly Set trs=tconn.Execute(tsql) tcategorycount=0 While Not trs.EOF tcategorycount=tcategorycount+1 tcategoryids(tcategorycount-1)=trs("categoryid") tcategorydescs(tcategorycount-1)=trs("catdescription") tcategoryurls(tcategorycount-1)="shopdisplayproducts.asp?id="&tcategoryids(tcategorycount-1)&"&cat="&Server.URLEncode(tcategorydescs(tcategorycount-1)) trs.MoveNext Wend trs.Close Set trs=Nothing ShopClosedatabase tconn
maxcols=3 tcols=0 for i=1 to tcategorycount if (i=1) then Response.Write "<table border=0 cellpadding=0 cellspacing=10>" Response.Write "<tr>" tcols=1 else tcols=tcols+1 if (tcols>maxcols) then Response.Write "</tr><tr>" tcols=1 end if end if tlinkstart="<a href="&chr(34)&tcategoryurls(i-1)&chr(34)&">" tlinkend="</a>" Response.Write "<td valign=top align=center>" BYZShowCaseProducts _ "", _ "", _ "", _ "", _ "", _ "", _ "", _ "", _ "exists (select 1 from prodcategories where intcatalogid=catalogid and intcategoryid="&tcategoryids(i-1)&")", _ "tmp_byz_showcase_category.htm", _ "", _ "Y", _ "1", _ "1", _ "<table border=0 cellpadding=0 cellspacing=0><tr><td><center><b>"&tlinkstart&tcategorydescs(i-1)&tlinkend&"</b></center></td></tr><tr><td align=center valign=top><table border=0 cellpadding=0 cellspacing=0>", _ "</table></td></tr></table></a>", _ "<tr>", _ "</tr>", _ "", _ "", _ "<td align=center valign=top>"&tlinkstart, _ tlinkend&"</td>", _ "", _ "", _ "", _ "" Response.Write "</td>" next if (tcategorycount>0) then for i=1 to (maxcols-tcols) Response.Write "<td> </td>" next Response.Write "</tr>" Response.Write "</table>" end if End Sub
Simon Barnaby Developer [email protected] www.BigYellowZone.com Web Design, Online Marketing and VPASP addons |
|
|