Home Forums WoodMart support forum Html Blocks on Brand page

Html Blocks on Brand page

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

    Stanley Black
    Participant

    Hello,

    Html blocks work fine on products category pages, menu…
    But not working on brand page.
    In the brand terms description by default is set [html_block id="88"] but with no effect on the front. It’s not working.

    Kind regards

    #53607

    Hello,

    Please provide the link to the page where you have added this HTML? Also please provide your site access we shall check settings.

    Best regards

    #53609

    Stanley Black
    Participant

    Hi,

    #53610

    Artem Temos
    Keymaster

    Actually, it is not a brand page. It is a shop page but with products filtered by brand. WooCommerce doesn’t show an attribute description there. Sorry, but we can’t change this in our theme scope.

    #53620

    Stanley Black
    Participant

    Hello,

    thanks for response. How to create brand page where I can include html block.

    #53640

    Hello,

    I have checked your settings. Your brands are displayed properly but not configured.

    1/ Enter Brand Attribute: Products > Attributes > Configure Brands http://prntscr.com/j7w79q create a separate HTML block for each brand and fill it with information. Now you have ID 88 block and it contains the slider “proba” (check Slider Revolution – Sliders)

    2/ Products > Attributes > Configure Brands > insert [html_block id="88"] into the brend description (you will have different IDs)

    3/ Enter each product make sure you have added Brand attribute and chosen the proper one for the product.

    Best Regards

    #53642

    Stanley Black
    Participant

    Hello,

    Thanks for your response, it’s works now.

    It’s all clear to me now. Problem is that theme element Brands display brands like shop filters(shop/?filter_brand=alessi) and this is url(brand/alessi/) which I needed.

    One more question?

    On product page next to product title is brand image(screenshot.png).

    This brand image have shop/?filter_brand=alessi url and I want to replace this url with brand/alessi/ url.

    It’s imortant to me because I want when somebody click on brand image goes to brand/alessi/ page wich have html block included not on shop/?filter_brand=alessi page wich can’t have html blocks included.

    Kind regards

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

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to do this

    	function woodmart_product_brand() {
    		global $product;
    		$attr = woodmart_get_opt( 'brands_attribute' );
    		if( ! $attr || ! woodmart_get_opt( 'product_page_brand' ) ) return;
    
    		$attributes = $product->get_attributes();
    
    		if( ! isset( $attributes[ $attr ] ) || empty( $attributes[ $attr ] ) ) return;
    
    		$brands = wc_get_product_terms( $product->get_id(), $attr, array( 'fields' => 'all' ) );
    
    		if( empty( $brands ) ) return;
    
    		if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
    			$link = home_url();
    		} else {
    			$link = get_post_type_archive_link( 'product' );
    		}
    
    		echo '<div class="woodmart-product-brands">';
    
    		foreach ($brands as $brand) {
    			$image = get_term_meta( $brand->term_id, 'image', true);
    			$filter_name    = 'filter_' . sanitize_title( str_replace( 'pa_', '', $attr ) );
    
    			$attr_link = get_term_link( $brand->term_id, $brand->taxonomy );
    
    			if( ! empty( $image ) ) {
    				echo '<div class="woodmart-product-brand">';
    					echo '<a href="' . esc_url( $attr_link ) . '"><img src="' . esc_url( $image ) . '" title="' . esc_attr( $brand->slug ) . '" alt="' . esc_attr( $brand->slug ) . '" /></a>';
    				echo '</div>';
    			}
    
    		}
    
    		echo '</div>';
    
    	}
    #53657

    Stanley Black
    Participant

    Perfect!!!!!

    #53677

    Artem Temos
    Keymaster

    Great 🙂

    #81002

    plusinternet
    Participant

    Does this just change the link? I have added the code and my brand logos now link through to /brands/brandname/ which is great but how do I add a HTML block to /brands/brandname/ ?

    #81003

    plusinternet
    Participant

    Ignore above, cleared cache -_-

    #81004

    plusinternet
    Participant

    Would you be able to implement this for all brand links? I have the brand logos displayed on my homepage inside a Woodmart Brand Element and also the category is displayed above the product title on the category pages etc.

    #81037

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to do this

    add_filter( 'woodmart_brands_link', function( $link, $brand ){
    	return get_term_link( $brand->term_id, $brand->taxonomy );
    }, 10, 2 );
Viewing 14 posts - 1 through 14 (of 14 total)