public static function get_product_price($product, $return_type, $output_type = '', $only_price = false, $price_checking_done = false)
 {
     $wpshop_price_piloting_option = get_option('wpshop_shop_price_piloting');
     // 			$wpshop_price_piloting_option = 'TTC';
     /** Price for Mini-output **/
     if (!$price_checking_done) {
         /** Checking if it's a product with variation **/
         $variation_option_checking = get_post_meta($product['product_id'], '_wpshop_variation_defining', true);
         if (!empty($variation_option_checking)) {
             $variations_exists = wpshop_products::get_variation($product['product_id']);
         }
         if (!empty($variation_option_checking) && !empty($variations_exists)) {
             if (!empty($variation_option_checking['attributes'])) {
                 foreach ($variation_option_checking['attributes'] as $attribute) {
                     $selected_variation[$attribute] = 0;
                     if (!empty($variation_option_checking['options']) && !empty($variation_option_checking['options']['attributes_default_value']) && array_key_exists($attribute, $variation_option_checking['options']['attributes_default_value'])) {
                         if ($variation_option_checking['options']['attributes_default_value'][$attribute] != 'none') {
                             $selected_variation[$attribute] = $variation_option_checking['options']['attributes_default_value'][$attribute];
                         }
                     }
                 }
             }
             if (!empty($selected_variation)) {
                 $product_with_variation = wpshop_products::get_variation_by_priority($selected_variation, $product['product_id']);
             }
             if (empty($product_with_variation[$product['product_id']]['variations'])) {
                 $product_with_variation[$product['product_id']]['variations'] = array();
             }
             if (!empty($product_with_variation[$product['product_id']]['variation_priority'])) {
                 $product = wpshop_products::get_variation_price_behaviour($product, $product_with_variation[$product['product_id']]['variations'], $product['product_id'], array('type' => $product_with_variation[$product['product_id']]['variation_priority'], 'text_from' => !empty($product_with_variation['text_from']) ? 'on' : ''));
             }
         } else {
             /** It's Simple product Check Discounts for products **/
             $discount_config = self::check_discount_for_product($product['product_id']);
             if (!empty($discount_config)) {
                 if (!empty($discount_config['type']) && !empty($discount_config['value']) && $discount_config['type'] == 'special_price') {
                     $product['price_ttc_before_discount'] = $product['product_price'];
                     $product['price_ht_before_discount'] = $product['price_ht'];
                     $product['price_ht'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $discount_config['value'] : $discount_config['value'] / (1 + $product['tx_tva'] / 100);
                     $product['product_price'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $discount_config['value'] * (1 + $product['tx_tva'] / 100) : $discount_config['value'];
                     $product['tva'] = $product['price_ht'] * ($product['tx_tva'] / 100);
                 } elseif (!empty($discount_config['type']) && !empty($discount_config['value']) && $discount_config['type'] == 'discount_amount') {
                     $product['price_ttc_before_discount'] = $product['product_price'];
                     $product['price_ht_before_discount'] = $product['price_ht'];
                     $product['price_ht'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $product['price_ht_before_discount'] - $discount_config['value'] : ($product['price_ttc_before_discount'] - $discount_config['value']) / (1 + $product['tx_tva'] / 100);
                     $product['product_price'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $product['price_ht'] * (1 + $product['tx_tva'] / 100) : $product['price_ttc_before_discount'] - $discount_config['value'];
                     $product['tva'] = $product['price_ht'] * ($product['tx_tva'] / 100);
                 } elseif (!empty($discount_config['type']) && !empty($discount_config['value']) && $discount_config['type'] == 'discount_rate') {
                     $product['price_ttc_before_discount'] = $product['product_price'];
                     $product['price_ht_before_discount'] = $product['price_ht'];
                     $product['price_ht'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $product['price_ht_before_discount'] * (1 - $discount_config['value'] / 100) : $product['price_ttc_before_discount'] * (1 - $discount_config['value'] / 100) / (1 + $product['tx_tva'] / 100);
                     $product['product_price'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $product['price_ht'] * (1 + $product['tx_tva'] / 100) : $product['price_ttc_before_discount'] * (1 - $discount_config['value'] / 100);
                     $product['tva'] = $product['price_ht'] * ($product['tx_tva'] / 100);
                 }
             }
         }
     }
     $price_infos = self::check_product_price($product);
     $productCurrency = '<span class="wps-currency">' . wpshop_tools::wpshop_get_currency() . '</span>';
     $wps_marketing_tools = new wps_marketing_tools_ctr();
     if (!empty($price_infos)) {
         if ($return_type == 'check_only') {
             /** Check if the product price has been set	*/
             if (isset($price_infos['ati']) && $price_infos['ati'] === '') {
                 return __('This product cannot be purchased - the price is not yet announced', 'wpshop');
             }
             /** Check if the product price is coherent (not less than 0)	*/
             if (isset($price_infos['ati']) && $price_infos['ati'] < 0) {
                 return __('This product cannot be purchased - its price is negative', 'wpshop');
             }
             return true;
         } elseif ($return_type == 'just_price_infos') {
             $tpl_component = array();
             $price = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $price_infos['et'] : $price_infos['ati'];
             $exploded_price = explode('.', number_format($price, 2, '.', ''));
             $price = '<span class="wps-absolute-price">' . $exploded_price[0] . '</span><span class="wpshop_price_centimes_display">,' . (!empty($exploded_price[1]) ? $exploded_price[1] : '') . '</span>';
             $tpl_component['TAX_PILOTING'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? __('ET', 'wpshop') : '';
             $tpl_component['CROSSED_OUT_PRICE'] = '';
             $tpl_component['MESSAGE_SAVE_MONEY'] = '';
             if (!empty($price_infos['discount']['discount_exist'])) {
                 $crossed_out_price = (!empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? number_format($price_infos['et'], 2) : number_format($price_infos['ati'], 2)) . ' ' . $productCurrency;
                 $tpl_component['CROSSED_OUT_PRICE'] = $crossed_out_price;
                 if (!empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT') {
                     $exploded_discount_price = explode('.', number_format($price_infos['discount']['discount_et_price'], 2, '.', ''));
                 } else {
                     $exploded_discount_price = explode('.', number_format($price_infos['discount']['discount_ati_price'], 2, '.', ''));
                 }
                 $discount_price = $exploded_discount_price[0] . '<span class="wpshop_price_centimes_display">,' . (!empty($exploded_discount_price[1]) ? $exploded_discount_price[1] : '') . '</span>';
                 $tpl_component['PRODUCT_PRICE'] = '<span class="wps-absolute-price">' . $discount_price . '</span> ' . $productCurrency;
                 $tpl_component['MESSAGE_SAVE_MONEY'] = $wps_marketing_tools->display_message_you_save_money($price_infos);
             } else {
                 $tpl_component['PRODUCT_PRICE'] = $price . ' ' . $productCurrency;
             }
             $post_type = get_post_type($product['product_id']);
             if ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) {
                 $price_display_attribute = get_post_meta($product['product_id'], '_wpshop_variation_defining', true);
             } elseif ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
                 $parent_def = wpshop_products::get_parent_variation($product['product_id']);
                 if (!empty($parent_def) && !empty($parent_def['parent_post'])) {
                     $parent_post = $parent_def['parent_post'];
                     $price_display_attribute = get_post_meta($parent_post->ID, '_wpshop_variation_defining', true);
                 }
             }
             $price_display_option = get_option('wpshop_catalog_product_option');
             $tpl_component['PRICE_FROM'] = !empty($price_display_attribute) && empty($price_display_attribute['options']) && !empty($price_display_option) && !empty($price_display_option['price_display']) && !empty($price_display_option['price_display']['text_from']) || !empty($price_display_attribute) && (!empty($price_display_attribute['options']) && (!empty($price_display_attribute['options']['price_display']) && !empty($price_display_attribute['options']['price_display']['text_from']))) ? 'on' : '';
             return $tpl_component;
         } else {
             if ($return_type == 'price_display') {
                 $tpl_component = array();
                 $price = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $price_infos['et'] : $price_infos['ati'];
                 $price_data = $price_infos;
                 $exploded_price = explode('.', number_format($price, 2, '.', ''));
                 $price = '<span class="wps-absolute-price">' . $exploded_price[0] . '</span><span class="wpshop_price_centimes_display">.' . (!empty($exploded_price[1]) ? $exploded_price[1] : '') . '</span>';
                 $tpl_component['TAX_PILOTING'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? __('ET', 'wpshop') : '';
                 $tpl_component['CROSSED_OUT_PRICE'] = '';
                 $tpl_component['MESSAGE_SAVE_MONEY'] = '';
                 if (!empty($price_infos['discount']['discount_exist'])) {
                     $text_from = false;
                     /** Get variation defining **/
                     $post_type = get_post_type($product['product_id']);
                     if ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
                         $parent_def = wpshop_products::get_parent_variation($product['product_id']);
                         if (!empty($parent_def) && !empty($parent_def['parent_post'])) {
                             $parent_post = $parent_def['parent_post'];
                             $price_display_attribute = get_post_meta($parent_post->ID, '_wpshop_variation_defining', true);
                         }
                     } else {
                         $price_display_attribute = get_post_meta($product['product_id'], '_wpshop_variation_defining', true);
                     }
                     $text_from = !empty($price_display_attribute) && empty($price_display_attribute['options']) && !empty($price_display_option) && !empty($price_display_option['price_display']) && !empty($price_display_option['price_display']['text_from']) || !empty($price_display_attribute) && (!empty($price_display_attribute['options']) && (!empty($price_display_attribute['options']['price_display']) && !empty($price_display_attribute['options']['price_display']['text_from']))) && !empty($product['text_from']) ? true : false;
                     $exploded_price = explode('.', number_format($price_infos['discount']['discount_et_price'], 2, '.', ''));
                     $price_infos['discount']['discount_et_price'] = '<span class="wps-absolute-price">' . $exploded_price[0] . '</span><span class="wpshop_price_centimes_display">.' . (!empty($exploded_price[1]) ? $exploded_price[1] : '') . '</span>';
                     $exploded_price = explode('.', number_format($price_infos['discount']['discount_ati_price'], 2, '.', ''));
                     $price_infos['discount']['discount_ati_price'] = '<span class="wps-absolute-price">' . $exploded_price[0] . '</span><span class="wpshop_price_centimes_display">.' . (!empty($exploded_price[1]) ? $exploded_price[1] : '') . '</span>';
                     $crossed_out_price = (!empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? number_format($price_infos['et'], 2) : number_format($price_infos['ati'], 2)) . ' ' . $productCurrency;
                     $tpl_component['CROSSED_OUT_PRICE'] = str_replace('.', ',', ($text_from ? __('Price from', 'wpshop') . ' ' : '') . wpshop_display::display_template_element('product_price_template_crossed_out_price', array('CROSSED_OUT_PRICE_VALUE' => $crossed_out_price)));
                     $tpl_component['PRODUCT_PRICE'] = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? '<span class="wps-absolute-price">' . $price_infos['discount']['discount_et_price'] . '</span> ' . $productCurrency : '<span class="wps-absolute-price">' . $price_infos['discount']['discount_ati_price'] . '</span> ' . $productCurrency;
                     $tpl_component['MESSAGE_SAVE_MONEY'] = $wps_marketing_tools->display_message_you_save_money($price_data);
                 } else {
                     if (get_post_type($product['product_id']) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
                         $parent_def = wpshop_products::get_parent_variation($product['product_id']);
                         $pid = $parent_def['parent_post'];
                         $pid = $pid->ID;
                     } else {
                         $pid = $product['product_id'];
                     }
                     $text_from = false;
                     /** Get variation defining **/
                     $post_type = get_post_type($pid);
                     if ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
                         $parent_def = wpshop_products::get_parent_variation($pid);
                         if (!empty($parent_def) && !empty($parent_def['parent_post'])) {
                             $parent_post = $parent_def['parent_post'];
                             $price_display_attribute = get_post_meta($parent_post->ID, '_wpshop_variation_defining', true);
                         }
                     } else {
                         $price_display_attribute = get_post_meta($pid, '_wpshop_variation_defining', true);
                     }
                     $price_display_attribute = get_post_meta($pid, '_wpshop_variation_defining', true);
                     $text_from = !empty($price_display_attribute) && empty($price_display_attribute['options']) && !empty($price_display_option) && !empty($price_display_option['price_display']) && !empty($price_display_option['price_display']['text_from']) || !empty($price_display_attribute) && (!empty($price_display_attribute['options']) && (!empty($price_display_attribute['options']['price_display']) && !empty($price_display_attribute['options']['price_display']['text_from']))) ? true : false;
                     $tpl_component['PRODUCT_PRICE'] = $text_from && !empty($product['text_from']) ? __('Price from', 'wpshop') . ' ' : '';
                     $tpl_component['PRODUCT_PRICE'] .= $price . ' ' . $productCurrency;
                 }
                 // Replace . by ,
                 $tpl_component['PRODUCT_PRICE'] = str_replace('.', ',', $tpl_component['PRODUCT_PRICE']);
                 if ($output_type == 'complete_sheet') {
                     $price_tpl = wpshop_display::display_template_element('product_price_template_complete_sheet', $tpl_component);
                 } elseif ($output_type == 'mini_output' || in_array('mini_output', $output_type)) {
                     $price_tpl = wpshop_display::display_template_element('product_price_template_mini_output', $tpl_component);
                 }
                 return $price_tpl;
             }
         }
     }
     return false;
 }