Home Forums WoodMart support forum Brand image on product archive

Brand image on product archive

Viewing 30 posts - 1 through 30 (of 33 total)
  • Author
    Posts
  • #38225

    iRiDiuM
    Participant

    Hi

    Im using this plugin https://wordpress.org/plugins/perfect-woocommerce-brands/

    But is not fully compatible.

    http://clon.vainsmon.es/tienda/acs/termos-electricos/termo-electrico-baxiroca-v510-100-litros-vertical/

    IS only Yith brands plugin compatible? Im force to use it?

    Thanks!

    #38263

    Artem Temos
    Keymaster

    Hi,

    We didn’t integrate any 3rd party plugins for brands since our theme includes our own functionality for this.

    Kind Regards

    #38310

    iRiDiuM
    Participant

    ah, is not needed Yith Brands plugin?

    Also, if i disable my plugin, how to import all my existing brands and use your functionality?

    I already have created 250 products on my shop and them have assigned a brand.

    Some idea to how fix this?

    Thanks

    #38313

    Artem Temos
    Keymaster

    Here is an article from our documentation that demonstrates how to use our brands https://xtemos.com/docs/woodmart/faq-guides/how-to-setup-brands/

    #38652

    iRiDiuM
    Participant

    Ok, i created a new attribute for Brand. Ugg!..

    Well, any info for show a logo image on product loop archive?

    Like my old web:
    https://screenshots.firefox.com/sCBEbRKwL7uQmTo0/www.vainsmon.es
    https://www.vainsmon.es/categoria-producto/acs/termos-electricos/

    Thanks ♥

    #38714

    Artem Temos
    Keymaster

    You can try to enable attribute label for your brand attribute in Dashboard -> Products -> Attributes. Unfortunately, our theme doesn’t have an option as per your example.

    #38862

    iRiDiuM
    Participant

    ok!

    i find a function and customized it, but, cant find the correct term id for image:

    pa_marca-image

    function brands_in_loop(){
        global $product;
        $product_id = $product->id;
        $product_brands =  wp_get_post_terms($product_id, 'pa_marca');
        if(!empty($product_brands)){
            echo '<div class="custom-loop-brands">';
            foreach ($product_brands as $brand) {           
                      $attachment_id = get_term_meta( $brand->term_id, 'pa_marca-image', 1 );
    
                      $attachment_html = wp_get_attachment_image($attachment_id,$atts['image_size']);
    
                      if(!empty($attachment_html)){
                        echo '<span class="marca-archivos">'.$attachment_html.'</span>';
                      }else{
                        echo '<span class="marca-archivos">'.$brand->name.'</span>';
                      }
                  
            }
            echo '</div>';
        }
    }
    add_action('woocommerce_before_shop_loop_item_title', 'brands_in_loop');

    And the position is on top before image, i want to hook before tittle or above, not before image.

    woocommerce_before_shop_loop_item_title

    Some helps?

    Thanks a lot

    #38897

    iRiDiuM
    Participant

    Some one know wich term meta is used for images attributes, in my case pa_brand ?

    $attachment_id = get_term_meta( $brand->term_id, 'pa_marca-image', 1 );

    How can i check it?

    Thanks a lot! ♥

    #38917

    Artem Temos
    Keymaster

    Try to use this code

    function brands_in_loop(){
    	global $product;
    	$attributes = $product->get_attributes();
    	$output = array();
    	foreach ( $attributes as $attribute ) {
    		if ( !isset( $attribute['name'] ) ) continue;
    		$show_attr_on_product = woodmart_wc_get_attribute_term( $attribute['name'], 'show_on_product' );
    		if ( $show_attr_on_product == 'on' ) {
    			$terms = wc_get_product_terms( $product->get_id(), $attribute['name'], array( 'fields' => 'all' ) );
    			foreach ( $terms as $term ) {
    				$content = esc_attr( $term->name );
    				
    				$image = get_term_meta( $term->term_id, 'image', true );
    				if ( $image ) {
    					echo '<span class="marca-archivos"><img src="' . esc_url( $image ) . '" title="' . esc_attr( $term->slug ) . '" alt="' . esc_attr( $term->slug ) . '" /></span>';
    				}else{
    					echo '<span class="marca-archivos">' . $term->name . '</span>';
    				}
    			}
    		}
    	}
    }
    add_action( 'woocommerce_shop_loop_item_title', 'brands_in_loop', 5 );
    #39194

    iRiDiuM
    Participant

    Hi

    Works but is taking the img from another attribute. Must take img from brand

    My old code worked, but missing $brand->term_id.

    Any solution?

    Thanks ♥

    #39207

    Artem Temos
    Keymaster

    Try to replace the previous code with this one

    function brands_in_loop(){
    	global $product;
    	$output = array();
    	$product_brands = wp_get_post_terms( $product->get_id(), 'pa_brand' );
    	echo '<div class="custom-loop-brands">';
    		foreach ( $product_brands as $brands ) {
    			$image = get_term_meta( $brands->term_id, 'image', true );
    			if ( $image ) {
    				echo '<span class="marca-archivos"><img src="' . esc_url( $image ) . '" title="' . esc_attr( $brands->slug ) . '" alt="' . esc_attr( $brands->slug ) . '" /></span>';
    			}else{
    				echo '<span class="marca-archivos">' . $brands->name . '</span>';
    			}
    		}
    	echo '</div>';
    }
    add_action( 'woocommerce_shop_loop_item_title', 'brands_in_loop', 5 );
    #39286

    iRiDiuM
    Participant

    Sorry but is not working

    Im unable to find the correct term img.

    🙁 ♥

    #39287

    iRiDiuM
    Participant

    Here you have credentials to my site if want to enter to my admin.

    #39380

    Artem Temos
    Keymaster

    Try to replace this line

    $product_brands = wp_get_post_terms( $product->get_id(), 'pa_brand' );

    to this one

    $product_brands = wp_get_post_terms( $product->get_id(), woodmart_get_opt( 'brands_attribute' ) );

    #39422

    iRiDiuM
    Participant

    Hi

    Now is showing only text string! But not image 🙁

    #39423

    Artem Temos
    Keymaster

    In this case, please, provide us your FTP access so we can check it. And send us a link where we should see product with brands.

    #39439

    iRiDiuM
    Participant

    Sure!

    #39440

    iRiDiuM
    Participant

    Wich country are you connecting? I have to add country exclusion to my server. Maybe you will cant conect.

    #39457

    Artem Temos
    Keymaster

    We are from

    #39531

    iRiDiuM
    Participant

    Added to my server

    #39533

    Artem Temos
    Keymaster

    We can’t connect http://prntscr.com/ie7a6y

    #39578

    iRiDiuM
    Participant

    i tested your credentials and worked.

    Additionally i can add your IP to my whitelist.

    Anyways i will contact to my server.

    Sorry about that

    #39580

    iRiDiuM
    Participant

    I think with IP will works. Anyways please, check no spaces on pw or login.

    See my server sonfiguration

    Sorry and thanks ♥

    #39581

    iRiDiuM
    Participant

    Sorry, i think i dont need IP.

    Try now ♥

    #39621

    Artem Temos
    Keymaster

    Sorry, but we still can’t connect with the data you sent.

    #39626

    iRiDiuM
    Participant

    The data is correct, the problem is the same. My host provider dont let connect.
    Can you give your IP?

    Also my hosting says, you must can connect.

    #39628

    Artem Temos
    Keymaster

    Here is my

    #39687

    iRiDiuM
    Participant

    Yes, your IP was bloqued, now you can login.

    #39690

    Artem Temos
    Keymaster

    We see that you have modified the code. Please, use the one we send you

    function brands_in_loop(){
    	global $product;
    	$output = array();
    	$product_brands = wp_get_post_terms( $product->get_id(), woodmart_get_opt( 'brands_attribute' ) );
    		echo '<div class="custom-loop-brands">';
    		foreach ( $product_brands as $brands ) {
    			$image = get_term_meta( $brands->term_id, 'image', true );      
    			if ( $image ) {
    				echo '<span class="marca-archivos"><img src="' . esc_url( $image ) . '" title="' . esc_attr( $brands->slug ) . '" alt="' . esc_attr( $brands->slug ) . '" /></span>';
    			}else{
    				echo '<span class="marca-archivos">' . $brands->name . '</span>';
    		}
    	}
    	echo '</div>';
    }
    add_action( 'woocommerce_shop_loop_item_title', 'brands_in_loop', 5 );
    #39745

    iRiDiuM
    Participant

    Is the same? I used your code, but cause doest worked last time, i modifyed to test.

    Now is working, thanks a lot and thanks for your patientce.

    Sorry for my english

Viewing 30 posts - 1 through 30 (of 33 total)