I need a bit of help please. Here is what I am trying to do:
home page: list out top level “categories?” (myhome.com) - Food packages - Industrial packages - consumer packages
Lets say for instance I click on “industrial” …
… I am then taken to a new page called products (myhome.com/products/ Here, I should see
Clicking on “boxes” I should now see a list of all entries (products) and clicking on an entry I should be then taken to the detail page.
This seems simple, but I am utterly lost now, and feel like ive lost direction.
Ive posted similar things on this forums (https://ellislab.com/forums/viewthread/245298/)
But i think im getting confused with that last part of listing out the entries. I might not even have the categories setup right anymore.
I basically had a category_group with industrial, food and consumer, then i nested the boxes, bags and pallets under neath it, and, well now I just have a mess. By the way, there is like 45 “sub-categories” under those 3 top level once.
Thanks
I believe I need to assign 2 categories to one entry.
This way I can show a user the top 3 to initially choose from:
Food | Industry | Consumer (top lvl categories I would guess)
Once a choice is made, then I need to display the categories under it, such as:
Food (the chosen link) box containers bag container plastic container etc etc etc etc
and then from the above, yet another choice is made, lets say “box containers” and then it lists out every entry tagged as “food” and as “box containers”
Now, I have it in mind to keep all this on 2 pages. Is that even possible?
I am thinking I need to break out the top level into thier own template page, and just hard-code a category ID in there or something.
Completely confusing for something that should be a walk in the park.
The below code kinda works, I’m just missing the middle step of listing out the sub categories
{if segment_2 == ""}
{exp:channel:categories channel="products"}
<a href="http://{path=products}">{category_name}</a>
{category_description}
{/exp:channel:categories}
{if:else}
{/if}
{if segment_2 !=""}
{exp:channel:entries channel="products"}
{title}
{product_image}
<a href="http://{url_title_path=products/detail}">View Details</a>
{/exp:channel:entries}
{/if}Categories were designed as simple filtering mechanisms for blogs - not for developing multi-layer nav for products.
Admittedly they need some functionality love but the reality is that is how they still function.
You could alternatively look to using 2 category groups. One for your “top-level” products and another for your “sub-categories”. Assign both cat groups to the same channel. You can use LowSeg2Cat to find entries that exist in two categories.
Or use relationships instead.
If the products all have the same data structure (IE they all use the same fields) then they should be kept in the same channel.
EE is a lot like database building. If you know how to normalize a database think the same way with EE - like gets stored with like. It’ll make your development easier going forward.
The current state of things thus far are kinda what you mentioned above.
I have to categories
Top Level Industry Food Consumer
Then a secondary Category group Boxes Liners Bags etc etc etc etc
The issue now is trying to associate these, my code right now looks like this:
HOME PAGE
{exp:channel:categories channel="products" show_empty="no" category_group="14"}
<a href="http://{path=products/index}">{category_name}</a>
{category_description}
{/exp:channel:categories}Then, choosing one of the above, in this example, Industry, Im taken to a product page (cats are industry, food, consumer)
mysite.com/products/category/industry
Now on this products page I need to filter… or display … the proper secondary categories associated with industry.
The problem is, I see all the categories
{if last_segment =="industrial"}
<h1> Industrial categories</h1>
{exp:channel:categories channel="products" show_empty="no" category_group="13"}
<a href="http://{path=products/index}">{category_name}</a>
{category_description}
{/exp:channel:categories}
{/if}im not sure why this is happening.
I’m looking to seg2cat now, but so far the results display the product name, not the secondary category.
So let me start with a clean slate here. Attached is a graphic of what I am trying to pull off.
I can work out the “home >> products” page. I can work out the “products >> detail page”
I cannot figure out how to list the sub products.
Now, Ive tried a ton of the free category plugins and the only one that gets me close is gwcode_catmenu. but not quite.
How would you tackle this issue? I mean, this has to be a common thing.
My frame of mind is categories for each group (home page and products) however, I think maybe I could break the home categories out into channels, but then I wont be able tag one product into multiple categories. Unless I recreated into the new channel.
Part of the problem may lie in the fact there is way too many paths to create to get the the desired result. I just need a bit of direction.
I have 2 sets of categories
Industry Food Industrial Consumer
Products Box liners Bags Plastic wrap anti-static etc
Is this wrong to even begin with, just I remove #1 and break those out into separate templates?
I cant believe how complex this has become LOL.
I just want a user to choose one of three top level menu items.
Once a top level menu item is selected, I would like to display a bunch of (sub)categories associated with it.
and once one of those is selected, display a list of products associated to that (sub)category
Click on one of the entries to view details.
Thanks, but I’ve gone through that one, I had a few issues.. I tried with no luck to output the entries for the final cat, I couldn’t target them specifically under the proper category, and it seems like I’d be writing an if statement per cat, which is obviously wrong.
It was close. So is category archive.
Even if I hard code the top 3 categories, and just use product categories, I still cant list them out. The above graphic really explains it. It is that third level that confuses the hell out of me. I can get the categories listed out and such with links to detail page just fine
if i could make a channel per top level, I would, just to move this project forward, but there are entries that need to be across the board.
This is day three on this issue, 8 hours a day. :/ I might have to take another look at this whole project from a different perspective.
The examples for that add-on clearly show it doing what you look to be trying, so I’m not sure where you went wrong. It’s hard when you aren’t posting specific code.
Cat-specific if statements are never the answer. You’d use segment variables instead.
I see three templates.
First template could use standard EE categories tag. Link to the second template using a standard category link.
Then the second template would have some verison of this (untested code - just for explaination):
<ul>
{exp:gwcode_categories cat_url_title="{segment_3}"}
<li> <a href="http://path-to/entries-template/category/category_url_title"> {cat_name}</a></li>
{/exp:gwcode_categories}
</ul>3rd Template would have a standard EE channel:entries loop. It will dynamically pull the entries based on the URL that you are feeding it from template 2.
That should net you the sub cats for the choosen cat.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.