/**
  * Get attribute defined as product option specific attribute
  *
  * @param array $variations_attribute_parameters Allows to give some parameters for customize list
  * @return string The output for all specific attribute in each product with option
  */
 public static function get_variation_attribute($variations_attribute_parameters)
 {
     $output = '';
     $attribute_list = wpshop_attributes::getElement('yes', "'valid'", "is_used_in_variation", true);
     if (!empty($attribute_list)) {
         $tpl_component = array();
         $tpl_component['ADMIN_VARIATION_DETAIL'] = '';
         $price_piloting_option = get_option('wpshop_shop_price_piloting');
         foreach ($attribute_list as $attribute_def) {
             $variations_attribute_parameters['field_custom_name_prefix'] = $variations_attribute_parameters['field_name'] . '[attribute][' . $attribute_def->data_type . ']';
             $attribute_output_def = wpshop_attributes::get_attribute_field_definition($attribute_def, !empty($variations_attribute_parameters['variation_dif_values'][$attribute_def->code]) ? $variations_attribute_parameters['variation_dif_values'][$attribute_def->code] : '', $variations_attribute_parameters);
             $field_output = $attribute_output_def['output'];
             /*	Build array for output complete customization	*/
             $tpl_component['ADMIN_VARIATION_DETAIL_LABEL_' . strtoupper($attribute_def->code)] = $attribute_output_def['label'];
             $tpl_component['ADMIN_VARIATION_DETAIL_INPUT_' . strtoupper($attribute_def->code)] = $field_output;
             $sub_tpl_component = array();
             $sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_CODE'] = ' wpshop_variation_special_value_container_' . $attribute_output_def['name'];
             $sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_ID'] = $attribute_output_def['id'];
             $sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_LABEL'] = $attribute_output_def['label'];
             $sub_tpl_component['ADMIN_VARIATION_DETAIL_DEF_INPUT'] = $field_output;
             $tpl_component['ADMIN_VARIATION_DETAIL'] .= wpshop_display::display_template_element('wpshop_admin_variation_item_details_line', $sub_tpl_component, array(), 'admin');
             unset($sub_tpl_component);
         }
         $output .= wpshop_display::display_template_element('wpshop_admin_variation_item_details', $tpl_component, array(), 'admin');
     }
     return $output;
 }
/**
 * Add a new value to an attribute from select type directly from an entity element edition interface
 */
