Jump to content

Archived

This topic is now archived and is closed to further replies.

stephdowney

help with menus

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

Share this post


Link to post
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

Share this post


Link to post
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']")

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.