Home Forums WoodMart support forum Managing Brand Filters for Specific Categories in woodmart

Managing Brand Filters for Specific Categories in woodmart

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #576408

    av_admin_1984
    Participant

    Hi
    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 site

    what should I do?

    #576602

    Artem Temos
    Keymaster
    Xtemos team

    Hello,

    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

    #576715

    av_admin_1984
    Participant

    Hi

    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.

    #576974

    Artem Temos
    Keymaster
    Xtemos team

    It 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 2 years, 1 month ago by Artem Temos.
    #580740

    av_admin_1984
    Participant

    Hi
    I tested it in localhost and it worked

    are you going to add this for the next update to the theme?
    is that working for the new version of woocommerce in the future?

    Thank you so much

    #580855

    Artem Temos
    Keymaster
    Xtemos team

    Hello,

    We would kindly ask you to test it on your website for some time. If it works without any problems, we will make these changes to our theme.

    Kind Regards

    #580928

    av_admin_1984
    Participant

    Hello,

    Yes, sure, with Plusher I’m using it on our site and next month I will give you a report on that.

    #580995

    Artem Temos
    Keymaster
    Xtemos team

    Excellent, thank you very much. We will keep this topic open for now.

    #582178

    av_admin_1984
    Participant

    Hello

    According to this topic and the URLs we discussed before

    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

    in a single product, we have a brand icon that shows the shop/?filter_brand
    for example this address: https://woodmart.xtemos.com/shop/furniture/panton-%d0%beunior-chair/
    is it possible to edit something that each brand refers to their categories?

    for example, if I’m here:
    https://woodmart.xtemos.com/accessories/product/full-aquarelle-iphone-xr/
    and when I click on the Anker brand Icon, it opens this address https://woodmart.xtemos.com/accessories/product-category/cases/ vs the shop address

    is it possible?

    #582276

    Artem Temos
    Keymaster
    Xtemos team

    Hello,

    It’s not possible to customize brand links in the theme to have them refer to specific categories. The brand icon links will always direct users to the shop page filtered by the brand.

    #582309

    av_admin_1984
    Participant

    Hello Artem Temos

    How are you?

    thank you for reply

    is it possible to have template for each brand of each category and add the brand logo with url look like this?
    https://woodmart.xtemos.com/accessories/product/full-aquarelle-iphone-xr/

    I mean, I want to have brand logo manually in important category and brand,
    is it possible?

    how can I have this demo?
    https://woodmart.xtemos.com/marketplace2/

    thanks

    #582396

    Artem Temos
    Keymaster
    Xtemos team

    Hello,

    Unfortunately, there is no brand logo element for the archive layout.

    As for the Marketplace 2 demo, it is under development and has not yet been released. It will be available soon.

    Kind Regards

    #583652

    av_admin_1984
    Participant

    Hello

    You mean there is no way to change the filter brand Icon behavior with code?

    #583700

    Artem Temos
    Keymaster
    Xtemos team

    Hello,

    We don’t have a custom code for such a customization, sorry.

    Kind Regards

Viewing 14 posts - 1 through 14 (of 14 total)