function ajax_new_option_for_select_from_product_edition_callback()
{
    check_ajax_referer('wpshop_new_option_for_attribute_creation', 'wpshop_ajax_nonce');
    global $wpdb;
    $result = '';
    $attribute_selected_values = isset($_POST['attribute_selected_values']) ? (array) $_POST['attribute_selected_values'] : array();
    $item_in_edition = isset($_POST['item_in_edition']) ? intval(wpshop_tools::varSanitizer($_POST['item_in_edition'])) : '0';
    $attribute_code = isset($_POST['attribute_code']) ? wpshop_tools::varSanitizer($_POST['attribute_code']) : '0';
    $attribute_place_display = isset($_POST['attribute_place_display']) ? wpshop_tools::varSanitizer($_POST['attribute_place_display']) : 'backend';
    $current_page_code = isset($_POST['attribute_page_code']) ? wpshop_tools::varSanitizer($_POST['attribute_page_code']) : wpshop_products::currentPageCode;
    $attribute = wpshop_attributes::getElement($attribute_code, "'valid'", 'code');
    $type = $attribute->data_type_to_use;
    $attribute_options_label = isset($_POST['attribute_new_label']) ? wpshop_tools::varSanitizer($_POST['attribute_new_label']) : null;
    $attribute_options_value = sanitize_title($attribute_options_label);
    if ($type == 'internal') {
        /**	Check if the given value does not exist	*/
        $query = $wpdb->prepare("SELECT * FROM " . $wpdb->posts . " WHERE post_title = %s AND post_status = 'publish'", $attribute_options_label);
        $existing_values = $wpdb->get_results($query);
        /**	If the value does not exist, we create it and output, in case it exists alert an error message	*/
        if (count($existing_values) <= 0) {
            $result_status = true;
            /**	Create the new value as an entity into post database	*/
            $new_post = array('post_title' => $attribute_options_label, 'post_name' => $attribute_options_value, 'post_status' => 'publish', 'post_type' => $attribute->default_value);
            $new_option_id = wp_insert_post($new_post);
            $input_def['valueToPut'] = 'index';
        } else {
            $result_status = false;
            $result = __('This value already exist for this attribute', 'wpshop');
        }
    } else {
        /**	Check if the given value does not exist	*/
        $query = $wpdb->prepare("SELECT * FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE (label = %s OR value = %s) AND attribute_id = %d AND status = 'valid'", str_replace(",", ".", $attribute_options_label), $attribute_options_value, $attribute->id);
        $existing_values = $wpdb->get_results($query);
        /**	If the value does not exist, we create it and output, in case it exists alert an error message	*/
        if (count($existing_values) <= 0) {
            $result_status = true;
            $position = 1;
            /**	Get the last value position for adding the new at the end	*/
            $query = $wpdb->prepare("SELECT position FROM " . WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS . " WHERE attribute_id = %d", $attribute->id);
            $position = $wpdb->get_var($query);
            /**	Add the new value into database	*/
            $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('creation_date' => current_time('mysql', 0), 'status' => 'valid', 'attribute_id' => $attribute->id, 'position' => $position, 'label' => str_replace(",", ".", stripslashes($attribute_options_label)), 'value' => stripslashes($attribute_options_value)));
            $new_option_id = $wpdb->insert_id;
        } else {
            $result_status = false;
            $result = __('This value already exist for this attribute', 'wpshop');
        }
    }
    if ($result_status) {
        $tmp_selection_for_output = array();
        foreach ($attribute_selected_values as $value) {
            $tmp_selection_for_output[]['value'] = $value;
        }
        $tmp_selection_for_output[]['value'] = $new_option_id;
        foreach ($tmp_selection_for_output as $tmp_value) {
            $selection_for_output[] = (object) $tmp_value;
        }
        $attribute_selected_values[] = $new_option_id;
        $input = wpshop_attributes::get_attribute_field_definition($attribute, $selection_for_output, array('page_code' => $current_page_code, 'from' => $attribute_place_display));
        $result = $input['output'] . $input['options'];
    }
    echo json_encode(array($result_status, $result, $attribute_code));
    die;
}
 /**
  * Generate an array with all fields for the address form construction. Classified by address type.
  * @param $typeof
  * @return array
  */
 function get_addresss_form_fields_by_type($typeof, $id = '')
 {
     $current_item_edited = isset($id) ? (int) wpshop_tools::varSanitizer($id) : null;
     $address = array();
     $all_addresses = '';
     /*	Get the attribute set details in order to build the product interface	*/
     $atribute_set_details = wpshop_attributes_set::getAttributeSetDetails($typeof, "'valid'");
     if (!empty($atribute_set_details)) {
         foreach ($atribute_set_details as $productAttributeSetDetail) {
             $address = array();
             $group_name = $productAttributeSetDetail['name'];
             if (count($productAttributeSetDetail['attribut']) >= 1) {
                 foreach ($productAttributeSetDetail['attribut'] as $attribute) {
                     if (!empty($attribute->id)) {
                         if (!empty($_POST['submitbillingAndShippingInfo'])) {
                             $value = $_POST['attribute'][$typeof][$attribute->data_type][$attribute->code];
                         } else {
                             $value = wpshop_attributes::getAttributeValueForEntityInSet($attribute->data_type, $attribute->id, wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS), $current_item_edited, array('intrinsic' => $attribute->is_intrinsic, 'backend_input' => $attribute->backend_input));
                         }
                         $attribute_output_def = wpshop_attributes::get_attribute_field_definition($attribute, $value, array());
                         $attribute_output_def['id'] = 'address_' . $typeof . '_' . $attribute_output_def['id'];
                         $address[str_replace('-', '_', sanitize_title($group_name)) . '_' . $attribute->code] = $attribute_output_def;
                     }
                 }
             }
             $all_addresses[$productAttributeSetDetail['attribute_set_id']][$productAttributeSetDetail['id']]['name'] = $group_name;
             $all_addresses[$productAttributeSetDetail['attribute_set_id']][$productAttributeSetDetail['id']]['content'] = $address;
             $all_addresses[$productAttributeSetDetail['attribute_set_id']][$productAttributeSetDetail['id']]['id'] = str_replace('-', '_', sanitize_title($group_name));
             $all_addresses[$productAttributeSetDetail['attribute_set_id']][$productAttributeSetDetail['id']]['attribute_set_id'] = $productAttributeSetDetail['attribute_set_id'];
         }
     }
     return $all_addresses;
 }
        ?>
