<?php
if ( ! defined( 'ABSPATH' ) ) exit;

$check_BodyCommerce_sale_badge_color_primary = get_bodycommerce_option( 'BodyCommerce_sale_badge_color_primary_new' );
$check_BodyCommerce_sale_badge_color_secondary = get_bodycommerce_option( 'BodyCommerce_sale_badge_color_secondary_new' );
$check_BodyCommerce_sale_badge_edge_distance = get_bodycommerce_option( 'BodyCommerce_sale_badge_edge_distance_new' );
$check_BodyCommerce_sale_badge_top_distance = get_bodycommerce_option( 'BodyCommerce_sale_badge_top_distance_new' );
$check_BodyCommerce_sale_badge_position = get_bodycommerce_option( 'BodyCommerce_sale_badge_position_new' );
$check_BodyCommerce_sale_badge_size = get_bodycommerce_option( 'BodyCommerce_sale_badge_size_new' );
$check_BodyCommerce_sale_badge_text_color = get_bodycommerce_option( 'BodyCommerce_sale_badge_text_color_new' );
$check_BodyCommerce_sale_badge_text_size = get_bodycommerce_option( 'BodyCommerce_sale_badge_text_size_new' );
$check_BodyCommerce_sale_badge_text_position = get_bodycommerce_option( 'BodyCommerce_sale_badge_text_position_new' );
$check_BodyCommerce_sale_badge_text_line_height = get_bodycommerce_option( 'BodyCommerce_sale_badge_text_line_height_new' );
$check_BodyCommerce_sale_badge_edge_distance_text = get_bodycommerce_option( 'BodyCommerce_sale_badge_edge_distance_text_new' );
$check_BodyCommerce_sale_badge_top_distance_text = get_bodycommerce_option( 'BodyCommerce_sale_badge_top_distance_text_new' );



if ($check_BodyCommerce_sale_badge_color_primary == "rgba(255,255,255,0)") {
  $check_BodyCommerce_sale_badge_color_primary_display = "";
}
else {
  $check_BodyCommerce_sale_badge_color_primary_display = 'background-color: '.$check_BodyCommerce_sale_badge_color_primary.' !important;';
}

if ($check_BodyCommerce_sale_badge_position == "right"){
  $check_BodyCommerce_sale_badge_position_display = "left: auto !important;";
}
else {
  $check_BodyCommerce_sale_badge_position_display = "right: auto !important;";
}

$check_other_settings_absolute_relative_text = get_bodycommerce_option( 'other_settings_absolute_relative_text' );


if ($check_other_settings_absolute_relative_text == 1){
$css_button = '

<style id="bodycommerce-new-badge-default"> 
body.woocommerce #page-container .bodycommerce-new-badge{position:relative;}

body.woocommerce #page-container .bodycommerce-new-badge span.onsale, body.woocommerce-page #page-container .bodycommerce-new-badge span.onsale {
    '.$check_BodyCommerce_sale_badge_color_primary_display.'
    '.$check_BodyCommerce_sale_badge_position.': '.$check_BodyCommerce_sale_badge_edge_distance.'px !important;
    top: '.$check_BodyCommerce_sale_badge_top_distance.'px !important;
font-size: '.$check_BodyCommerce_sale_badge_text_size.'px;
color: '.$check_BodyCommerce_sale_badge_text_color.';
'.$check_BodyCommerce_sale_badge_position_display.'
}

    </style>';
}
else {
  $css_button = '

  <style id="bodycommerce-new-badge-default">
  body.woocommerce #page-container .bodycommerce-new-badge {
    position:absolute;
    '.$check_BodyCommerce_sale_badge_position.': '.$check_BodyCommerce_sale_badge_edge_distance.'px !important;
    top: '.$check_BodyCommerce_sale_badge_top_distance.'px !important;
  }

    body.woocommerce #page-container .bodycommerce-new-badge span.onsale, body.woocommerce-page #page-container .bodycommerce-new-badge span.onsale {
      '.$check_BodyCommerce_sale_badge_color_primary_display.'
  font-size: '.$check_BodyCommerce_sale_badge_text_size.'px;
  color: '.$check_BodyCommerce_sale_badge_text_color.';
  '.$check_BodyCommerce_sale_badge_position_display.'
  }
      </style>';
}



?>
