Home Forums Basel support forum Showing wrong result on shop page.

Showing wrong result on shop page.

Viewing 12 posts - 31 through 42 (of 42 total)
  • Author
    Posts
  • #226044

    Okay its done. It actually shows 67, did you guys do anything?
    Try to run cron with the child theme. Maybe something there causes this…

    #226051

    Artem Temos
    Keymaster

    No, we didn’t change anything. It seems to be working correctly now. Please, check from your side.

    #226062

    Yeah now it shows 541. See image.
    I did a import with child theme. Will try now with base Basel theme.

    Attachments:
    You must be logged in to view attached files.
    #226107

    Thank you so much for all the help!
    I really appreciate it. So after extensive testing, it turns out that a specific action within functions.php caused this to happen…

    This code messed it up. It is for hiding unwanted categories on the shop page widget.

    function get_subcategory_terms( $terms, $taxonomies, $args ) { 
    

    $new_terms = array();

    	$hide_category 	= array( 29730, 29703, 15, 26287, 26288, 26289, 26290, 26291, 26292, 26293, 26294, 26295, 26308, 26309, 26310, 26311, 
    

    26312, 26313, 26315, 26314, 26316, 26317, 26318, 26319, 26327, 26320, 26321, 26322, 26323, 26324, 26325, 26326); // Ids of the category you don’t want to display on the shop page

     	  // if a product category and on the shop page
     	  	  
     	  if ( in_array( 'product_cat', $taxonomies ) && !is_admin() ) {	 	  
    	    foreach ( $terms as $key => $term ) {		
    		if ( ! in_array( $term->term_id, $hide_category ) ) { 
    			$new_terms[] = $term;
    		}
    	  }
    	  $terms = $new_terms;
    	}
      return $terms;
    }
    add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );

    Please if you know, maybe you can tell me how to adjust it?

    #226122

    Sorry. Here it is.

    // Show products only of selected category.
    // Exclude/Hide the ones show here.
    function get_subcategory_terms( $terms, $taxonomies, $args ) { 
    	$new_terms 	= array();
    	$hide_category 	= array(15, 26287, 26288, 26289, 26290, 26291, 26292, 26293, 26294, 26295, 26308, 26309, 26310, 26311, 
    	26312, 26313, 26315, 26314, 26316, 26317, 26318, 26319, 26327, 26320, 26321, 26322, 26323, 26324, 26325, 26326); // Ids of the category you don't want to display on the shop page 	
     	  // if a product category and on the shop page
     	  	  
     	  if ( in_array( 'product_cat', $taxonomies ) && !is_admin() ) {	 	  
    	    foreach ( $terms as $key => $term ) {		
    		if ( ! in_array( $term->term_id, $hide_category ) ) { 
    			$new_terms[] = $term;
    		}
    	  }
    	  $terms = $new_terms;
    	}
      return $terms;
    }
    add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
    #226134

    Hi again,

    I changed this:

    if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_shop()) {

    Added is_shop() and now it shows 67 after the import…phuuu what a mission to figure this out.

    Thank you so much for assisting me in this.
    I’m very grateful.

    #226198

    So…

    Actually is_shop() did make the import correct somehow…
    But created other problems on the shop page so it didn’t hide the categories.

    If you have any idea how I can edit the above code to make it work, I would
    be really happy.

    Thanks

    #226274

    Artem Temos
    Keymaster

    We are glad that you sorted it out! Contact us if you will have any questions.

    #226301

    Thanks!

    Well, I know where the problem is occurring, but I do not have a working solution for it yet.

    #226302

    Artem Temos
    Keymaster

    Sorry, but additional code customizations are out of our theme support scope. We don’t have a solution or instruction to this.

    #226303

    No problem I do understand that, I will find a solution for it.

    Thanks for amazing support in this!

    #226354

    Artem Temos
    Keymaster

    You are welcome!

Viewing 12 posts - 31 through 42 (of 42 total)

The topic ‘Showing wrong result on shop page.’ is closed to new replies.