public function add_product_designer() { global $post, $wpdb, $product, $woocommerce; //$attributes = $product->get_variation_attributes(); $attributes = maybe_unserialize(get_post_meta($post->ID, '_product_attributes', true)); $allExtras = get_post_meta($post->ID, '_wpb_extras', true); $allSize = get_post_meta($post->ID, '_wpb_dimensions', true); $notAvilables = WPB_Common_Functions::notAvailableAttributes($post->ID); $reorderSizes = WPB_Common_Functions::reorderSize($post->ID); $variations = $product->get_variation_attributes(); ?> <div id="wc-product-builder"> <div id="wpb_steps" class="f-step"> <ul class="progress-indicator" id="progress-indicator"> <?php if (!empty($attributes)) { $c = 0; foreach ($attributes as $name => $options) { if (!in_array($name, $notAvilables)) { $attribute_type = WPB_Common_Functions::get_variation_attribute_type($name); $classes = $c == 0 ? "completed acctive" : ""; ?> <li data-tab="#wpb-steps-<?php echo $name; ?> " data-taxonomy="<?php echo $name; ?> " data-counting="<?php echo $c; ?> " data-type="<?php echo $attribute_type; ?> " class="<?php echo $classes; ?> "> <a href="#"> <p><?php echo wc_attribute_label($name); ?> </p> <span class="bubble"><span class="bbll"></span></span> </a> </li> <?php $c++; } } } ?> </ul> </div> <div id="wpb_step_tab"> <?php if (!empty($attributes)) { $c = 0; foreach ($attributes as $name => $options) { // print_r($options); if (!in_array($name, $notAvilables)) { $classes = $c == 0 ? 'wpb_onedblk' : 'wpb_aldnn'; ?> <div id="wpb-steps-<?php echo $name; ?> " class="wpb_tabs <?php echo $classes; ?> "> <?php $all_terms = wc_get_product_terms($post->ID, $name, array('fields' => 'all')); $attribute_type = WPB_Common_Functions::get_variation_attribute_type($name); $default_value = $product->get_variation_default_attribute($name); $checkOptions = $variations[$name] ? $variations[$name] : array(); ?> <?php if ($attribute_type == "carousel") { ?> <?php echo self::makeCarousel($all_terms, $name, $checkOptions, $post->ID, $attribute_type, $default_value); ?> <?php } ?> <?php if ($attribute_type == "extra") { ?> <?php if ($options["is_variation"] == 1) { echo self::makeCarousel($all_terms, $name, $checkOptions, $post->ID, $attribute_type, $default_value); ?> <?php } ?> <?php $extraCarousel = $allExtras[$name] ? $allExtras[$name] : array(); ?> <?php if ($extraCarousel) { foreach ($extraCarousel as $carousel) { $allTerms = wc_get_product_terms($post->ID, $carousel, array('fields' => 'all')); $carouselOptions = $variations[$carousel] ? $variations[$carousel] : array(); $carousel_default_value = $product->get_variation_default_attribute($carousel); ?> <?php echo self::makeCarousel($allTerms, $carousel, $carouselOptions, $post->ID, 'carousel', $carousel_default_value, true); ?> <?php } } ?> <?php } ?> <?php if ($attribute_type == "dimension") { ?> <?php $attributeDimensions = $reorderSizes[$name]; if ($attributeDimensions) { foreach ($attributeDimensions as $dimension) { $regulator = $dimension[0]; $selectBox = $dimension[1]; $regulatorTerms = wc_get_product_terms($post->ID, $regulator, array('fields' => 'all')); $regulatorVariations = $variations[$regulator] ? $variations[$regulator] : array(); $regulatorDefault = $product->get_variation_default_attribute($regulator); $selectBoxTerms = wc_get_product_terms($post->ID, $selectBox, array('fields' => 'all')); $selectBoxVariations = $variations[$selectBox] ? $variations[$selectBox] : array(); $selectBoxDefault = $product->get_variation_default_attribute($selectBox); if (isset($_REQUEST['attribute_' . sanitize_title($regulator)])) { $regulatorDefault = wc_clean($_REQUEST['attribute_' . sanitize_title($regulator)]); } if (isset($_REQUEST['attribute_' . sanitize_title($selectBox)])) { $selectBoxDefault = wc_clean($_REQUEST['attribute_' . sanitize_title($selectBox)]); } self::$defaultSelections[$regulator] = $regulatorDefault; self::$defaultSelections[$selectBox] = $selectBoxDefault; ?> <div class="row"> <div class="col-sm-7"> <div class="rng-sl-sec"> <div class="rngsec"> <h2><?php echo wc_attribute_label($regulator); ?> </h2> <div id="wpb_slider_<?php echo $regulator; ?> "></div> <span id="wpb_regulator_min_<?php echo $regulator; ?> "></span> <span id="wpb_regulator_max_<?php echo $regulator; ?> " class="alr"></span> </div> </div> </div> <div class="col-sm-5"> <div class="r-inp-sec clearfix"> <select class="wpb-rngslct wbp_slider" id="wpb_rangeselect_<?php echo $regulator; ?> " data-taxonomy="<?php echo $regulator; ?> "> <?php if ($regulatorTerms) { foreach ($regulatorTerms as $r) { ?> <?php if (has_term(absint($r->term_id), $regulator, $post->ID)) { if (in_array($r->slug, $regulatorVariations)) { $selected = $regulatorDefault == $r->slug ? "selected" : ""; ?> <option <?php echo $selected; ?> value="<?php echo $r->slug; ?> "><?php echo $r->name; ?> </option> <?php } } ?> <?php } } ?> </select> <div class="rthtx"> <h2><?php echo wc_attribute_label($selectBox); ?> : </h2> <select class="wpb-rngtxt wpb-rngslct" data-taxonomy="<?php echo $selectBox; ?> " id="wpb_select_<?php echo $selectBox; ?> "> <?php if ($selectBoxTerms) { foreach ($selectBoxTerms as $s) { ?> <?php if (has_term(absint($s->term_id), $selectBox, $post->ID)) { if (in_array($s->slug, $selectBoxVariations)) { $selected = $selectBoxDefault == $s->slug ? "selected" : ""; ?> <option <?php echo $selected; ?> value="<?php echo $s->slug; ?> "><?php echo $s->name; ?> </option> <?php } } ?> <?php } } ?> </select> </div> </div> </div> </div> <?php } ?> <?php } ?> <?php } ?> </div> <?php $c++; } } } ?> </div> </div> <script type="text/javascript"> var wpb_default_selections=<?php echo json_encode(self::$defaultSelections); ?> </script> <?php }