<?php
namespace Elementor;

class starsingle extends Widget_Base {
	
	public function get_name() {
		return 'starsingle';
	}
	
	public function get_title() {
		return 'نمایش امتیاز';
	}
	
 public function get_icon() {
		return 'eicon eicon-product-rating';
    }
    
    public function get_categories() {
        return [ 'farnamproduct' ];
    }

	
	protected function register_controls() {


		


		
		
  $this->start_controls_section(
            'farnam_product_style_2',
            [
                'label' => esc_html__( 'تنظیمات استایل و ظاهر', 'woolentor' ),
            ]
        );


		    $this->add_control(
'sepidcolor-2',
			[
				'label' => __( 'رنگ ستاره ها', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .class-star.single-product-starttytryrty .star-rating span::before' => 'color: {{VALUE}} !important',
				],
			]
           );
	
	
		
		
		$this->end_controls_section();
		
	}
	protected function render() {
		$settings = $this->get_settings_for_display();


				?>
<div class="class-star single-product-starttytryrty">

    <?php

	if ( ! post_type_supports( 'product', 'comments' ) ) {
			return;
		}

		global $product;

		if ( ! $product ) {
			return;
		}
if ( 'no' === get_option( 'woocommerce_enable_review_rating' ) ) {
	return;
}

$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average      = $product->get_average_rating();

if ( $rating_count > 0 ) : ?>
  <?php if (is_product()) { ?>
	<div class="woocommerce-product-rating">
		<?php echo wc_get_rating_html( $average, $rating_count ); ?>
		<?php if ( comments_open() ) : ?><?php endif ?>


	</div>
  <?php } ?>
<?php endif; ?>
</div>
		<?php


	}


	
	protected function _content_template() {

    }
	
	
}