- see footer for list info -<
Can anyone help me with tis please. I have not used cftree before
I need a site map which will show all products with a sub category of a
category.
I want to show just the categories then expand to sub categories then expand
to products (If that makes sense...)
Like this ...
<Category (+)>Lathes
<Sub Category(+)>Chucks
<Product> 4 Jaw Chuck
and so on.....
I have this code The first bit proves that my queries are working ok ...
The next bit is my attempt at cftree. The problem is I don't get the (+)
'expand' for each level ...
<!--- Get the categories --->
<CFQUERY NAME="GetCategories" DATASOURCE="#application.dsn#">
SELECT CategoryID, CategoryName, CategoryImage
FROM tblCategories
</CFQUERY>
<cfoutput query="GetCategories">
Category Name - #CategoryName# <p>
<!--- Get the subcategories for this category --->
<CFQUERY NAME="GetSubCategories" DATASOURCE="#application.dsn#">
SELECT DISTINCT tblProducts.FKCategoryID,
tblProducts.FKSubcatID,
tblSubCategories.PKSubcatID,
tblSubCategories.SubcategoryName
FROM tblProducts
INNER JOIN tblSubCategories ON tblProducts.FKSubcatID =
tblSubCategories.PKSubcatID
WHERE (tblProducts.FKCategoryID =
#GetCategories.CategoryID#)
</CFQUERY>
<cfloop query="GetSubCategories">
SubCategory Name - #GetSubCategories.SubCategoryName#<p>
<!--- Now get the products for this subcategory --->
<CFQUERY NAME="GetProducts" DATASOURCE="#application.dsn#">
SELECT ProductName, FKSubcatID
FROM ValeEngineering.tblProducts
WHERE (FKSubcatID = #GetSubCategories.PKSubcatID#)
</CFQUERY>
<cfloop query="GetProducts">
Product Name - #GetProducts.ProductName#<br>
</cfloop>
<p>
</cfloop>
</cfoutput>
<!--- Display the tree. The cftree tag must be in a cfform. --->
<cfform action="action.cfm" preservedata="Yes" format="Flash">
<cftree name = "Menu" height = "400" width = "400"
font = "Arial Narrow" italic="yes" highlighthref="No" HScroll="no"
VScroll="no"
completepath="no" lookandfeel="windows" border="No" required="yes">
<!--- cfoutput tag with a group attribute loops over the departments.
--->
<cfoutput query = "GetCategories">
<cftreeitem value="#CategoryName#" parent="Categories"
expand="yes">
<CFQUERY NAME="GetSubCategories"
DATASOURCE="#application.dsn#">
SELECT DISTINCT tblProducts.FKCategoryID,
tblProducts.FKSubcatID,
tblSubCategories.PKSubcatID,
tblSubCategories.SubcategoryName
FROM tblProducts
INNER JOIN tblSubCategories ON tblProducts.FKSubcatID =
tblSubCategories.PKSubcatID
WHERE (tblProducts.FKCategoryID =
#GetCategories.CategoryID#)
</CFQUERY>
<cfloop query="GetSubCategories">
<cftreeitem value="#GetSubCategories.SubCategoryName#"
parent="Categories" expand="false">
<!--- Now get the products for this subcategory
--->
<CFQUERY NAME="GetProducts"
DATASOURCE="#application.dsn#">
SELECT ProductName, FKSubcatID
FROM ValeEngineering.tblProducts
WHERE (FKSubcatID =
#GetSubCategories.PKSubcatID#)
</CFQUERY>
<cfloop query="GetProducts">
<cftreeitem value="#GetProducts.ProductName#" parent="Categories"
expand="false">
</cfloop>
<p>
</cfloop>
</cfoutput>
</cftree>
<cfinput type="Submit" name="submitit" value="Submit" width="100">
</cfform>
Any Ideas ....?
Regards - Paul
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<