</label>
				<div id="<?php 
        echo $signup_field->code;
        ?>
" class="wps-form"><?php 
        echo $attribute_output_def['output'];
        echo $attribute_output_def['options'];
        ?>
</div>
			</div>
		<?php 
        /** Check confirmation field **/
        if ($signup_field->_need_verification == 'yes') {
            $signup_field->code = $signup_field->code . '2';
            $attribute_output_def = wpshop_attributes::get_attribute_field_definition($signup_field, $value, array('from' => 'frontend'));
            ?>
				<div class="wps-form-group">
					<label for="<?php 
            echo $signup_field->code;
            ?>
"><?php 
            printf(__('Confirm %s', 'wpshop'), stripslashes(strtolower(__($signup_field->frontend_label, 'wpshop'))));
            ?>
 <?php 
            echo !empty($attribute_output_def['required']) && $attribute_output_def['required'] == 'yes' ? '<em>*</em>' : '';
            ?>
</label>
					<div id="<?php 
            echo $signup_field->code;
            ?>
 /**
  * Retrieve and display the variation for a given product
  * @param integer $product_id The product identifier to get variation for
  */
 public static function wpshop_variation($post_id = '', $from_admin = false, $order_id = '', $qty = 1)
 {
     global $wp_query;
     $output = '';
     $product_id = empty($post_id) ? $wp_query->post->ID : $post_id;
     $wpshop_product_attributes_frontend_display = get_post_meta($product_id, '_wpshop_product_attributes_frontend_display', true);
     $head_wpshop_variation_definition = get_post_meta($product_id, '_wpshop_variation_defining', true);
     /**	Get attribute order for current product	*/
     $product_attribute_order_detail = wpshop_attributes_set::getAttributeSetDetails(get_post_meta($product_id, WPSHOP_PRODUCT_ATTRIBUTE_SET_ID_META_KEY, true));
     $output_order = array();
     if (count($product_attribute_order_detail) > 0) {
         if (!empty($product_attribute_order_detail)) {
             foreach ($product_attribute_order_detail as $product_attr_group_id => $product_attr_group_detail) {
                 foreach ($product_attr_group_detail['attribut'] as $position => $attribute_def) {
                     if (!empty($attribute_def->code)) {
                         $output_order[$attribute_def->code] = $position;
                     }
                 }
             }
         }
     }
     $variations_params = array();
     $variation_attribute = array();
     $variation_attribute_ordered = array();
     $possible_values = array();
     $possible_values_for_selection_calculation = array();
     /*	Vérification de l'existence de déclinaison pour le produit	*/
     $wpshop_variation_list = self::get_variation($product_id);
     if (!empty($wpshop_variation_list)) {
         foreach ($wpshop_variation_list as $variation) {
             if (!empty($variation['variation_def'])) {
                 $display_option = get_post_meta($post_id, '_wpshop_product_attributes_frontend_display', true);
                 foreach ($variation['variation_def'] as $attribute_code => $attribute_value) {
                     if (empty($display_option) || !empty($display_option['attribute']) && !empty($display_option['attribute'][$attribute_code]) && !empty($display_option['attribute'][$attribute_code]['complete_sheet'])) {
                         $tpl_component = array();
                         $attribute_db_definition = wpshop_attributes::getElement($attribute_code, "'valid'", 'code');
                         $default_value_is_serial = false;
                         $attribute_list_first_element = $attribute_db_definition->default_value;
                         if (!empty($attribute_db_definition->default_value) && ($attribute_db_definition->default_value == serialize(false) || @unserialize($attribute_db_definition->default_value) !== false)) {
                             $default_value_is_serial = true;
                             $tmp_default_value = unserialize($attribute_db_definition->default_value);
                             $attribute_list_first_element = !empty($tmp_default_value['field_options']['label_for_first_item']) ? $tmp_default_value['field_options']['label_for_first_item'] : null;
                         }
                         if ($default_value_is_serial && !empty($attribute_list_first_element) && $attribute_list_first_element != 'none') {
                             $possible_values[$attribute_code][0][0] = $default_value_is_serial && !empty($attribute_list_first_element) && $attribute_list_first_element != 'none' ? stripslashes(sprintf($attribute_list_first_element, strtolower($attribute_db_definition->frontend_label))) : __('Choose a value', 'wpshop');
                         }
                         if (!empty($attribute_value) && $attribute_db_definition->data_type_to_use == 'custom') {
                             $tpl_component['VARIATION_VALUE'] = stripslashes(wpshop_attributes::get_attribute_type_select_option_info($attribute_value, 'label', 'custom'));
                             $position = wpshop_attributes::get_attribute_type_select_option_info($attribute_value, 'position', 'custom');
                         } else {
                             if (!empty($attribute_value) && $attribute_db_definition->data_type_to_use == 'internal') {
                                 $post_def = get_post($attribute_value);
                                 $tpl_component['VARIATION_VALUE'] = stripslashes($post_def->post_title);
                                 $position = $post_def->menu_order;
                             }
                         }
                         if (!empty($variation['variation_dif'])) {
                             foreach ($variation['variation_dif'] as $attribute_dif_code => $attribute_dif_value) {
                                 $wpshop_prices_attributes = unserialize(WPSHOP_ATTRIBUTE_PRICES);
                                 $the_value = $attribute_dif_value;
                                 if (in_array($attribute_dif_code, $wpshop_prices_attributes)) {
                                     $the_value = wpshop_display::format_field_output('wpshop_product_price', $attribute_dif_value);
                                 }
                                 $tpl_component['VARIATION_DIF_' . strtoupper($attribute_dif_code)] = stripslashes($the_value);
                             }
                         }
                         if (!empty($attribute_value)) {
                             $possible_values[$attribute_code][$position][$attribute_value] = wpshop_display::display_template_element('product_variation_item_possible_values', $tpl_component, array('type' => 'attribute_for_variation', 'id' => $attribute_code));
                             $possible_values_for_selection_calculation[$attribute_code][$attribute_value] = $tpl_component['VARIATION_VALUE'];
                         }
                         unset($tpl_component);
                     }
                 }
             }
         }
         $variation_tpl = array();
         if (!empty($head_wpshop_variation_definition['attributes'])) {
             foreach ($head_wpshop_variation_definition['attributes'] as $attribute_code) {
                 $attribute_db_definition = wpshop_attributes::getElement($attribute_code, "'valid'", 'code');
                 if (!empty($attribute_db_definition)) {
                     $attribute_display_state = wpshop_attributes::check_attribute_display($attribute_db_definition->is_visible_in_front, $wpshop_product_attributes_frontend_display, 'attribute', $attribute_code, 'complete_sheet');
                     $is_required = !empty($head_wpshop_variation_definition['options']) && !empty($head_wpshop_variation_definition['options']['required_attributes']) && in_array($attribute_code, $head_wpshop_variation_definition['options']['required_attributes']) ? true : false;
                     if (!$is_required && $attribute_db_definition->is_required == 'yes') {
                         $is_required = true;
                     }
                     $input_def = array();
                     $input_def['type'] = $attribute_db_definition->frontend_input;
                     $value = isset($head_wpshop_variation_definition['options']['attributes_default_value'][$attribute_code]) ? $head_wpshop_variation_definition['options']['attributes_default_value'][$attribute_code] : (!empty($attribute_db_definition->default_value) ? $attribute_db_definition->default_value : null);
                     if (in_array($attribute_db_definition->frontend_input, array('radio', 'checkbox'))) {
                         unset($possible_values[$attribute_code][0]);
                         $value = array($value);
                     }
                     $input_def['id'] = 'wpshop_variation_attr_' . $attribute_code;
                     $input_def['name'] = $attribute_code;
                     $real_possible_values = array();
                     if (!empty($possible_values[$attribute_code])) {
                         ksort($possible_values[$attribute_code]);
                         foreach ($possible_values[$attribute_code] as $position => $def) {
                             foreach ($def as $attribute_value => $attribute_value_output) {
                                 $real_possible_values[$attribute_value] = $attribute_value_output;
                             }
                         }
                     }
                     $input_def['possible_value'] = $real_possible_values;
                     $input_def['valueToPut'] = 'index';
                     $input_def['value'] = $value;
                     $input_def['options']['more_input'] = '';
                     if (!empty($possible_values_for_selection_calculation[$attribute_code])) {
                         foreach ($possible_values_for_selection_calculation[$attribute_code] as $value_id => $value) {
                             $input_def['options']['more_input'] .= '<input type="hidden" disabled="disabled" value="' . str_replace("\\", "", $value) . '" name="' . $input_def['id'] . '_current_value" id="' . $input_def['id'] . '_current_value_' . $value_id . '" />';
                         }
                     }
                     $input_def['options_label']['original'] = true;
                     $input_def['option'] = ' class="wpshop_variation_selector_input' . ($is_required ? ' attribute_is_required_input attribute_is_required_input_' . $attribute_code . ' ' : '') . ($attribute_db_definition->_display_informations_about_value == 'yes' ? ' wpshop_display_information_about_value' : '') . ' ' . (is_admin() ? $attribute_db_definition->backend_css_class : $attribute_db_definition->frontend_css_class) . '" ';
                     if (!empty($real_possible_values)) {
                         $tpl_component = array();
                         $attribute_output_def['value'] = isset($head_wpshop_variation_definition['options']['attributes_default_value'][$attribute_code]) ? $head_wpshop_variation_definition['options']['attributes_default_value'][$attribute_code] : $input_def['value'];
                         $tpl_component['VARIATION_INPUT'] = wpshop_form::check_input_type($input_def, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) . $input_def['options']['more_input'];
                         $tpl_component['VARIATION_LABEL'] = $is_required ? '<span class="attribute_is_required attribute_is_required_' . $attribute_code . '" >' . stripslashes($attribute_db_definition->frontend_label) . '</span> <span class="required" >*</span>' : stripslashes($attribute_db_definition->frontend_label);
                         $tpl_component['VARIATION_CODE'] = $attribute_code;
                         $tpl_component['VARIATION_LABEL_HELPER'] = !empty($attribute_db_definition->frontend_help_message) ? ' title="' . $attribute_db_definition->frontend_help_message . '" ' : '';
                         $tpl_component['VARIATION_LABEL_CLASS'] = !empty($attribute_db_definition->frontend_help_message) ? ' wpshop_att_variation_helper' : '';
                         $tpl_component['VARIATION_IDENTIFIER'] = $input_def['id'];
                         $tpl_component['VARIATION_PARENT_ID'] = $product_id;
                         $tpl_component['VARIATION_PARENT_TYPE'] = WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT;
                         $tpl_component['VARIATION_CONTAINER_CLASS'] = ($is_required ? ' attribute_is_required_container attribute_is_required_container_' . $attribute_code : '') . ' wpshop_variation_' . $attribute_code . ' wpshop_variation_' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . ' wpshop_variation_' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . '_' . $product_id;
                         $tpl_component['VARIATION_REQUIRED_INDICATION'] = $is_required ? __('Required variation', 'wpshop') : '';
                         $variation_tpl['VARIATION_COMPLETE_OUTPUT_' . strtoupper($attribute_code)] = wpshop_display::display_template_element('product_variation_item', $tpl_component);
                         $variation_attribute_ordered[$output_order[$attribute_code]] = $variation_tpl['VARIATION_COMPLETE_OUTPUT_' . strtoupper($attribute_code)];
                     }
                     $variation_attribute[] = $attribute_code;
                 }
             }
         }
     }
     $variation_tpl['VARIATION_FORM_ELEMENT_ID'] = $product_id;
     wp_reset_query();
     $attribute_defined_to_be_user_defined = wpshop_attributes::get_attribute_user_defined(array('entity_type_id' => self::currentPageCode));
     if (!empty($attribute_defined_to_be_user_defined)) {
         foreach ($attribute_defined_to_be_user_defined as $attribute_not_in_variation_but_user_defined) {
             $is_required = !empty($head_wpshop_variation_definition['options']) && !empty($head_wpshop_variation_definition['options']['required_attributes']) && in_array($attribute_not_in_variation_but_user_defined->code, $head_wpshop_variation_definition['options']['required_attributes']) || $attribute_not_in_variation_but_user_defined->is_required == 'yes' ? true : false;
             $attribute_display_state = wpshop_attributes::check_attribute_display($attribute_not_in_variation_but_user_defined->is_visible_in_front, $wpshop_product_attributes_frontend_display, 'attribute', $attribute_not_in_variation_but_user_defined->code, 'complete_sheet');
             if ($attribute_display_state && array_key_exists($attribute_not_in_variation_but_user_defined->code, $output_order) && !in_array($attribute_not_in_variation_but_user_defined->code, $variation_attribute) && $attribute_not_in_variation_but_user_defined->is_used_for_variation == 'no') {
                 $attribute_output_def = wpshop_attributes::get_attribute_field_definition($attribute_not_in_variation_but_user_defined, is_array($head_wpshop_variation_definition) && isset($head_wpshop_variation_definition['options']['attributes_default_value'][$attribute_not_in_variation_but_user_defined->code]) ? $head_wpshop_variation_definition['options']['attributes_default_value'][$attribute_not_in_variation_but_user_defined->code] : null);
                 $tpl_component = array();
                 $attribute_output_def['option'] = ' class="wpshop_variation_selector_input' . ($is_required ? ' attribute_is_required_input attribute_is_required_input_' . $attribute_not_in_variation_but_user_defined->code : '') . ' ' . str_replace('"', '', str_replace('class="', '', $attribute_output_def['option'])) . ' ' . (is_admin() ? $attribute_not_in_variation_but_user_defined->backend_css_class : $attribute_not_in_variation_but_user_defined->frontend_css_class) . '" ';
                 $tpl_component['VARIATION_INPUT'] = wpshop_form::check_input_type($attribute_output_def, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION . '[free]') . $attribute_output_def['options'];
                 $tpl_component['VARIATION_LABEL'] = $is_required ? '<span class="attribute_is_required attribute_is_required_' . $attribute_not_in_variation_but_user_defined->code . '" >' . stripslashes($attribute_not_in_variation_but_user_defined->frontend_label) . '</span> <span class="required" >*</span>' : stripslashes($attribute_not_in_variation_but_user_defined->frontend_label);
                 $tpl_component['VARIATION_CODE'] = $attribute_not_in_variation_but_user_defined->code;
                 $tpl_component['VARIATION_LABEL_HELPER'] = !empty($attribute_not_in_variation_but_user_defined->frontend_help_message) ? ' title="' . $attribute_not_in_variation_but_user_defined->frontend_help_message . '" ' : '';
                 $tpl_component['VARIATION_LABEL_CLASS'] = !empty($attribute_not_in_variation_but_user_defined->frontend_help_message) ? ' wpshop_att_variation_helper' : '';
                 $tpl_component['VARIATION_REQUIRED_INDICATION'] = $is_required ? __('Required variation', 'wpshop') : '';
                 $tpl_component['VARIATION_IDENTIFIER'] = $attribute_output_def['id'];
                 $tpl_component['VARIATION_PARENT_ID'] = $product_id;
                 $tpl_component['VARIATION_PARENT_TYPE'] = WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT;
                 $tpl_component['VARIATION_CONTAINER_CLASS'] = ($is_required ? ' attribute_is_required_container attribute_is_required_container_' . $attribute_not_in_variation_but_user_defined->code : '') . ' wpshop_variation_' . $attribute_not_in_variation_but_user_defined->code . ' wpshop_variation_' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . ' wpshop_variation_' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . '_' . $product_id;
                 $variation_tpl['VARIATION_COMPLETE_OUTPUT_' . strtoupper($attribute_not_in_variation_but_user_defined->code)] = $attribute_output_def['type'] != 'hidden' ? wpshop_display::display_template_element('product_variation_item', $tpl_component) : wpshop_form::check_input_type($attribute_output_def, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION . '[free]') . $attribute_output_def['options'];
                 $variation_attribute_ordered[$output_order[$attribute_not_in_variation_but_user_defined->code]] = $variation_tpl['VARIATION_COMPLETE_OUTPUT_' . strtoupper($attribute_not_in_variation_but_user_defined->code)];
             }
         }
     }
     $variation_tpl['VARIATION_FORM_VARIATION_LIST'] = '';
     if (!empty($variation_attribute_ordered) && is_array($variation_attribute_ordered)) {
         ksort($variation_attribute_ordered);
         foreach ($variation_attribute_ordered as $attribute_variation_to_output) {
             $variation_tpl['VARIATION_FORM_VARIATION_LIST'] .= $attribute_variation_to_output;
         }
     }
     $variation_tpl['FROM_ADMIN_INDICATOR'] = $variation_tpl['ORDER_ID_INDICATOR'] = '';
     $variation_tpl['PRODUCT_ADDED_TO_CART_QTY'] = !empty($qty) ? $qty : 1;
     if ($from_admin && !empty($order_id)) {
         $variation_tpl['FROM_ADMIN_INDICATOR'] = '<input type="hidden" name="wps_orders_from_admin" value="1" />';
         $variation_tpl['ORDER_ID_INDICATOR'] = '<input type="hidden" name="wps_orders_order_id" value="' . $order_id . '" />';
     }
     $output = !empty($variation_tpl['VARIATION_FORM_VARIATION_LIST']) ? wpshop_display::display_template_element('product_variation_form', $variation_tpl) : '';
     return $output;
 }
Beispiel #6
0
        ?>
</label>
				<div id="<?php 
        echo $signup_field->code;
        ?>
" class="wps-form"><?php 
        echo $attribute_output_def['output'];
        echo $attribute_output_def['options'];
        ?>
</div>
			</div>
		<?php 
        /** Check confirmation field **/
        if ($signup_field->_need_verification == 'yes') {
            $signup_field->code = $signup_field->code . '2';
            $attribute_output_def = wpshop_attributes::get_attribute_field_definition($signup_field, '', array());
            ?>
				<div class="wps-form-group">
					<label for="<?php 
            echo $signup_field->code;
            ?>
"><?php 
            printf(__('Confirm %s', 'wpshop'), stripslashes(strtolower(__($signup_field->frontend_label, 'wpshop'))));
            ?>
 <?php 
            echo !empty($attribute_output_def['required']) && $attribute_output_def['required'] == 'yes' ? '<em>*</em>' : '';
            ?>
</label>
					<div id="<?php 
            echo $signup_field->code;
            ?>