小邹在线

小时候,希望自己快点长大,长大了,却发现遗失了童年;单身时,开始羡慕恋人的甜蜜,恋爱时,怀念单身时的自由。 很多事物,没有得到时总觉得美好,得到之后才开始明白:“我们得到的同时也在失去。”

上一篇: 中小型做外贸用什么免费邮箱好?Google app企业邮局 下一篇:【安全攻略】如何自定义网站后台地址(附解决rewrite空间目录问题)

一直以来,我以及我周围的朋友对阿里巴巴产品分类情有独钟,具体截图如下:

除了长期使用下来的操作习惯,这样做产品分类的确有很独特的优点:1.树形结构,一目了然;2.附上产品数量,直接看出哪些是热点,无需再去通过其他途径寻找..

面对这样的分类方式,对我来说是一个不大不小的挑战,为什么呢?挑战一:网站系统从开始到现在一直为单级目录,没有接触过多产品多目录的网站;2.除了程序,这需要一个合适的数据库结构;3.参数循环有点绕头;4.貌似还涉及一点点数组的概念..

还好搞定了..废话不多说了,直接贴上源代码(ASP版),代码写的不简介,这里只记录完成了这一功能,具体的效率优化后续再做努力!

 <div class="winstyle2"> 

<%set rs2=server.createobject("adodb.recordset")

sql2="select * from productdb" 

rs2.open sql2,conn,1,1%>

<h2><img src="<%=weburl%>images/motuo/customGroupTitle.gif" border="0"> Products [<%=rs2.recordcount%>]</h2>

<%rs2.close

set rs2=nothing%>

<ul>

<%set rs=server.createobject("adodb.recordset")

sql="select top 20 typeid,typename from productype where sortid=0 order by typeid asc"

rs.open sql,conn,1,1

if rs.eof and rs.bof then

Response.Write"<br>No productsort!"

end if

do while not rs.eof

sqlid=""

set rs2=server.CreateObject("adodb.recordset")

sql2="select typeid,sortid from productype where sortid="&rs("typeid")

rs2.open sql2,conn,1,1

if rs2.eof and rs2.bof then

sqlid=rs("typeid")

else

do while not rs2.eof

sqlid=rs2("typeid")&","&sqlid

rs2.movenext

loop

end if

rs2.close

set rs2=nothing%>

<li class="oncate" >

<img src='<%=weburl%>images/motuo/open.png' alt='<%=rs("typename")%>' border='0'/> <a href='<%=weburl%><%=StrReplace(rs("typename"))%>.html' title='Chinese <%=rs("typename")%>' target="_self"> <%=rs("typename")%></a> 

<%set rs3=server.CreateObject("adodb.recordset")

sql3="select * from productdb where typeid in("&sqlid&")"

rs3.open sql3,conn,1,1%>

[<%=rs3.recordcount%>]</li>

<%rs3.close

set rs3=nothing

set rs1=server.CreateObject("adodb.recordset")

 sql1="select top 20 typeid,typename,sortid from productype where sortid="&rs("typeid")

 rs1.open sql1,conn,1,1

 if rs1.eof and rs1.bof then

 else

 do while not rs1.eof

set rs4=server.createobject("adodb.recordset")

sql4="select * from productdb where typeid="&rs1("typeid")

rs4.open sql4,conn,1,1%>

<li class="parcate" ><img src='<%=weburl%>images/motuo/icon_arrow.gif' alt='<%=rs("typename")%>' border='0'/> <a href='<%=weburl%><%=StrReplace(rs1("typename"))%>.html' title='Chinese <%=rs1("title")%>' target="_self"> <%=rs1("typename")%></a> [<%=rs4.recordcount%>]</li>

<%rs4.close

 set rs4=nothing

 rs1.movenext 

 loop 

 end if

 rs1.close

 set rs1=nothing

rs.movenext

loop

rs.close

set rs=nothing%>

</ul> 

</div> 

点击这里获取该日志的TrackBack引用地址

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于本文

您正在阅读的是:仿阿里巴巴产品分类 实现自定义分类二级子分类 附ASP代码
livens 发表于:2011-10-2 22:51:12
分类:读网笔记
关键词:仿阿里巴巴产品分类  自定义分类二级子分类  
订阅小邹在线

什么是RSS订阅?查看解释
订阅到您的在线阅读器

抓虾 google reader my yahoo bloglines 鲜果 哪吒

博客作者

livens

最近发表

最新评论及回复

最近留言

控制面板

Search

网站分类

文章归档

图标汇集

在这个紧急的时代,我们输不起慢的代价!
Copyright 2010-2011 www.livens.cn. 小邹在线 Rights Reserved.技术支持:苏州杰优网络