Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › product categories widget (expanding)
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › product categories widget (expanding)
- This topic has 3 replies, 3 voices, and was last updated 11 years by Melanie – SUPPORT.
-
Posted in: Neighborhood
-
August 19, 2013 at 7:30 pm #17192
Hi Ed,
this is not an issue, but asking for help with little modification, which I really think everybody will appreciate.
I need Product Categories Widget to display children list as hidden by default, so I can click on parent category and I will see expanded list of subcategories.
How can I do that? I saw it in IDstore theme – http://8theme.com/demo/idstore/?min_price=0&max_price=540&post_type=product&cols=3 –
This is very useful feature when there is really a lot of categories and subcategories, so user can expand what he needs. And it also expands current category when others are hidden. It is very useful for user when there is a lot of categories and subcategories.
I bought this IDstore theme and looked in the code. But I am newbie and don’t know how to copy it properly, where and what to past… ๐ please advise what and where to modify? I can pay for this help as well.
So I found that they add jquery code to theme main JS file, here is the code:
/* Accordion Navigation
-------------------------------------------------------------- */
jQuery(function(){
if(!nav_accordion){
jQuery('.categories-group .wpsc_category_title .btn-show ').hide();
}else{
jQuery('.block.cats').addClass('acc_enabled');
jQuery('.categories-group').each(function(){
jQuery(this).has('.wpsc_top_level_categories').addClass('has-subnav');
jQuery(this).has('.current-cat').addClass('current-parent opened');
});var nav_section = jQuery('.categories-group .wpsc_top_level_categories');
var nav_toggle_element = jQuery('.categories-group .wpsc_category_title .btn-show ');
var nav_speed = 150;nav_toggle_element.click(function(){
if(jQuery(this).parent().parent().hasClass('opened')){
hideActiveSection();
}else{
showNext(jQuery(this));
}
});if(jQuery('.categories-group.opened').length > 0) {
//jQuery('.categories-group.has-subnav').addClass('opened');
}else{
// If doesnt exitst opened point
jQuery('.categories-group.has-subnav:first').addClass('opened').find('ul').show();
}function showNext(element) {
hideActiveSection();
element.parent().parent().addClass('opened');
element.parent().next().show(nav_speed);
}function hideActiveSection(){
jQuery('.categories-group.opened').removeClass('opened').find('.wpsc_top_level_categories').hide(nav_speed);
}
}
});and they add code to woo.php which is contained in theme folder as well.
function etheme_get_wc_categories_menu($title = 'Categories'){
global $wp_query;
?>
<div class="block cats widget-container">
<div class="block-head">
<?php echo ($title != '') ? $title : 'Categories'; ?>
</div>
<div class="block-content">
<?php $instance_categories = get_terms( 'product_cat', 'hide_empty=0&parent=0');
$cat = $wp_query->get_queried_object();
if(@$cat->term_id){ $current_cat = $cat->term_id; }
foreach($instance_categories as $categories){
$term_id = $categories->term_id;
$term_name = $categories->name;
?>
<div class='categories-group <?php if($term_id == $current_cat) echo 'current-parent opened' ; ?>' id='sidebar_categorisation_group_<?php echo $term_id; ?>'>
<h5 class='wpsc_category_title'>"><?php echo $term_name; ?><span class="btn-show"></span></h5>
<?php $subcat_args = array( 'taxonomy' => 'product_cat',
'title_li' => '', 'show_count' => 0, 'hide_empty' => 0, 'echo' => false,
'show_option_none' => '', 'child_of' => $term_id ); ?>
<?php if(get_option('show_category_count') == 1) $subcat_args['show_count'] = 1; ?>
<?php $subcategories = wp_list_categories( $subcat_args ); ?>
<?php if ( $subcategories ) { ?>
<ul class='wpsc_categories wpsc_top_level_categories'><?php echo $subcategories ?>
<?php } ?>
<div class='clear_category_group'></div>
</div>
<?php
}
?>
</div>
<script type="text/javascript">
<?php if(!etheme_get_option('cats_accordion')): ?>
var nav_accordion = false;
<?php else: ?>
var nav_accordion = true;
<?php endif ;?>
</script>
</div>
<?php
}
CSS styles I would make by myself, no worries.
Based on this information, can you please help?
I really need this feature of accordion categories.
P.S. I can pay whatever it is neccessary, I think there 10 minutes of time to implement this solution. Thanks
Big thanks in advance.
August 20, 2013 at 3:11 pm #17376Hey,
I’m afraid this goes beyond the scope of free support we can give. Neither me or Cosmin have the time for custom paid work of that kind at the moment, so I’d recommend heading over to themeforest’s forums or microlancer for help!
cheers
September 19, 2013 at 4:04 am #22808Here is your answer
http://support.swiftideas.net/forums/topic/how-to-working-with-categories-and-categories/
You can close this post
September 20, 2013 at 9:36 am #23013Thanks menkom, I’ll close this thread when the thread creator confirms he’s all set tho ๐
-
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.