• Resolved suarezlopezd

    (@suarezlopezd)


    I am using your plugin and work perfectly.

    I was checking the support page and find the way to add the Brand to the shop page. I used the following code:

    function pwb_show_brands_in_loop(){
    	global $product;
    	$product_id = $product->id;
    	$product_brands =  wp_get_post_terms($product_id, 'pwb-brand');
    	if(!empty($product_brands)){
    		echo '<div class="custom-loop-brands">';
    		foreach ($product_brands as $brand) {
    			echo '<a href="'.get_term_link($brand->term_id).'">'.$brand->name.'</a>';
    		}
    		echo '</div>';
    	}
    }
    add_action('woocommerce_after_shop_loop_item', 'pwb_show_brands_in_loop',1);

    Is there any possibility to add the brand between the shop_thumbnail and shop_details?

    Something like this page: https://www.iamnue.com/brands/etudes/

    Best

    https://www.ads-software.com/plugins/perfect-woocommerce-brands/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor titodevera

    (@titodevera)

    Try this:

    function pwb_show_brands_in_loop(){
    	global $product;
    	$product_id = $product->id;
    	$product_brands =  wp_get_post_terms($product_id, 'pwb-brand');
    	if(!empty($product_brands)){
    		echo '<div class="custom-loop-brands">';
    		foreach ($product_brands as $brand) {
    			echo '<span>'.$brand->name.'</span>';
    		}
    		echo '</div>';
    	}
    }
    add_action('woocommerce_before_shop_loop_item_title', 'pwb_show_brands_in_loop');

    ??

    Thread Starter suarezlopezd

    (@suarezlopezd)

    Hi titodevera,

    I had tried this before, but this add the brand over the thumbnail, not between the thumbnail and the shop_details

    Best ??

    Plugin Contributor titodevera

    (@titodevera)

    By default, this code adds the brand just after the thumbnail. You can test it using a clean theme (like twentysixteen). Is posible that your current theme has the product loop modified.

    What theme are you using?

    ??

    Thread Starter suarezlopezd

    (@suarezlopezd)

    Thanks,

    I will try to install in another theme and see how it looks.

    In the link I sent before, the store is working with the Ultimate Woocommerce Brand Extension and the Brand is placed above title to look like we want.

    The theme used is a Savoy.

    Best

    Plugin Contributor titodevera

    (@titodevera)

    Well. I have installed “Savoy (1.3.1)”. The theme is overriding content-product.php template (savoy > woocommerce > content-product.php). In this case the woocommerce_before_shop_loop_item_title hook is injecting the code before the product thumbnail as you have said. I think you should ask to the theme’s support, because it is a theme’s issue.

    ??

    Thread Starter suarezlopezd

    (@suarezlopezd)

    I have just checked the content-product.php and as you told, and there is a code overriding this…

    // Action: woocommerce_before_shop_loop_item_title
    remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );

    Unfortunately we do not extended the support of the theme at this time… If you can provide us with a solution we will appreciate.

    By the way, if we can got in contact and talk in spanish will be awesome.

    ??

    Plugin Contributor titodevera

    (@titodevera)

    Bien, podemos continuar en espa?ol ??

    La solución fácil sería mover la línea 115 do_action( 'woocommerce_before_shop_loop_item_title' ); y situarla después de que imprima la imagen del producto (línea 140)

    *los números de línea pueden variar si utilizas otra versión diferente del tema

    Un saludo

    Thread Starter suarezlopezd

    (@suarezlopezd)

    Muchas gracias Tito, ha funcionado a la perfección.

    Sin duda ninguna el mejor plugin que he probado para mostrar marcas en woocommerce. Desde hoy mismo lo vamos a implementar en nuestra web.

    Cualquier cosa que pueda hacer házmelo saber!

    Un Saludo

    Plugin Contributor titodevera

    (@titodevera)

    De nada suarezlopezd. Si te gusta el plugin no te olvides de dejar una review positiva, es realmente importante, un saludo ??

    • This reply was modified 8 years, 6 months ago by titodevera.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Brand position’ is closed to new replies.