Home › Forums › WoodMart support forum › Managing Brand Filters for Specific Categories in woodmart
Managing Brand Filters for Specific Categories in woodmart
- This topic has 3 replies, 2 voices, and was last updated 1 day, 1 hour ago by
Artem Temos.
-
AuthorPosts
-
June 29, 2024 at 12:29 pm #576408
av_admin_1984ParticipantHi
I want to know what is different between these url’s?https://woodmart.xtemos.com/shop/?filter_brand=alessi?filter_brand=apple https://woodmart.xtemos.com/product-category/furniture/?filter_brand=alessi https://woodmart.xtemos.com/product-category/accessories/?filter_brand=alessi
I used Layouts in wordpress backend created a page for the filter, and added to the condition to show
1-filter brand for Apple
2-only apply to mobile phones not all the filter pages!
now it shows on all the site pages,
I want to separate the phone category plus brand filter just for Apple, not the entire sitewhat should I do?
July 1, 2024 at 10:00 am #576602
Artem TemosKeymasterHello,
Please send us a link to the page where you want to apply your custom layout and your admin access so we can check the configuration.
Kind Regards
July 1, 2024 at 12:54 pm #576715
av_admin_1984ParticipantHi
1-Please don’t share anything about my site in public. if you are faced with an error or whatever, just create a video or image put it on WordPress gallery, and let me know to check it
2-This is the real site, not staging, please don’t disable any plugin
3-With those URLs in the private box you will see what I mean and what I’m looking for, so if it’s not working on this site for any reason, please give me a clear solution so I can fix that
4- Just create the layout for those 3 URLs with different colors and let me know to check and complete the setup
Thank you so much.
July 2, 2024 at 10:52 am #576974
Artem TemosKeymasterIt is not possible to apply a layout to particular categories filtered by particular brands. In this case, try to add the following code to the
functions.php
file in the child theme.add_action( 'woodmart_layout_id', function ( $layout_id ) { if ( ! is_shop() && ! is_product_category() && ! is_product_tag() && ! woodmart_is_product_attribute_archive() ) { return $layout_id; } $type = 'shop_archive'; $conditions_data = get_option( 'wd_layouts_conditions' ); $current_conditions_data = isset( $conditions_data[ $type ] ) ? $conditions_data[ $type ] : array(); if ( ! isset( $current_conditions_data[ $layout_id ] ) || 2 < count( $current_conditions_data[ $layout_id ] ) ) { return $layout_id; } $is_filtered = false; $sorted_data = array(); $conditions_priority = array(); foreach ( $current_conditions_data[ $layout_id ] as $key => $condition ) { if ( 0 <= strpos( $condition['condition_type'], 'filtered' ) ) { $is_filtered = true; break; } } if ( ! $is_filtered ) { return $layout_id; } foreach ( $current_conditions_data as $post_id => $conditions ) { $post_id = apply_filters( 'wpml_object_id', $post_id, 'woodmart_layout' ); $post = get_post( $post_id ); $is_active_prev_condition = false; $has_filtered_condition = false; foreach ( $conditions as $key => $condition ) { $is_active = XTS\Modules\Layouts\Shop_Archive::get_instance()->check( $condition ); if ( $has_filtered_condition && ! $is_active_prev_condition && $is_active ) { unset( $sorted_data[ $post_id ] ); break; } if ( 0 <= strpos( $condition['condition_type'], 'filtered' ) ) { if ( ! $is_active ) { unset( $sorted_data[ $post_id ] ); break; } $has_filtered_condition = true; } if ( $is_active && $post && 'publish' === $post->post_status ) { $is_active_prev_condition = true; $sorted_data[ $post_id ][ $condition['condition_comparison'] ][] = array( 'is_active' => $is_active, 'priority' => wd_get_condition_priority( $condition['condition_type'] ), ); } } } foreach ( $sorted_data as $post_id => $conditions ) { if ( isset( $conditions['include'] ) ) { foreach ( $conditions['include'] as $condition ) { if ( $condition['is_active'] ) { $conditions_priority[ $post_id ] = $condition['priority']; } } } if ( isset( $conditions['exclude'] ) ) { foreach ( $conditions['exclude'] as $condition ) { if ( $condition['is_active'] ) { unset( $conditions_priority[ $post_id ] ); } } } } asort( $conditions_priority ); $conditions_priority = array_flip( $conditions_priority ); return end( $conditions_priority ); }); function wd_get_condition_priority( $type ) { $priority = 100; switch ( $type ) { case 'all': $priority = 10; break; case 'shop_page': $priority = 20; break; case 'product_cats': case 'product_tags': case 'product_attr': $priority = 30; break; case 'product_cat_children': $priority = 40; break; case 'product_search': $priority = 50; break; case 'product_cat': case 'product_tag': case 'product_attr_term': case 'product_term': $priority = 70; break; case 'filtered_product_term': case 'filtered_product_by_term': case 'filtered_product_term_any': case 'filtered_product_stock_status': $priority = 80; break; case 'product': $priority = 90; break; } return apply_filters( 'woodmart_layouts_condition_priority', $priority, $type ); }
Kind Regards
-
This reply was modified 1 day, 1 hour ago by
Artem Temos.
-
This reply was modified 1 day, 1 hour ago by
-
AuthorPosts
- You must be logged in to create new topics. Login / Register