Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi, I am trying to do a product details page for a clothing site. I am placing colours and sizes in two drop down list boxes. The problem i am having is that i get a lot of reapeating values as a result i.e for each colour there are a number of different sizes so i get

 

ddlcolours ddlsizes

 

navy x

navy s

navy m

black x

black s

 

etc etc. Can I make the ddl's only show unique values or do I need to rethink my SQL statement?

 

Dim strSQL As String = "select distinct px.filename,p.description, c.description as 'colours',s.description as 'sizes' from productsXcolours px " _

& "INNER JOIN products p ON px.productID = p.productID " _

& "INNER JOIN colours c on px.colourID = c.colourID " _

& "INNER JOIN productsxsizes pxs ON p.productID = pxs.productID " _

& "INNER JOIN sizes s ON pxs.sizeID = s.sizeID " _

& "where px.productID = '" & (prodID) & "' ;"

 

thank you for your time. :D

You can not get ye flask.
  • Moderators
Posted

I just thought of something, what if the user selects a color and size that do not exist?

 

Isn't it better to display each color and size per product as the user selects a product?

Visit...Bassic Software
Posted (edited)

Thanks alot Robby, the two separate sql statements worked great.

 

Im only displaying the related colours and sizes for any one product at a time. Is that what you meant in your last reply? Or do you think I should repopulate the sizes ddl depending on what colour is selected. Yeah thats probably a good idea.

Edited by mr relaxo
You can not get ye flask.
  • Moderators
Posted

What I'm thinking is; When you search a product by ID it will return (let's say) red, white, black, and Small, Med, Large, XLarge.

 

Does this mean that each color has a matching size?

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...