- Posts: 39
COMMUNITY FORUM
Listing all Sub-Category Items in Main-Cateogry
- 8-Bit Classics
-
Topic Author
- Offline
- Junior Member
Less
More
15 years 6 days ago #82448
by 8-Bit Classics
Listing all Sub-Category Items in Main-Cateogry was created by 8-Bit Classics
I am trying to get all items that are published in a sub-category to also be listed in the Main category. I thought setting up a Menu item pointing to the Main Category and selecting all sub-categories in it would work, but it doesn't. Any help would be great.Thanks,Corey
Please Log in or Create an account to join the conversation.
- Simon Wells
-
- Offline
- Platinum Member
Less
More
- Posts: 955
15 years 6 days ago #82449
by Simon Wells
Replied by Simon Wells on topic Listing all Sub-Category Items in Main-Cateogry
You need to set Catalogue Mode to No in the category and ensure you have some value for leading, primary and secondary.
If you created a menu link and configured the parameters at that point, then you would need to delete that menu item and create a new one, pointing to the category you just modified.
Hope that helps.
Simon
K2 Support
If you created a menu link and configured the parameters at that point, then you would need to delete that menu item and create a new one, pointing to the category you just modified.
Hope that helps.
Simon
K2 Support
Please Log in or Create an account to join the conversation.
- 8-Bit Classics
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 39
15 years 5 days ago #82450
by 8-Bit Classics
Replied by 8-Bit Classics on topic Listing all Sub-Category Items in Main-Cateogry
Thanks, that worked. Is it possible to not display all of the categories at the top of the page list?
Please Log in or Create an account to join the conversation.
- Simon Wells
-
- Offline
- Platinum Member
Less
More
- Posts: 955
15 years 5 days ago #82451
by Simon Wells
Replied by Simon Wells on topic Listing all Sub-Category Items in Main-Cateogry
Yes, it is possible.
In the main category, you need to go to the Category View Options and set the Sub Category Blocks to Hide.
Hope that helps.
Simon
K2 Support
Corey Koltz said:Thanks, that worked. Is it possible to not display all of the categories at the top of the page list?
In the main category, you need to go to the Category View Options and set the Sub Category Blocks to Hide.
Hope that helps.
Simon
K2 Support
Corey Koltz said:Thanks, that worked. Is it possible to not display all of the categories at the top of the page list?
Please Log in or Create an account to join the conversation.
- 8-Bit Classics
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 39
15 years 5 days ago #82452
by 8-Bit Classics
Replied by 8-Bit Classics on topic Listing all Sub-Category Items in Main-Cateogry
I found it shortly after I posted, thanks for the reply.
Please Log in or Create an account to join the conversation.
- ahmad balavipour
-
- Offline
- New Member
- هاستینگ
13 years 11 months ago #82453
by ahmad balavipour
Replied by ahmad balavipour on topic Listing all Sub-Category Items in Main-Cateogry
Hi dear,
I create a code for adding select box as k2 categories for k2 search . i hope this can help you:
( this is loop over all categories and subcategories ):
<?php $incategory = (int)JRequest::getVar('incategory'); ?> <select name="incategory" id="incategory" > <option value="0" <?php if($incategory==0) echo("selected='selected'");?>>All categories</option> <?php $beginwith = 0; $level = 0; function thecate($id,$level){ $incategory = (int)JRequest::getVar('incategory'); $user = & JFactory::getUser(); $aid = $user->get('aid'); $db = & JFactory::getDBO(); $query = "SELECT * FROM farsi_k2_categories WHERE parent='$id' AND published=1 AND trash=0 AND access<={$aid} order by ordering"; $db->setQuery($query); $rowsall = $db->loadObjectList(); foreach($rowsall as $rows){ $name = $rows->name; $id = $rows->id; if($incategory == $id) echo "<option value='".$id."' selected='selected' >"; else echo "<option value='".$id."'>"; for($i = 0;$i < $level;$i++) echo(" - "); echo $name."</option>"; thecate($rows->id,$level+1); } } thecate($beginwith,$level); ?> </select>
I am using this in my site www.joomir.com
I create a code for adding select box as k2 categories for k2 search . i hope this can help you:
( this is loop over all categories and subcategories ):
<?php $incategory = (int)JRequest::getVar('incategory'); ?> <select name="incategory" id="incategory" > <option value="0" <?php if($incategory==0) echo("selected='selected'");?>>All categories</option> <?php $beginwith = 0; $level = 0; function thecate($id,$level){ $incategory = (int)JRequest::getVar('incategory'); $user = & JFactory::getUser(); $aid = $user->get('aid'); $db = & JFactory::getDBO(); $query = "SELECT * FROM farsi_k2_categories WHERE parent='$id' AND published=1 AND trash=0 AND access<={$aid} order by ordering"; $db->setQuery($query); $rowsall = $db->loadObjectList(); foreach($rowsall as $rows){ $name = $rows->name; $id = $rows->id; if($incategory == $id) echo "<option value='".$id."' selected='selected' >"; else echo "<option value='".$id."'>"; for($i = 0;$i < $level;$i++) echo(" - "); echo $name."</option>"; thecate($rows->id,$level+1); } } thecate($beginwith,$level); ?> </select>
I am using this in my site www.joomir.com
Please Log in or Create an account to join the conversation.