Jump to content

help with menus


stephdowney

Recommended Posts

Hi,
i'm designing an online shop and have 2 tables in my database (categories and products) I need to have a menu that lists all categories and then when a categorie is clicked it exapnds to show all th products within that category....any help would be great
thanks
steph
Link to comment
Share on other sites

Yo,

Hmmm, make a default categorie.. maybe the first found.. and, you will need one page.. with the table, if ALL products of ALL categories are children of the products table.. if some field change.. you may have a layout problem.. ;)

so.. use a [b]SELECT id, title FROM categories ORDER BY categories[/b]..

The result.. create your menu!

=) D.Soul
Link to comment
Share on other sites

If you want it to expand with no need to refresh the browser or open a link, you would have to use Javascript (and to retrieve all the products from all categories upon page load).

If not, you can make the a link for each category (like: ?cat=1), retrieve the chosen category ($_GET['cat']) and use this value to find all the products for the category (SELECT * FROM `products` WHERE category = "$_GET['cat']")
Link to comment
Share on other sites

[!--quoteo(post=366524:date=Apr 19 2006, 01:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 01:01 PM) [snapback]366524[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you want it to expand with no need to refresh the browser or open a link, you would have to use Javascript (and to retrieve all the products from all categories upon page load).

If not, you can make the a link for each category (like: ?cat=1), retrieve the chosen category ($_GET['cat']) and use this value to find all the products for the category (SELECT * FROM `products` WHERE category = "$_GET['cat']")
[/quote]


hey thanks for the help but i'm totally new!!
any snippets of code ....i kinda understand but dunno how 2 put it all 2gether!
cheers steph
Link to comment
Share on other sites

[!--quoteo(post=366524:date=Apr 19 2006, 03:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 03:01 PM) [snapback]366524[/snapback][/div][div class=\'quotemain\'][!--quotec--](and to retrieve all the products from all categories upon page load)[/quote]
I know that's work, but, guy.. drunk me before I do that.. do you think how long it can be? I know it have no real problem.. but.. x-x"

If you want to do it (click on categorie and its drop down the data), think about use iframe to suporte dinamic querys.. then, when you click the categorie, its load the right query and recover the data..

I have no code sample with me here.. but look for it, is not a rare thing.. ^~

=3 D.Soul
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.