Subcategories displaying filters - by denvysb

This topic has 14 replies, 3 voices, and was last updated 6 years, 9 months ago ago by Rose Tyler

  • Avatar: denvysb
    denvysb
    Participant
    March 3, 2018 at 01:49

    Hello,

    On the old versions of xtheme you could select a product category to display in a “subcategory” mode instead of “products” mode which would then display a page with just purely subcategories, with no products listings or filters.

    Users would then need to select the appropriate subcategory to view the products within the subcategory.

    Recently all the updates that have been released, even when the subcategory is selected, it defaults to showing the the filters on “subcategory” pages. But these pages have nothing to filter?! They are just pages with subcategories on it.

    Can you confirm how to fix/prevent the subcategory pages showing the filter when it shouldn’t be.

    13 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 5, 2018 at 14:54

    Hello,

    Sorry for the delay due to the weekends.
    1) WooCommerce made a lot of changes in 3.3 update and moved option to choose what you want at shop page to Customizer http://prntscr.com/in5vbg
    2) Please provide some screenshots of your filters and links to help me understand more.

    Regards

    Avatar: denvysb
    denvysb
    Participant
    March 6, 2018 at 19:23

    Hi please find the links attached. You will notice on old version it looks right. On new version it looks wrong.

    Please, contact administrator
    for this information.
    Avatar: denvysb
    denvysb
    Participant
    March 6, 2018 at 19:55

    You’ll notice the following code
    woocommerce_products_will_display()
    on archive-product.php
    that determines whether the filter should be shown or not on sub-category page always defaults to “TRUE” regardless if the page should show filters or not.

    Old Code

    
    					<?php if ( ( woocommerce_products_will_display() || is_tax( 'brand' ) ) && etheme_get_option( 'top_toolbar' ) ): ?>
    	                    <div class="filter-wrap">
    	                    	<div class="filter-content">
    		                    	<?php
    		                    		/**
    		                    		 * woocommerce_before_shop_loop hook
    		                    		 *
    		                    		 * @hooked woocommerce_result_count - 20
    		                    		 * @hooked woocommerce_catalog_ordering - 30
    		                             * @hooked etheme_grid_list_switcher - 35
    		                    		 */
    		                    		do_action( 'woocommerce_before_shop_loop' );
    		                    	?>
    	                    	</div>
    	                    </div>
    					<?php endif ?>
    	                 <?php if (is_active_sidebar( 'shop-filters-sidebar' )): ?>
    					<div class="shop-filters widget-columns-<?php echo etheme_get_option( 'filters_columns' ); ?><?php echo (etheme_get_option('filter_opened')) ? ' filters-opened' : ''; ?>">
    						<div class="shop-filters-area">
    						  	<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('shop-filters-sidebar')): ?>
    							<?php endif; ?>	
    						</div>
    					</div>
    					<?php endif; ?>
    

    New Code

    
    					<?php if ( woocommerce_products_will_display() || etheme_get_option( 'top_toolbar' ) ): ?>
    	                    <div class="filter-wrap">
    	                    	<div class="filter-content">
    		                    	<?php
    		                    		/**
    		                    		 * woocommerce_before_shop_loop hook
    		                    		 *
    		                    		 * @hooked woocommerce_result_count - 20
    		                    		 * @hooked woocommerce_catalog_ordering - 30
    		                             * @hooked etheme_grid_list_switcher - 35
    		                    		 */
    		                    		do_action( 'woocommerce_before_shop_loop' );
    		                    	?>
    	                    	</div>
    	                    </div>
    					<?php endif ?>
    	                 <?php if (is_active_sidebar( 'shop-filters-sidebar' )): ?>
    					<div class="shop-filters widget-columns-<?php echo etheme_get_option( 'filters_columns' ); ?><?php echo (etheme_get_option('filter_opened')) ? ' filters-opened' : ''; ?>">
    						<div class="shop-filters-area">
    						  	<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('shop-filters-sidebar')): ?>
    							<?php endif; ?>	
    						</div>
    					</div>
    					<?php endif; ?>
    
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 7, 2018 at 11:13

    Hello,

    Do you use latest theme version?

    Regards

    Avatar: denvysb
    denvysb
    Participant
    March 7, 2018 at 23:29

    Hi yes I am using the latest version. I am looking at your code on the latest version and it is set to display the filter regardless if the subcategories are set to display no products and only subcategories.

    Again this filter display option appears to be operating from your coding.

    Avatar: denvysb
    denvysb
    Participant
    March 8, 2018 at 18:43

    Any outcome on this issue?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    March 9, 2018 at 15:10

    Hello,

    We have removed that code because of the update of the archive-products.hp file according to new WC update. But we’ll return it back if this is important for you.

    Regards

    Avatar: denvysb
    denvysb
    Participant
    March 10, 2018 at 02:08

    Hi the point is that your template is behaving incorrectly. It is displaying a filter on a page that should not be displaying a filter when the “subcategories” option is selected.

    The importance here is that the code needs to be fixed so that when display “subcategories only” is selected, it does not bring up the irrelevant filter.

    As you can see from the links I provided on the page there are no products displayed for the filter to appear.

    Avatar: denvysb
    denvysb
    Participant
    March 12, 2018 at 01:12

    Any update guys because its been a week since raising this issue and I am unable to upgrade to new version of theme due to this bug/defect.

    Avatar: denvysb
    denvysb
    Participant
    March 13, 2018 at 03:00

    It appears we are paying for forum support for no reason. 10 days, 3 replies and even though I have been very clear what the issue is and provided exact examples still no progress or update on the bug.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 13, 2018 at 15:22

    Hello,

    Sorry for the delay in answering.
    Please try to wrap http://prntscr.com/iqmk8o
    in xstore/woocommerce/archive-product.php

    <?php if ( !is_product_category() || get_option('woocommerce_category_archive_display') != 'subcategories') : ?>
    <?php endif; ?>

    Let me know if this is what your are looking for.

    Regards

    Avatar: denvysb
    denvysb
    Participant
    March 13, 2018 at 20:55

    Hi your code did not work. I don’t think the code “woocommerce_category_archive_display” exists anywhere on your theme and therefore was always returning the result string(“”).

    Spent a lot of time searching up and down on woocommerce to find out which function returns whether a page displays only products/ only subcategories/ both.

    Found the following code woocommerce_products_will_display() that returns whether a page shows products or not.

    I wrapped the following code around the filter and now it is working as intended with woocommerce settings. If it is set to display no products and only subcategories then the filter will be removed

    <?php if ( woocommerce_products_will_display()) : ?>
    <?php endif; ?>

    I have made this change on the core file, so next update will remove this code if not fixed in core. Can you please ensure on your next update this bug is fixed and updated with the above code.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 14, 2018 at 10:07

    Hello,

    Thanks for the reply. I’ve passed this topic to our developers. The fix will be added in next theme update.

    Regards

  • Viewing 14 results - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.