<?php
namespace Elementor;

class offersingle extends Widget_Base {
	
	public function get_name() {
		return 'offersingle';
	}
	
	public function get_title() {
		return 'تخفیف صفحه محصول';
	}
	
 public function get_icon() {
		return 'eicon eicon-product-price';
    }
    
    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}} .mizan-flash5555.ftertevqqw1' => 'background: {{VALUE}} !important',
				],
			]
           );
		      $this->add_control(
'sepidcolor-3',
			[
				'label' => __( 'رنگ متن', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .mizan-flash5555.ftertevqqw1' => 'color: {{VALUE}} !important',
				],
			]
           );
		   $this->add_control(
                        'titr-mehr-4',
                        [
                            'label' => __( 'سایه باکس تخفیف', 'woolentor' ),
                            'type' => Controls_Manager::HEADING,
                                              ]
                    );

			$this->add_group_control(
			\Elementor\Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'box_shadow',
				'selector' => '{{WRAPPER}} .mizan-flash5555.ftertevqqw1',
			]
		);
			
				  $this->add_control(
                        'titr-mehr-2',
                        [
                            'label' => __( 'کادر باکس تخفیف', 'woolentor' ),
                            'type' => Controls_Manager::HEADING,
                                              ]
                    );
		$this->add_group_control(
			\Elementor\Group_Control_Border::get_type(),
			[
				'name' => 'border-mehr-2',
				'selector' => '{{WRAPPER}} .mizan-flash5555.ftertevqqw1',
			]
		);	
				$this->add_responsive_control(
			'title_padding',
			[
				'type' => \Elementor\Controls_Manager::DIMENSIONS,
				'label' => esc_html__( 'فاصله داخلی', 'textdomain' ),
				'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
				'selectors' => [
					'{{WRAPPER}} .mizan-flash5555.ftertevqqw1' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);
		


	$this->add_control(
			'border_style',
			[
				'label' => esc_html__( 'جهت باکس', 'textdomain' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'default' => 'right',
				'options' => [
					'right' => esc_html__( 'راست', 'textdomain' ),
					'left'  => esc_html__( 'چپ', 'textdomain' ),
					'unset' => esc_html__( 'وسط', 'textdomain' ),
				],
				'selectors' => [
					'{{WRAPPER}} .mizan-flash5555.ftertevqqw1' => 'float: {{VALUE}};',
				],
			]
		);
		
					 $this->add_responsive_control(
                        'sepidborder-2',
                        [
                            'label' => esc_html__( 'گردی باکس تخفیف', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .mizan-flash5555.ftertevqqw1' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
		$this->end_controls_section();
		
	}
	protected function render() {
		$settings = $this->get_settings_for_display();
defined( 'ABSPATH' ) || exit;

 $settings   = $this->get_settings_for_display();
        global $product;
        $product = wc_get_product();

     
            if ( empty( $product ) ) { return; }
            $current_theme = wp_get_theme();
if( $product->is_on_sale() ) {
				?>
			  <?php if ( $product->is_on_sale() ) : ?>


	<div class="mizan-flash5555  ftertevqqw1">
<?php echo apply_filters( 'woocommerce_sale_flashtwo', $product ); ?>
	
</div>	<?php
endif;

?>

		<?php

}
	}


	
	protected function _content_template() {

    }
	
	
}

 