• Hi,

    Recently installed virtue theme, but I′m getting crazy with terms descriptions. The descriptions are missing.

    That descriptions are from product′s atributes. I have read that “The description is not prominent by default, however some themes may show it.”

    I really apreciate any help. Web: https://www.animalhome.es/web/perros-en-adopcion/pascual/

    The description I want to enable is for “Contacto” atribute.

    Thanks so much!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m confused. I am not aware that a product attribute can’t have a description? Where are you adding this?

    Kadence Themes

    Thread Starter supernotuan

    (@supernotuan)

    Hi,

    I′m adding that in Product > Atributes > Configurate terms. Inside Configurate terms you can edit one, then should modify the name term, slug and description. Look at this image found searching in google: https://www.remicorson.com/wp-content/uploads/2013/08/find-attribute-slug.jpg

    So that description is not enabled by default in theme, isn′t it?

    Thanks so much

    Hi

    I think, that is a woocommerce issue that they don’t show the description. I altered the product-attributes.php in templates/single-product (woocommerce) to show the description (for a specific attribute only: pa_garn), starting at line 54:

    if ( $attribute['is_taxonomy'] ) {
    // changes persillie
    //$values = woocommerce_get_product_terms( $product->id, $attribute['name'], 'names' );
       $values = array();
       $separator = ',';
       // here I check the specific attribute
       if ('pa_specAttr' == $attribute['name']){
        $separator = '<br>';
        $garns = get_the_terms($product->id, 'pa_specAttr');
    
        foreach ( $garns as $term )   {
          $text = $term->name .": ".$term->description;
          $values[$term->name ] = $text ;
        }
      } else {
        $values = woocommerce_get_product_terms( $product->id,
            $attribute['name'], 'names' );
      }
      echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( $separator, $values ) ) ), $attribute, $values );
      // end changes persillie
    } else {
      // Convert pipes to commas and display values
      $values = array_map( 'trim', explode( WC_DELIMITER,
                $attribute['value'] ) );
      echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
    
    }

    If you want it for every attribute, remove the if below the // here I check the specific attribute comment

    However, this is annoying as I have to change the template with every woocommerce update…

    I am very happy if anybody has a better solution!

    You could ask woocommerce support about a good way to hook into the script using a function so you don’t have to edit the file.

    Kadence Themes

    Thread Starter supernotuan

    (@supernotuan)

    Hi,

    Thanks so much for the answers, I′ll ask woocommerce, I hope to get a solution

    Thanks again!!

    Thread Starter supernotuan

    (@supernotuan)

    Hi again,

    I tried that code but is not working, maybe I did something wrong.
    I deleted the if for apply it to all descriptions. I inserted in line 54 and I have tried with differents ways and is not working :_(.

    Thanks anyway

    If you only insert it, it will be overridden by the original code. You would have to replace it. No time now but can have a look at what you need to replace exactly and how it would work for all attributes

    Thread Starter supernotuan

    (@supernotuan)

    Hi,

    Y es, I did it but the descriptions are not showing up evento theterms are disabled. I’ll paste the entire code, maybe I am doing something wrong

    Thanks

    Thread Starter supernotuan

    (@supernotuan)

    Hi,

    This is what I have ??

    <?php
    /**
     * Product attributes
     *
     * Used by list_attributes() in the products class
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.1.3
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    $has_row    = false;
    $alt        = 1;
    $attributes = $product->get_attributes();
    
    ob_start();
    ?>
    <table class="shop_attributes">
    
    	<?php if ( $product->enable_dimensions_display() ) : ?>
    
    		<?php if ( $product->has_weight() ) : $has_row = true; ?>
    			<tr class="<?php if ( ( $alt = $alt * -1 ) == 1 ) echo 'alt'; ?>">
    				<th><?php _e( 'Weight', 'woocommerce' ) ?></th>
    				<td class="product_weight"><?php echo $product->get_weight() . ' ' . esc_attr( get_option( 'woocommerce_weight_unit' ) ); ?></td>
    			</tr>
    		<?php endif; ?>
    
    		<?php if ( $product->has_dimensions() ) : $has_row = true; ?>
    			<tr class="<?php if ( ( $alt = $alt * -1 ) == 1 ) echo 'alt'; ?>">
    				<th><?php _e( 'Dimensions', 'woocommerce' ) ?></th>
    				<td class="product_dimensions"><?php echo $product->get_dimensions(); ?></td>
    			</tr>
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php foreach ( $attributes as $attribute ) :
    		if ( empty( $attribute['is_visible'] ) || ( $attribute['is_taxonomy'] && ! taxonomy_exists( $attribute['name'] ) ) ) {
    			continue;
    		} else {
    			$has_row = true;
    		}
    		?>
    		<tr class="<?php if ( ( $alt = $alt * -1 ) == 1 ) echo 'alt'; ?>">
    			<th><?php echo wc_attribute_label( $attribute['name'] ); ?></th>
    			<td><?php
    				if ( $attribute['is_taxonomy'] ) {
    
                 $values = array();
                 $separator = ',';
                 // here I check the specific attribute
    
                echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( $separator, $values ) ) ), $attribute, $values );
                // end changes persillie
              } else {
                // Convert pipes to commas and display values
                $values = array_map( 'trim', explode( WC_DELIMITER,
                          $attribute['value'] ) );
                echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
    
              }
    			?></td>
    		</tr>
    	<?php endforeach; ?>
    
    </table>
    <?php
    if ( $has_row ) {
    	echo ob_get_clean();
    } else {
    	ob_end_clean();
    }
    Thread Starter supernotuan

    (@supernotuan)

    Hello,

    The answer from woocommerce is no:

    “I’m sorry, we are not able to provide support for third-party themes and customizations, as per our support policy”

    :_(

    ?Someone can help me please?

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Term/Atributes descriptions’ is closed to new replies.