S
S
Sergey Shkurikhin2020-11-08 22:20:05
PHP
Sergey Shkurikhin, 2020-11-08 22:20:05

How to display rating stars above a short description?

How to display rating stars above a short description? Shown in catalog but not here. In the css of the theme, I did not find it to be disabled. How are they displayed by default?
5fa844a0121b9996403904.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey, 2016-07-11
@mrzgt

The question is not clear, the amount of which should be more?

SELECT  t1.email
FROM  " . DB_PREFIX . "stock AS t1
INNER JOIN product ON (product_id =  '" . (int) $product_id."' AND status = 0)

T
trenton, 2020-11-08
@trenton

add_filter('woocommerce_product_get_rating_html', 'themename_get_rating_html', 10, 2);

  function themename_get_rating_html($rating_html, $rating) {
  	if ( $rating > 0 ) {
    	$title = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $rating );
  	} else {
    	$title = 'Not yet rated';
    	$rating = 0;
  	}
  	$rating_html  = '<div class="star-rating" title="' . $title . '">';
  	$rating_html .= '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%"><strong class="rating">' . $rating . '</strong> ' . __( 'out of 5', 'woocommerce' ) . '</span>';
  	$rating_html .= '</div>';
  	return $rating_html;
  }

If all woocommerce styles are disabled, then you will have to get them from the disabled default document so that the stars can be seen, otherwise he stumbled on this and sat for a very long time. In general, if there is something like SSSS instead of stars, then the script works, but their styles do not.

S
Sergey Shkurikhin, 2020-11-15
@shkyrikhin99

It looks like I really have styles turned off, since not only the stars do not work, but also other elements .. Is there a way to turn it on?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question