473,499 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to show category then all products in category for each category

1 New Member
I am trying to show a category, for example shoes and then show all the shoes in that category and then show the next category and all the products in that category and so on. I am able to show all the products but the category part I can't think of how to do.
I have this so far displaying the products:
Expand|Select|Wrap|Line Numbers
  1. <CFLOOP QUERY="Prods" STARTROW="#URL.Start#" ENDROW="#Variables.EndRow#">
  2.     <cf_RecurseCategories 
  3.         id="#qProds.CategoryID#"
  4.         divider=""
  5.         output="Text">
  6.     <CFQUERY NAME="qSaleProds" DBTYPE="query">
  7.         SELECT * FROM qSaleProducts
  8.  
  9.     </CFQUERY>
  10. <A HREF="link.cfm"><IMG SRC="product_photos/thumbnails/#URLEncodedFormat(Prods.Image_Thumb)#" WIDTH="140" ALT="#HTMLEditFormat(Prods.ProductName)#" BORDER="0"><BR>
  11.         <font class="productName">#Prods.manufacturer#<br>#Prods.ProductName#</font><BR>
  12.         <CFIF SaleProds.SalePrice gt 0 AND SaleProds.SalePrice lt qSaleProds.RetailPrice>
  13.             <B CLASS="RedText">ON SALE:</B> <B><font class="productName">#DollarFormat(SaleProds.SalePrice)#</font></B>
  14.             <br><font class="productpricestrike">#DollarFormat(Prods.RetailPrice)#</font>
  15.         <CFELSE>
  16.             <font class="productName">#DollarFormat(Prods.RetailPrice)#</font>
  17.         </CFIF>
  18.         </A>
Feb 15 '12 #1
1 3002
acoder
16,027 Recognized Expert Moderator MVP
I would imagine there would be a foreign key in the products table, so add a WHERE clause to filter by CategoryID, e.g.
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM qSaleProducts
  2. WHERE CategoryID = #qProds.CategoryID#
Feb 27 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4589
by: Rich Protzel | last post by:
Hello, So my table contains say 100,000 records, and I need to group the categories in fld1 by the highest count of subcategories. Say fld1 contains categories A, B, C, D, E. All of these...
0
1162
by: UrsaMaj0r | last post by:
At install, I was asked what my usual product would be. I chose Web Developer. Now, Whidbey goes there immediately on stat up. But I want to easily choose other installed products. How do I get the...
16
1743
by: William Buchanan | last post by:
Hi folks I want to show 2 records on a page side by side. Each record has an image which will be displayed and a bit of text. How can I do this? Thanks Will
7
3517
by: Barkster | last post by:
I'm trying to list my categories and how many items are in each category. I'm not much on sub queries. How can I combine these two items. I'd like to display the category and the corresponding...
7
7851
by: FrankEBailey | last post by:
I'm not sure if this is a completely dumb question, but please humor me :) I have a table of records, called Records, each of which has a Category_ID that places it in a specific category; the...
1
1787
by: liesther2003 | last post by:
Hi i want to show mutli layer by each click, and when i click next layer the first layer should be still display, until maybe 3rd or 4th or 5th layer all are displayed, and at the end when i click...
6
1866
by: prathna | last post by:
hi all.. Im new to DHTMl,Javascript I have 4 rows each with a dropdownlist,textfield.I have a link.When the user clicks a link first time.i show one row now based what i select in the...
1
3857
realayumi
by: realayumi | last post by:
ACCESS 2003 WIN XP Hi, i'm new in access, just a view days, this is my first post. Sorry for my bad English. I have 3 tables. tbl_product
0
1086
by: mumtaz | last post by:
I have an access database containing one Table having Field1, Field2, Field3, Field4 and Field5. I want to generate an HTML table in my ASP page and show the records of all the five fields along...
0
1261
by: luciacs | last post by:
Hi, I'm a completely novice in HTML and I'm trying to create a portfolio. I have a pull down menu and each section has more categories, and I want to click to each category, and see a picture on...
0
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.