This topic has 4 replies, 2 voices, and was last updated 3 years, 1 months ago ago by Olga Barlow
Is there any chance to make an option on the product page called “more from brand…” with the presentation of a certain number of products from the same brand whose product was displayed on the product card? This could appear above “Related products”.
Hello,
You can create shortcode to display product brand and link to all products of brand using below code in child theme functions.php
add_shortcode('all_brands', 'all_product_brand');
function all_product_brand() {
global $post;
$terms = wp_get_post_terms( $post->ID, 'brand' );
if ( ! is_wp_error( $terms ) && count( $terms ) > 0 && etheme_get_option( 'show_brand', 1 ) ) {
?>
<div class="sidebar-widget product-brands">
<h4><span><?php esc_html_e( 'Product brand', 'xstore-child' ) ?></span></h4>
<?php
foreach ( $terms as $brand ) {
$thumbnail_id = absint( get_term_meta( $brand->term_id, 'thumbnail_id', true ) );
?>
<a href="<?php echo get_term_link( $brand ); ?>">
<?php if ( etheme_get_option( 'show_brand_title', 1 ) ) : ?>
<div class="view-products-title colorGrey"><?php echo esc_html( $brand->name ); ?></div>
<?php endif;
if ( $thumbnail_id && etheme_get_option( 'show_brand_image', 1 ) ) :
echo wp_get_attachment_image( $thumbnail_id, 'full' );
?>
<?php endif; ?>
</a>
<?php if ( etheme_get_option( 'show_brand_desc', 1 ) ) : ?>
<div class="short-description text-center colorGrey">
<p><?php echo wp_specialchars_decode( $brand->description ); ?></p></div>
<?php endif; ?>
<a href="<?php echo get_term_link( $brand ); ?>"
class="view-products"><?php esc_html_e( 'View all products', 'xstore' ); ?></a>
<?php
}
?>
</div>
<?php
}
}
After that [all_brands] shortcode to Custom HTML block of your single product builder https://prnt.sc/1w8rcwr if you use single product builder or use WooCommerce hook if you use built-in product layout.
Regards
Thank you very much for this solution. However, it needs to be modified a bit. Currently I am shown a large manufacturer’s logo, and it does not have to be. Just the inscription is enough. Text describing the manufacturer appears, and it does not have to. I would mainly care about this and I wrote about it, to appear here 4 products of this manufacturer, as well as Related Products, which are always under the product.
Is there a chance to modify this code?
Hello,
Yes, it’s possible to modify it according to your needs. But submit customization request here because our basic support does not include personal site customization https://themeforest.net/page/item_support_policy , I could just point you in the right direction by providing an example.
Regards
The issue related to '‘Option: more from the brand…’' has been successfully resolved, and the topic is now closed for further responses