Home › Forums › Basel support forum › Showing wrong result on shop page.
Showing wrong result on shop page.
- This topic has 41 replies, 3 voices, and was last updated 4 years, 2 months ago by Artem Temos.
-
AuthorPosts
-
September 14, 2020 at 11:39 am #226044
[email protected]ParticipantOkay its done. It actually shows 67, did you guys do anything?
Try to run cron with the child theme. Maybe something there causes this…September 14, 2020 at 11:54 am #226051
Artem TemosKeymasterNo, we didn’t change anything. It seems to be working correctly now. Please, check from your side.
September 14, 2020 at 12:07 pm #226062
[email protected]ParticipantYeah 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.September 14, 2020 at 1:23 pm #226107
[email protected]ParticipantThank 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?
September 14, 2020 at 1:46 pm #226122
[email protected]ParticipantSorry. 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 );
September 14, 2020 at 1:56 pm #226134
[email protected]ParticipantHi 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.September 14, 2020 at 4:27 pm #226198
[email protected]ParticipantSo…
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
September 15, 2020 at 6:15 am #226274
Artem TemosKeymasterWe are glad that you sorted it out! Contact us if you will have any questions.
September 15, 2020 at 7:31 am #226301
[email protected]ParticipantThanks!
Well, I know where the problem is occurring, but I do not have a working solution for it yet.
September 15, 2020 at 7:32 am #226302
Artem TemosKeymasterSorry, but additional code customizations are out of our theme support scope. We don’t have a solution or instruction to this.
September 15, 2020 at 7:36 am #226303
[email protected]ParticipantNo problem I do understand that, I will find a solution for it.
Thanks for amazing support in this!
September 15, 2020 at 9:34 am #226354
Artem TemosKeymasterYou are welcome!
-
AuthorPosts
The topic ‘Showing wrong result on shop page.’ is closed to new replies.
- You must be logged in to create new topics. Login / Register