![]() |
Show BreadCrumbs on showsearchresults.asp |
Post Reply ![]() |
Author | |
bkats ![]() Newbie ![]() Joined: 24-November-2005 Location: United States Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() Posted: 05-June-2008 at 10:49pm |
Hello,
After performing a search, the results are displayed with a section at the top where you can narrow the search by category. We would like to display the entire category tree due to the fact we have many categories with the same name under different parent categories.
To give an example we have 2 categories as follows:
ROOT>Men's>Jackets
and
ROOT>Women's>Jackets
So when a search is performed the user may see 2 links name "Jackets" in the section at the top where they can narrow the search. However, as it is, they don't know which one to click on depending if they are looking for a Men's or Women's Jacket.
We would like to have it display as follows in the section at the top where they can narrow the search:
Men's>Jackets
Women's>Jackets
rather than:
Jackets
Jackets
I hope this is making sense.
Can anyone out there help us?
Thank you! |
|
![]() |
|
Hamish ![]() Admin Group ![]() Joined: 12-October-2006 Location: United Kingdom Status: Offline Points: 56 |
![]() ![]() ![]() ![]() ![]() |
Hi,
A good starting point may be the code for dynamic category navigation from the EA website. I haven't looked at it in a while, but I reckon it would be fairly straight forward to extract a list of the "breadcrumbs" for each category which could then be used as you wish. There may already be suitable code in the search for adapting as well. |
|
![]() |
|
cmason ![]() Senior Member ![]() Joined: 18-June-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
It's not exactly straightforward because the category display in showsearchresults.asp is very different than viewcategories.asp. Plus there are two queries involved on showsearchresults.asp, one for the details and one for the scrolling category list in the JavaScript window. We've removed the JavaScript scrolling window code so I can't give you line numbers. Also, we've standardized on linking products to categories only on tier 3 categories so this idea may not work for everyone.
Below is what I think should work but every time I add "categories.idParentCategory" to the first step it slows the query down so much it's unusable. I can't figure out why adding a field to the select is having that effect. Can anyone spot where I'm stinking thinking? 1. Go to inc_srcPrdQuery.asp and find the line "SELECT "& pcv_strLimitPhrase &" COUNT(categories.idcategory) AS ProductCount, categories.idcategory, categories.categoryDesc " and add categories.idParent so it looks like "SELECT "& pcv_strLimitPhrase &" COUNT(categories.idcategory) AS ProductCount, categories.idcategory, categories.categoryDesc, categories.idParentCategory " 2. Next go to inc_srcPrdsCAT.asp page find "<%Do while not rsCAT.eof" and under "tmp_CatName=rsCAT("categoryDesc")" add cw_ParentID = rsCat("idParentCategory") cwSQL="SELECT categoryDesc FROM categories WHERE (idCategory = "&cw_ParentID&"" set rsParent=conntemp.execute(cwSQL) cw_ParentDesc = rsParent("categoryDesc") Then find the link "<li><a href="javascript:document.ajaxSearch.idcategory.value='<%=tmp_CatID%>';document.ajaxSearch.submit();" <%if scStoreUseToolTip="1" then%>onmouseover="javascript:document.ajaxSearch.idcategory.value='<%=tmp_CatID%>'; sav_callxml='1'; runXML('cat_<%=tmp_CatID%>');" onmouseout="javascript: sav_callxml=''; hidetip();"<%end if%>><%=tmp_CatName%></a> (<%=tmp_CatCount & tmp_CatCountMessage%>)</li>" and add the parent description by changing it to <li><a href="javascript:document.ajaxSearch.idcategory.value='<%=tmp_CatID%>';document.ajaxSearch.submit();" <%if scStoreUseToolTip="1" then%>onmouseover="javascript:document.ajaxSearch.idcategory.value='<%=tmp_CatID%>'; sav_callxml='1'; runXML('cat_<%=tmp_CatID%>');" onmouseout="javascript: sav_callxml=''; hidetip();"<%end if%>><%=cwParentDesc%> / <%=tmp_CatName%></a> (<%=tmp_CatCount & tmp_CatCountMessage%>)</li> then find "set rsCAT=nothing" and above it put "set rsParent=nothing" |
|
![]() |
|
cmason ![]() Senior Member ![]() Joined: 18-June-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
Small oops the link s/b cw_ParentDesc not cwParentDesc
|
|
![]() |
|
cmason ![]() Senior Member ![]() Joined: 18-June-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
Figured it out. the first query didn't have any error catching so it was trying to continue on an that's why it timed out. That query is a Group By query so in inc_srcPrdQuery.asp "query=query& "GROUP BY categories.idcategory, categories.categoryDesc" needs to have the idParentCategory added to become query=query& "GROUP BY categories.idcategory,categories.categoryDesc,categories.idParentCategory"
The other problem was the typo mentioned previously so the li in s/b <li><a href="javascript:document.ajaxSearch.idcategory.value='<%=tmp_CatID%>';document.ajaxSearch.submit();" <%if scStoreUseToolTip="1" then%>onmouseover="javascript:document.ajaxSearch.idcategory.value='<%=tmp_CatID%>'; sav_callxml='1'; runXML('cat_<%=tmp_CatID%>');" onmouseout="javascript: sav_callxml=''; hidetip();"<%end if%>><%=cw_ParentDesc%> / <%=tmp_CatName%></a> (<%=tmp_CatCount & tmp_CatCountMessage%>)</li> This will give an output of "Parent Description / Category Description" as the link. |
|
![]() |
|
cmason ![]() Senior Member ![]() Joined: 18-June-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
Note: to keep the categories grouped together under their parent category.
In inc_srcPrdQuery.asp near the bottom of the page add idParentCategory first in the Order By. It won't be alpha order but at least all the categories will appear under the same parent. query=query& "ORDER BY categories.idParentCategory,categories.categoryDesc; " |
|
![]() |
|
angel ![]() Newbie ![]() ![]() Joined: 26-June-2008 Location: Dhaka Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
cmason,
Can you please summarize your thoughts so that I can have the same?
|
|
Sultan Arefin
www.chorka.com |
|
![]() |
|
cmason ![]() Senior Member ![]() Joined: 18-June-2008 Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
1. In "inc_srcPrdQuery.asp" add "categories.idParentCategory" so the rsCat query results include the id for the parent category.
2. In "inc_srcPrdsCAT.asp" use the idParentCategory from rsCat to pull the parent category's description and add it to the link that displays the categories. It's pretty simple, once you know where the code is located. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |