Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #710004

    On the WooCommerce shop page, please hide the sort-param-count selector on top of the products if in the WooCommerce plugin settings “all” products are set to be visible. This can be set under WooCommerce / Settings / Products/ Display / Product Count.

    The fix should be easy in your avia_woocommerce_frontend_search_params function which hooks into woocommerce_before_shop_loop.

    #710060

    Hey Thorsten,

    Can you post the page mentioned? so we can inspect further. You can post it in the “private content” section so only moderators can see.

    Best regards,
    Nikko

    #710825

    Hey Nikko, I’m confronted to the same “problem” here.

    Every page with a list of products is concerned (like main shop page, categories pages, etc.)
    In avia_woocommerce_frontend_search_params() function, I think you should echo <ul class='sort-param sort-param-count'> only if $per_page is greater than 0.

    It make no sense to propose a filter (with bugs) when all products of the stores should be on the same page.

    To reproduce, you can do like mandelking says : ” WooCommerce / Settings / Products/ Display / Product Count” and set to “All”.

    • This reply was modified 8 years ago by laboiteare.
    #710829

    @laboiteare thanks for confirming this issue. As a temporary workaround, feel free to use the following snippet:

    /*
     displays a front end interface for modifying the shoplist query parameters like sorting order, product count etc
     can be removed, if the bug is resolved
    */
    if(!function_exists('avia_woocommerce_frontend_search_params'))
    {
    	add_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20);
    
    	function avia_woocommerce_frontend_search_params()
    	{
    		global $avia_config;
    
    		if(!empty($avia_config['woocommerce']['disable_sorting_options'])) return false;
    
    		$product_order['default'] 	= __("Default Order",'avia_framework');
    		$product_order['title'] 	= __("Name",'avia_framework');
    		$product_order['price'] 	= __("Price",'avia_framework');
    		$product_order['date'] 		= __("Date",'avia_framework');
    		$product_order['popularity'] = __("Popularity",'avia_framework');
    
    		$product_sort['asc'] 		= __("Click to order products ascending",  'avia_framework');
    		$product_sort['desc'] 		= __("Click to order products descending",  'avia_framework');
    
    		$per_page_string 		 	= __("Products per page",'avia_framework');
    
    		$per_page 		 		 	= get_option('avia_woocommerce_product_count');
    		if(!$per_page) $per_page 	= get_option('posts_per_page');
    		if(!empty($avia_config['woocommerce']['default_posts_per_page'])) $per_page = $avia_config['woocommerce']['default_posts_per_page'];
    
    		parse_str($_SERVER['QUERY_STRING'], $params);
    
    		$po_key = !empty($avia_config['woocommerce']['product_order']) ? $avia_config['woocommerce']['product_order'] : 'default';
    		$ps_key = !empty($avia_config['woocommerce']['product_sort'])  ? $avia_config['woocommerce']['product_sort'] : 'asc';
    		$pc_key = !empty($avia_config['woocommerce']['product_count']) ? $avia_config['woocommerce']['product_count'] : $per_page;
    
    		$ps_key = strtolower($ps_key);
    		
    		$nofollow = 'rel="nofollow"';
    
    		//generate markup
    		$output  = "";
    		$output .= "<div class='product-sorting'>";
    		$output .= "    <ul class='sort-param sort-param-order'>";
    		$output .= "    	<li><span class='currently-selected'>".__("Sort by",'avia_framework')." <strong>".$product_order[$po_key]."</strong></span>";
    		$output .= "    	<ul>";
    		$output .= "    	<li".avia_woo_active_class($po_key, 'default')."><a href='".avia_woo_build_query_string($params, 'product_order', 'default')."' {$nofollow}>	<span class='avia-bullet'></span>".$product_order['default']."</a></li>";
    		$output .= "    	<li".avia_woo_active_class($po_key, 'title')."><a href='".avia_woo_build_query_string($params, 'product_order', 'title')."' {$nofollow}>	<span class='avia-bullet'></span>".$product_order['title']."</a></li>";
    		$output .= "    	<li".avia_woo_active_class($po_key, 'price')."><a href='".avia_woo_build_query_string($params, 'product_order', 'price')."' {$nofollow}>	<span class='avia-bullet'></span>".$product_order['price']."</a></li>";
    		$output .= "    	<li".avia_woo_active_class($po_key, 'date')."><a href='".avia_woo_build_query_string($params, 'product_order', 'date')."' {$nofollow}>	<span class='avia-bullet'></span>".$product_order['date']."</a></li>";
    		$output .= "    	<li".avia_woo_active_class($po_key, 'popularity')."><a href='".avia_woo_build_query_string($params, 'product_order', 'popularity')."' {$nofollow}>	<span class='avia-bullet'></span>".$product_order['popularity']."</a></li>";
    		$output .= "    	</ul>";
    		$output .= "    	</li>";
    		$output .= "    </ul>";
    
    		$output .= "    <ul class='sort-param sort-param-sort'>";
    		$output .= "    	<li>";
    		if($ps_key == 'desc') 	$output .= "    		<a title='".$product_sort['asc']."' class='sort-param-asc'  href='".avia_woo_build_query_string($params, 'product_sort', 'asc')."' {$nofollow}>".$product_sort['desc']."</a>";
    		if($ps_key == 'asc') 	$output .= "    		<a title='".$product_sort['desc']."' class='sort-param-desc' href='".avia_woo_build_query_string($params, 'product_sort', 'desc')."' {$nofollow}>".$product_sort['asc']."</a>";
    		$output .= "    	</li>";
    		$output .= "    </ul>";
    
    		if( $per_page > -1 ){
    			$output .= "    <ul class='sort-param sort-param-count'>";
    			$output .= "    	<li><span class='currently-selected'>".__("Display",'avia_framework')." <strong>".$pc_key." ".$per_page_string."</strong></span>";
    			$output .= "    	<ul>";
    			$output .= "    	<li".avia_woo_active_class($pc_key, $per_page).">  <a href='".avia_woo_build_query_string($params, 'product_count', $per_page)."' {$nofollow}>		<span class='avia-bullet'></span>".$per_page." ".$per_page_string."</a></li>";
    			$output .= "    	<li".avia_woo_active_class($pc_key, $per_page*2)."><a href='".avia_woo_build_query_string($params, 'product_count', $per_page * 2)."' {$nofollow}>	<span class='avia-bullet'></span>".($per_page * 2)." ".$per_page_string."</a></li>";
    			$output .= "    	<li".avia_woo_active_class($pc_key, $per_page*3)."><a href='".avia_woo_build_query_string($params, 'product_count', $per_page * 3)."' {$nofollow}>	<span class='avia-bullet'></span>".($per_page * 3)." ".$per_page_string."</a></li>";
    			$output .= "    	</ul>";
    			$output .= "    	</li>";
    			$output .= "	</ul>";
    		}
    
    		$output .= "</div>";
    		echo $output;
    	}
    }
    • This reply was modified 8 years ago by mandelkind.
    #710832

    @mandelkind : Thanks a lot but I’ve already done (but with if($per_page>0){ :D )

    But thanks for potential other people who get the “problem”.

    Have a good day ;)

    #710833

    @laboiteare already thought exactly that ;) Cheers!

    #711393

    Hi,


    @mandelkind
    : thanks for sharing the snippet you used as workaround. :)

    Best regards,
    Nikko

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.