/**
  * Display Classic Checkout
  */
 function show_classic_checkout()
 {
     if (!empty($_GET['action']) && $_GET['action'] == 'direct_payment_link') {
         wpshop_checkout::direct_payment_link($_GET['token'], $_GET['order_id'], $_GET['login']);
     }
     $checkout_step_indicator = do_shortcode('[wps_checkout_step_indicator]');
     $checkout_content = '';
     if (!empty($_GET['order_step'])) {
         switch ($_GET['order_step']) {
             case 1:
                 ob_start();
                 require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-one");
                 $checkout_content .= ob_get_contents();
                 ob_end_clean();
                 break;
             case 2:
                 if (get_current_user_id() != 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=3';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     ob_start();
                     require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-two");
                     $checkout_content .= ob_get_contents();
                     ob_end_clean();
                 }
                 break;
             case 3:
                 if (get_current_user_id() == 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=2';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     if (!empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items'])) {
                         ob_start();
                         require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-three");
                         $checkout_content .= ob_get_contents();
                         ob_end_clean();
                         $url = apply_filters('wps_extra_signup_actions', isset($url) ? $url : '');
                         if (!empty($url)) {
                             wpshop_tools::wpshop_safe_redirect($url);
                         }
                     } else {
                         $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                         $url = get_permalink($checkout_page_id);
                         wpshop_tools::wpshop_safe_redirect($url);
                     }
                 }
                 break;
             case 4:
                 if (get_current_user_id() == 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=2';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     if (!empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items'])) {
                         ob_start();
                         require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-four");
                         $checkout_content .= ob_get_contents();
                         ob_end_clean();
                     } else {
                         $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                         $url = get_permalink($checkout_page_id);
                         wpshop_tools::wpshop_safe_redirect($url);
                     }
                 }
                 break;
             case 5:
                 if (get_current_user_id() == 0) {
                     $permalink_option = get_option('permalink_structure');
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=2';
                     wpshop_tools::wpshop_safe_redirect($url);
                 } else {
                     $wps_cart = new wps_cart();
                     $order = $wps_cart->calcul_cart_information(array());
                     $wps_cart->store_cart_in_session($order);
                     $shipping_option = get_option('wpshop_shipping_address_choice');
                     if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items']) && (!empty($shipping_option) && !empty($shipping_option['activate']) && !empty($_SESSION['shipping_method']) || !empty($shipping_option) && empty($shipping_option['activate']))) {
                         $order_id = !empty($_SESSION['cart']['order_id']) ? wpshop_tools::varSanitizer($_SESSION['cart']['order_id']) : 0;
                         ob_start();
                         require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-five");
                         $checkout_content .= ob_get_contents();
                         ob_end_clean();
                     } else {
                         $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                         $url = get_permalink($checkout_page_id);
                         wpshop_tools::wpshop_safe_redirect($url);
                     }
                 }
                 break;
             case 6:
                 if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items'])) {
                     $wps_marketing_tools_ctr = new wps_marketing_tools_ctr();
                     $checkout_content .= $wps_marketing_tools_ctr->display_ecommerce_ga_tracker($_SESSION['order_id']);
                     $checkout_content .= $this->wps_classic_confirmation_message();
                 } else {
                     $checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
                     $url = get_permalink($checkout_page_id);
                     wpshop_tools::wpshop_safe_redirect($url);
                 }
                 break;
             default:
                 ob_start();
                 require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic-checkout", "step-one");
                 $checkout_content .= ob_get_contents();
                 ob_end_clean();
                 break;
         }
     } else {
         $checkout_content = do_shortcode('[wps_cart]');
     }
     require_once wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "classic_checkout");
 }
 /**
  *	Define output for product
  *
  *	@param mixed $initialContent The initial product content defined into wordpress basic admin interface
  *	@param integer $product_id The product identifier we want to get and output attribute for
  *
  *	@return mixed $content The content to add or to modify the product output in frontend
  */
 public static function product_complete_sheet_output($initialContent, $product_id)
 {
     $content = $attributeContentOutput = '';
     $wps_product_ctr = new wps_product_ctr();
     /** Log number of view for the current product	*/
     $product_view_number = get_post_meta($product_id, WPSHOP_PRODUCT_VIEW_NB, true);
     $product_view_number++;
     update_post_meta($product_id, WPSHOP_PRODUCT_VIEW_NB, $product_view_number);
     /** Get product definition	*/
     $product = self::get_product_data($product_id);
     wp_cache_set('wpshop_product_data_' . $product_id, $product);
     /** Get the product thumbnail	*/
     $productThumbnail = wpshop_display::display_template_element('product_thumbnail_default', array());
     if (has_post_thumbnail($product_id)) {
         $thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
         $tpl_component = array();
         $tpl_component['PRODUCT_THUMBNAIL_URL'] = $thumbnail_url[0];
         $tpl_component['PRODUCT_THUMBNAIL'] = get_the_post_thumbnail($product_id, 'wpshop-product-galery');
         $tpl_component['PRODUCT_THUMBNAIL_FULL'] = get_the_post_thumbnail($product_id, 'full');
         $image_attributes = wp_get_attachment_metadata(get_post_thumbnail_id());
         if (!empty($image_attributes) && !empty($image_attributes['sizes']) && is_array($image_attributes['sizes'])) {
             foreach ($image_attributes['sizes'] as $size_name => $size_def) {
                 $tpl_component['PRODUCT_THUMBNAIL_' . strtoupper($size_name)] = wp_get_attachment_image(get_post_thumbnail_id(), $size_name);
                 $tpl_component['PRODUCT_THUMBNAIL_' . strtoupper($size_name)] = !empty($tpl_component['PRODUCT_THUMBNAIL_' . strtoupper($size_name)]) ? $tpl_component['PRODUCT_THUMBNAIL_' . strtoupper($size_name)] : WPSHOP_DEFAULT_PRODUCT_PICTURE;
             }
         }
         $productThumbnail = wpshop_display::display_template_element('product_thumbnail', $tpl_component);
         unset($tpl_component);
     }
     $product_document_galery = wps_media_manager_frontend_ctr::get_product_complete_sheet_attachments($product_id);
     /**	Retrieve product attributes for output	*/
     $attributeContentOutput = wpshop_attributes::attribute_of_entity_to_tab(wpshop_entities::get_entity_identifier_from_code(self::currentPageCode), $product_id, $product);
     /** Retrieve product price */
     $price_attribute = wpshop_attributes::getElement('product_price', "'valid'", 'code');
     $price_display = wpshop_attributes::check_attribute_display($price_attribute->is_visible_in_front, $product['custom_display'], 'attribute', 'product_price', 'complete_sheet');
     $catalog_options = get_option('wpshop_catalog_main_option', array());
     $productPrice = '';
     $wpshop_price_piloting_option = get_option('wpshop_shop_price_piloting');
     $check_product_price = wpshop_prices::check_product_price($product);
     $result_price_piloting = !empty($wpshop_price_piloting_option) && $wpshop_price_piloting_option == 'HT' ? $check_product_price['et'] : $check_product_price['ati'];
     if ($price_display && !(!empty($catalog_options) && (!empty($catalog_options['wpshop_catalog_empty_price_behaviour']) && $catalog_options['wpshop_catalog_empty_price_behaviour'] == 'yes') && $result_price_piloting == 0)) {
         $productPrice = wpshop_prices::get_product_price($product, 'price_display', 'complete_sheet');
     }
     /** Check if there is at less 1 product in stock	*/
     $productStock = $wps_product_ctr->check_stock($product_id, 1);
     $productStock = $productStock === true ? 1 : null;
     /** if !product stock check product have variation with stock **/
     // 		if ( empty($productStock) ) {
     $product_variation_meta = get_post_meta($product_id, '_wpshop_variation_defining', true);
     if (!empty($product_variation_meta) && !empty($product_variation_meta['options']) && !empty($product_variation_meta['options']['priority']) && in_array('combined', $product_variation_meta['options']['priority'])) {
         $variations = wpshop_products::get_variation($product_id);
         if (!empty($variations)) {
             foreach ($variations as $variation) {
                 if (!empty($variation) && !empty($variation['variation_dif']) && array_key_exists('product_stock', $variation['variation_dif']) && round($variation['variation_dif']['product_stock']) > 0) {
                     $productStock = 1;
                 }
             }
         }
     }
     // 		}
     /** Define "Add to cart" button	 */
     $add_to_cart_button_display_state = wpshop_attributes::check_attribute_display(WPSHOP_DEFINED_SHOP_TYPE == 'sale' ? 'yes' : 'no', $product['custom_display'], 'product_action_button', 'add_to_cart', 'complete_sheet');
     $display_price_state_when_price_is_empty = true;
     if (empty($productPrice) && (!empty($catalog_options) || !empty($catalog_options['wpshop_catalog_empty_price_behaviour']) && $catalog_options['wpshop_catalog_empty_price_behaviour'] == 'yes')) {
         $display_price_state_when_price_is_empty = false;
     } else {
         if (!empty($productPrice)) {
             $display_price_state_when_price_is_empty = true;
         }
     }
     $add_to_cart_button = true === $add_to_cart_button_display_state && true === $display_price_state_when_price_is_empty ? self::display_add_to_cart_button($product_id, $productStock, 'complete') : '';
     $product_quantity_chooser_input = true === $add_to_cart_button_display_state ? wpshop_display::display_template_element('product_complete_sheet_quantity_chooser', array('PRODUCT_ID' => $product_id)) : '';
     /** Define "Ask a quotation" button	*/
     $quotation_button = self::display_quotation_button($product_id, !empty($product['quotation_allowed']) ? $product['quotation_allowed'] : null, 'complete');
     /** Template parameters	*/
     $template_part = 'product_complete_tpl';
     $tpl_component = array();
     $tpl_component['PRODUCT_VARIATIONS'] = wpshop_products::wpshop_variation($product_id);
     $tpl_component['PRODUCT_ID'] = $product_id;
     $tpl_component['PRODUCT_TITLE'] = $product['post_title'];
     $tpl_component['PRODUCT_THUMBNAIL'] = $productThumbnail;
     $tpl_component['PRODUCT_GALERY_PICS'] = '';
     $tpl_component['PRODUCT_PRICE'] = $productPrice;
     $modules_option = get_option('wpshop_modules');
     $tpl_component['LOW_STOCK_ALERT_MESSAGE'] = '';
     if (!empty($modules_option) && !empty($modules_option['wpshop_low_stock_alert']) && $modules_option['wpshop_low_stock_alert']['activated'] == 'on') {
         $wps_marketing_tools = new wps_marketing_tools_ctr();
         $tpl_component['LOW_STOCK_ALERT_MESSAGE'] = $wps_marketing_tools->display_alert_stock_message(array('id' => $product_id));
     }
     /** Gallery **/
     $tpl_component['PRODUCT_COMPLETE_SHEET_GALLERY'] = wps_media_manager_frontend_ctr::get_product_complete_sheet_galery($product_id);
     $product_new_def = self::display_product_special_state('declare_new', 'complete', !empty($product['declare_new']) ? $product['declare_new'] : 'no', !empty($product['set_new_from']) ? $product['set_new_from'] : '', !empty($product['set_new_to']) ? $product['set_new_to'] : '');
     $product_new = $product_new_def['output'];
     $product_class = $product_new_def['class'];
     $product_featured_def = self::display_product_special_state('highlight_product', 'complete', !empty($product['highlight_product']) ? $product['highlight_product'] : 'no', !empty($product['highlight_from']) ? $product['highlight_from'] : '', !empty($product['highlight_to']) ? $product['highlight_to'] : '');
     $product_featured = $product_featured_def['output'];
     $product_class .= $product_featured_def['class'];
     $tpl_component['PRODUCT_IS_NEW'] = $product_new;
     $tpl_component['PRODUCT_IS_FEATURED'] = $product_featured;
     $tpl_component['PRODUCT_EXTRA_STATE'] = $tpl_component['PRODUCT_IS_NEW'] . $tpl_component['PRODUCT_IS_FEATURED'];
     $tpl_component['PRODUCT_INITIAL_CONTENT'] = $initialContent;
     $tpl_component['PRODUCT_BUTTON_ADD_TO_CART'] = $add_to_cart_button;
     $tpl_component['PRODUCT_BUTTON_QUOTATION'] = $quotation_button;
     $tpl_component['PRODUCT_QUANTITY_CHOOSER'] = $product_quantity_chooser_input;
     $tpl_component['PRODUCT_BUTTONS'] = $tpl_component['PRODUCT_BUTTON_QUOTATION'] . $tpl_component['PRODUCT_BUTTON_ADD_TO_CART'];
     $tpl_component['PRODUCT_GALERY_DOCS'] = $product_document_galery;
     $tpl_component['PRODUCT_FEATURES'] = $attributeContentOutput;
     $tpl_component = apply_filters('wps-filter-product-complete-sheet-output', $tpl_component, $product_id);
     /** Build template	*/
     $tpl_way_to_take = wpshop_display::check_way_for_template($template_part);
     if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) {
         /*	Include the old way template part	*/
         ob_start();
         require wpshop_display::get_template_file($tpl_way_to_take[1]);
         $content = ob_get_contents();
         ob_end_clean();
     } else {
         $content = wpshop_display::display_template_element($template_part, $tpl_component);
     }
     unset($tpl_component);
     return $content;
 }
 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;
 }