Hi Everyone,
I have been working to solve an interesting product display arrangement that my client wants. I have found some work-arounds using just structure default tags, when I came across this plugin. I hope that it may provide a solution for the wall I’ve hit.
The goal of the client is to have tables for each product sub-category, with the products of that subcategory listed. The client wants to able to change two of the table column labels, and then be able to enter these features for each product. Please look at the screenshots to see what I mean.
My solution was to have two fields in the Subcategory page to create the table column labels. Each individual product entry for that category contains corresponding features to the labels .
The problem I am having is for the page to automatically generate all this information. So far I am able to have it generate each sub-categories lname and two column labels. I am having trouble getting it to display jthe children/individual products for each of these categories. Right now I am using the entry id #’s but this isn’t dynamic.
{exp:weblog:entries entry_id="{exp:structure:child_ids entry_id='{segment_3}'}" limit="1" fixed_order="{exp:structure:child_ids entry_id='{segment_3}'}" parse="inward"}
<h5>{title}</h5>
<table class="tiger-stripe">
<thead>
<tr>
<th>Model</th>
<th class="description">Description</th>
{feature_titles}
<th>{feature1_title}</th>
<th>{feature2_title}</th>
{/feature_titles}
<th>Price</th>
</tr>
</thead>
<tr>
{/exp:weblog:entries}
{exp:weblog:entries entry_id="{exp:structure:child_ids entry_id='26'}" fixed_order="{exp:structure:child_ids entry_id='26'}" parse="inward"}
{table_info}
<td>{cell_1}</td>
<td class="description">{cell_2}</td>
<td>{cell_3}</td>
<td>{cell_4}</td>
<td>Table Cell</td>
{/table_info}
</tr>
{/exp:weblog:entries}
</table>
{exp:weblog:entries entry_id="{exp:structure:child_ids entry_id='{segment_3}'}" limit="1" offset="1" fixed_order="{exp:structure:child_ids entry_id='{segment_3}'}" parse="inward"}
<h5>{title}</h5>
<table class="tiger-stripe">
<thead>
<tr>
<th>Model</th>
<th class="description">Description</th>
{feature_titles}
<th>{feature1_title}</th>
<th>{feature2_title}</th>
{/feature_titles}
<th>Price</th>
</tr>
</thead> {/exp:weblog:entries}
<tr>
{exp:weblog:entries entry_id="{exp:structure:child_ids entry_id='26'}" fixed_order="{exp:structure:child_ids entry_id='26'}" parse="inward"}
{table_info}
<td>{cell_1}</td>
<td class="description">{cell_2}</td>
<td>{cell_3}</td>
<td>{cell_4}</td>
<td>Table Cell</td>
{/table_info}
</tr>
{/exp:weblog:entries}
</table>I am not much of a developer, and am open to any better solutions offered. I would also appreciate some sort of quick solution for getting it to work as is.
Just to confirm: Your products are defined as Structure pages and you have the parent which defines the header of the table (including the title of the table), which includes a related or matrix field to form the features (e.g. Fish Type 1, Fish Type 2)…?
Then as Structure children you have the individual products to display in that table (I’m trying to avoid referring to category, as this has nothing to do with EE categories)…?
What’s the difference between the entry_id defined by segment_3 and entry_id 26. How are these grouped in the EE control panel, under the Structure tab - can you do a grab?
I notice that you’ve got an offset for the second table, so assume that’s how your defining the different tables.
But Don’t understand how you need to define the products within the table - possibly the second 26, should specify the parent which is the 2nd entry of the entry specified by segment_2. If that makes sense?!?
Firstly have you looked at Matrix: http://pixelandtonic.com/matrix. Alternatively, use your table header and individual rows within embed templates passing the entry_id to use each time, this will minimise duplication and allow for dynamic content.
Also, I think all your starting <tr> markup need to sit inside the weblog:entries tags, not before.
Peter
Just to confirm: Your products are defined as Structure pages and you have the parent which defines the header of the table (including the title of the table), which includes a related or matrix field to form the features (e.g. Fish Type 1, Fish Type 2)…?
Yes this is correct.
Then as Structure children you have the individual products to display in that table (I’m trying to avoid referring to category, as this has nothing to do with EE categories)…?
Close, but each table has its own page, and the individual products associated with each table are listed as children of those table pages. The ‘table pages’ are Subcategory and Subcategory 2.
What’s the difference between the entry_id defined by segment_3 and entry_id 26. How are these grouped in the EE control panel, under the Structure tab - can you do a grab?
I’ve attached a SS of the Structure page. The difference is that the ones with ID’s that display the individual products assigned to each of the ‘table-pages’.. ideally I want to remove the ID number and somehow have it display dynamically. The individual product entries are essentially grandchildren of the segment_3 as they are fathered by ‘table-pages’ Maybe that explains it more clearly.
I notice that you’ve got an offset for the second table, so assume that’s how your defining the different tables.
Yes, that is how I am pulling up the second ‘table-page’
But Don’t understand how you need to define the products within the table - possibly the second 26, should specify the parent which is the 2nd entry of the entry specified by segment_2. If that makes sense?!?
Kind of lost you, but maybe I have already explained this with my other responses above.
Firstly have you looked at Matrix: http://pixelandtonic.com/matrix. Alternatively, use your table header and individual rows within embed templates passing the entry_id to use each time, this will minimise duplication and allow for dynamic content. Also, I think all your starting <tr> markup need to sit inside the weblog:entries tags, not before.
I have Matrix, and that is what I am using as entry fields for the info in the tables. The problem is that if I need separate entries for each product as I will be creating links to pages that will show each product individually in the table. Ideally this would have been great as you could have just added new rows for each product and just fill in the data. However, this can’t be done because there will be links tied to specific entries with more details on the specific product.
Thanks for all your help so far, I can’t thank you enough! Chris
Can you try the following? This is all blind, but fingers crossed it’ll get some results along the right lines!
{exp:structure_entries depth="2" parent="segment_2"}
{if {depth} == 1}{!-- Top Level - table header --}
<h5>{title}</h5>
<table class="tiger-stripe">
<thead>
<tr>
<th>Model</th>
<th class="description">Description</th>
{feature_titles}
<th>{feature1_title}</th>
<th>{feature2_title}</th>
{/feature_titles}
<th>Price</th>
</tr>
</thead>
{if {children_total} == 0}{!-- No Children, close markup --}
</table>
{/if}
{if:else}{!-- Children (not top level) - rows of table --}
{if {sibling_count} == 1}{!-- First child - so open markup --}
<tbody>
{/if}
<tr>
{table_info}
<td>{cell_1}</td>
<td class="description">{cell_2}</td>
<td>{cell_3}</td>
<td>{cell_4}</td>
<td>Table Cell</td>
{/table_info}
</tr>
{close_markup}
{if {total_children} == 0}{!-- Don't think this is needed --}{/if}
{if {last_sibling} && {sibling_count} == {sibling_total}}
</tbody>
</table>
{/if}
{/close_markup}
{/if}
{/exp:structure_entries}segment_2 for the parent refers to “integrated_systems” in the example grabs provided.
The page ends up being blank where the tables should be…. Here is all the code, and how I pasted it in, maybe I’m missing something:
{embed="embeds/html_header"}
<body>
<div id="wrapper" class="width_auto">
{embed="embeds/topbar_logo_search"}
{embed="embeds/navigation" my_location="integration"}
{exp:weblog:entries weblog="product_category_pages" disable="categories|member_data|pagination|trackbacks" sort="asc" }
<div id="banner_small" >
<div id="title" class="header_image">
<h1>{banner_title}</h1>
</div>
</div>
{embed="embeds/left_navigation"}
<div id="main_content">
<h2> {title} </h2>
{page_body}
{/exp:weblog:entries}
{exp:structure_entries depth="2" parent="segment_2"}
{if {depth} == 1}{!-- Top Level - table header --}
<h5>{title}</h5>
<table class="tiger-stripe">
<thead>
<tr>
<th>Model</th>
<th class="description">Description</th>
{feature_titles}
<th>{feature1_title}</th>
<th>{feature2_title}</th>
{/feature_titles}
<th>Price</th>
</tr>
</thead>
{if {children_total} == 0}{!-- No Children, close markup --}
</table>
{/if}
{if:else}{!-- Children (not top level) - rows of table --}
{if {sibling_count} == 1}{!-- First child - so open markup --}
<tbody>
{/if}
<tr>
{table_info}
<td>{cell_1}</td>
<td class="description">{cell_2}</td>
<td>{cell_3}</td>
<td>{cell_4}</td>
<td>Table Cell</td>
{/table_info}
</tr>
{close_markup}
{if {total_children} == 0}{!-- Don't think this is needed --}{/if}
{if {last_sibling} && {sibling_count} == {sibling_total}}
</tbody>
</table>
{/if}
{/close_markup}
{/if}
{/exp:structure_entries}
</div>
</div>
{embed="embeds/footer"}
</div>
[removed][removed]
</body>
</html>Try the segment_2 in brackets first parent=”{segment_2}”
Then try debugging the structure_entries loop, by usign the basics (insert before the existing one to test) -
{exp:structure_entries depth="2" parent="{segment_2}"}
Title:{title}
Depth:{depth}
{/exp:structure_entries}Happy to help via email (through the profile link or add peter@ to the domain below) save clogging up the forums with this debug, we can then post once solved.
that’s exactly what I need to do - I’m in a top level page, and want a side menu to show it’s children - if it doesnt have children then don’t display the menu.
Ok I found it -
{exp:structure:nav_sub hide_if_no_children='yes' wrap_start='<div id="nav_sub_container">' wrap_end='</div>'}
I am having problems with the link that gets created when using either page_url or page_uri
with page_url it seems that the last segment of whatever page I am currently on gets added to the link. And if no segment is in url (exammple on homepage) then the index.php is missing.
here is the sample code I am using in my navigation to create the dropdown for the child items.
{exp:structure_entries depth="1" parent="6"}
<li>{static_img}<h2><a href="http://{page_url}">{title}</a></h2><a href="http://{page_url}">View Styles in this Collection</a></li>
{/exp:structure_entries}when I use page_url with just the structure tags, it seems to work ok.
am I doing something wrong?
thanks Florian
I was hoping I could just output the children of the current page. Is that possible? At the moment it outputs everything!
That’s what I need too. To show the adjacent pages to the one you’re on, no matter what depth you’re at, while still showing all the links at the level above for a particular section. At the moment, using the example from the first post, I’m getting the same as using Structure’s native nav_sub tag. I also need to be able to exclude certain pages which nav_sub has, but Structure Entries doesn’t seem to.
Hi all,
Sorry, usual story - I wasn’t getting notifications of updates from the forum!
Tested both the issues and can’t replicate.
Since v1.0.10 the depth variable changed to be correctly offset from the parent, not from root. So in my tests…
{exp:structure_entries depth="1" parent="2"}Outputs the children of entry_id 2.
Have a look at my usual test page: http://www.northstarenergy.co.uk/test Test 2 shows the children of the homepage, with depth 2 (so the grand-children), but works fine with depth set to 1.
Test 3 shows the same, but using a path (could be segment variable) instead of entry_id:
{exp:structure_entries parent="/solar_heating"}Will only work with the correct “/” at the beginning, shouldn’t matter if there’s a trailing one.
@Florian - Test 3 on the page above outputs both the page_url and page_uri absolutely fine, will email you to try and find out more.
@Tyssen - You can use the usual conditions to exclude anything, so let’s assume in Structure you may pass a parameter along the lines of exclude=”32|42” (I’m assuming).
With structure_entries, simply wrap all your display code with:
{if {entry_id} != 32 || {entry_id} != 42}It’s not as quick and easy as an exclude parameter, but still doable, and allows more flexibility in what markup you might want to exclude.
Another example along these lines is Florian wanted different styles of dropdown for his navigation, by wrapping the markup in conditionals he could output different dropdown markup for each parent of the menu.
Ok so my solution means you don’t need any specific parents or entry ids.
Download this - http://www.brianlitzinger.com/assets/downloads/ee/ext.current_url.php.zip
Then use the following code -
{exp:structure_entries parent="{all_segments}" depth="1"}
Stuff and Nonsence
{/exp:structure_entries}Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.