SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Romania
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Retrieve full category path for a product

    Hello,

    I'm building a shopping cart and I would like to know how can I get the full category path for a product.

    Let's say I have the following category structure: "Electronics (parent) -> TV -> Plasma TV" and my product belongs to the last category.

    How should I write a script to return full category path like the one above.

    My categories table looks like this:
    - category_id
    - category_parent_id
    - category_name

    Thank you.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    sample breadcrumb query here: http://sqllessons.com/categories.html

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Romania
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great resource, thanks! But I don't know how to write the "were" clause


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •