Jump to content


Photo

help with menus


  • Please log in to reply
4 replies to this topic

#1 stephdowney

stephdowney
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 19 April 2006 - 05:37 PM

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

#2 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 19 April 2006 - 06:00 PM

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 SELECT id, title FROM categories ORDER BY categories..

The result.. create your menu!

=) D.Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)

#3 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 19 April 2006 - 06:01 PM

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']")
~ D Kuang

#4 stephdowney

stephdowney
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 19 April 2006 - 06:58 PM

[!--quoteo(post=366524:date=Apr 19 2006, 01:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 01:01 PM) View Post[/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

#5 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 19 April 2006 - 07:12 PM

[!--quoteo(post=366524:date=Apr 19 2006, 03:01 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 19 2006, 03:01 PM) View Post[/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

(If something is wrong, please tell me. I'm learning this language. Thank you)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users