ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Display channel entries depending on category

October 25, 2011 10:08pm

Subscribe [2]
  • #1 / Oct 25, 2011 10:08pm

    Austmel

    4 posts

    Hi All,

    I am new to EE and learning things step by step. What i want to do seems simple but i’m struggling to get the results that i want.

    I have a channel called Products and a category called Products, within the category Products there are many sub categories.

    My particular scenario is this i have a product menu like this:
    +Air Elimination Test
      -Sterilizers
      -Benchtop Sterilizers

    My category like this:
    +Products
      +Air Elimination Test
      -Sterilizers
      -Benchtop Sterilizers

    I have 2 product entries assigned to category sterilizers and 1 product assigned to benchtop sterilizers.

    I want to use 1 template which i have named air_elimination_tests to show the overall products in the category and then the individual product entry.

    To differentiate the sterilizers entries from the benchtop sterilizer entries i have added a heading in the url like this http://www.mysite.com/air_elimination_tests/sterilizers. i have conditionals that if sterilizers is the 2nd segment then show entries from sterilizers category, if benchtop sterilizers is the 2nd segment then show entries from the benchtop sterilizers category.

    This part works fine but my problem comes in when i want to display the actual entry on it’s own - i want the url to remain as http://www.mysite.com/air_elimination_tests/sterilizers/entry_title or www.mysite.com/air_elimination_tests/benchtop_sterilizers/entry_title but what i get is all entries from the category. My link to the entry is:

    a href={title_permalink=air_elimination_tests/sterilizers}>Read full product info…

    I had this working fine when just using http://www.mysite.com/air_elimination_tests/entry_title so i am guessing it is because i have added sterilizers and benchtop_sterilizers into the URL.

    I’m not sure what i can do to get around this or how else to go about it to get the result i would like.

    I hope someone can help me.

    cheers,

    Ben.

  • #2 / Oct 27, 2011 9:21pm

    Boyink!

    5011 posts

    EE doesn’t like to display both a category url title and an entry url title on the together for a single-entry page.  That’s just working against how EE works with URL structures.

    Think of categories as a “hoop” - they present a filtered list of entries at a category url and then once you navigate to a single entry the URL no long displays the category information.

    I think you might be able to get there, but you’ll have to run your single-entry template in “dynamic=“no” mode, use use url_title=”{last_segment}, and create your links to the single entry template in a custom fashion (to get the category segment in there).

    This strikes me as a good use-case to write a tutorial for.  I can’t promise when but I’m making a note of the idea…;)

  • #3 / Oct 27, 2011 9:21pm

    Austmel

    4 posts

    Hi,

    Thanks for the reply, i’m not sure the dynamic=no is going to work for me, i have a right hand pane which shows documents added to the product and then related products showing others in the same category. So am i right in thinking if i do dynamic=no then this pane will not update with the entry documents?


    I guess i’ll just have to use the category in url to filter the category entries and then remove it on viewing the single entry?

    What i was aiming for was to have a breadcrumb that would display You are here: Home Page » Air Elimination Tests » sterilizers » Product.

    Is there another structured way you can suggest to achieve what i want to do?

    cheers,

    Ben.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases