public function enqueue_styles() { global $post; if (wpc_enabled($post->ID)) { // wp_enqueue_style('wpc_style_grids', WPC_PLUGIN_ABSOLUTE_PATH . 'css/grid12.css', false); // wp_enqueue_style('wpc_style_tabs', WPC_PLUGIN_ABSOLUTE_PATH . 'css/responsive-tabs.css', false); // wp_enqueue_style('wpc_magnific_popup_style', WPC_PLUGIN_ABSOLUTE_PATH . 'css/magnific-popup.css', false); // wp_enqueue_style('wpc_cloud_zoom_style', WPC_PLUGIN_ABSOLUTE_PATH . 'cloud-zoom/cloudzoom.css', false); // wp_enqueue_style('wpc_style_frontend', WPC_PLUGIN_ABSOLUTE_PATH . 'css/wpc_style_frontend.css', false); wp_enqueue_style('wpc_style_frontend', WPC_PLUGIN_ABSOLUTE_PATH . 'assets/css/wpc_frontend_style.min.css', false); } }
public function add_product_designer() { global $post, $wpdb, $product, $woocommerce; if (wpc_enabled($product->id) && $product->has_attributes()) { WPC_Scripts_Styles::$add_script = true; $attributes = $attributes = maybe_unserialize(get_post_meta($post->ID, '_product_attributes', true)); $color_config = get_post_meta($post->ID, '_wpc_color_config', true); $instruction = get_post_meta($post->ID, '_wpc_instructions', true); $variations = $product->get_variation_attributes(); ?> <div class="row" id="wpc_main_container"> <div class="col-sm-6" id="cnvs"> <div id="wpc_product_stage"> <canvas></canvas> </div> <p class="wpc_instructions"><i class="fa fa-info-circle"></i> <?php echo nl2br(@$instruction['wpc_general']); ?> </p> </div> <div class="col-sm-6" id="attribute-tabs"> <input type="hidden" name="wpc_extra_item[wpc_product_image_data]" class="wpc_extra_item" id="wpc_product_image_data"/> <script type="application/javascript"> var defaultValues=[]; var cords=[]; var actualCords=[]; </script> <ul id="wpc_nav_buttons"> <?php if (isset($attributes) && !empty($attributes)) { foreach ($attributes as $name => $options) { ?> <li><a data-attribute="<?php echo $name; ?> " href="#wpc_<?php echo $name; ?> "><?php echo wc_attribute_label($name); ?> </a></li> <?php } } ?> <li><a href="#wpc_finish_product_builder"><?php echo __('Finish', 'wpc'); ?> </a></li> </ul> <?php if (isset($attributes) && !empty($attributes)) { foreach ($attributes as $name => $options) { $default_value = $product->get_variation_default_attribute($name); ?> <script type="application/javascript"> defaultValues.push({attribute:'<?php echo $name; ?> ',term:'<?php echo $default_value; ?> '}); </script> <input type="hidden" name="wpc_extra_item[<?php echo $name; ?> ]" id="wpc_extra_item_<?php echo $name; ?> " class="wpc_extra_item"/> <input type="hidden" name="wpc_original_item[<?php echo $name; ?> ]" id="wpc_original_item_<?php echo $name; ?> " class="wpc_original_item"/> <div id="wpc_<?php echo $name; ?> " class="wpc-tb-all" data-attribute="<?php echo $name; ?> "> <a id="wpc_up_<?php echo $name; ?> " data-scroll="wpc_down_<?php echo $name; ?> " href="#" class="wpc_scroll_down wpc-scroll"> <i class="fa fa-arrow-circle-down"></i> </a> <div class="seclect"> <h3><?php echo wc_attribute_label($name); ?> </h3> <p class="wpc_instructions"><i class="fa fa-info-circle"></i> <?php echo nl2br(@$instruction[$name]); ?> </p> <?php echo $this->get_variation_items($name, $options, $color_config, $product->id, $default_value); ?> </div> <a id="wpc_down_<?php echo $name; ?> " data-scroll="wpc_up_<?php echo $name; ?> " href="#" class="wpc_scroll_up wpc-scroll"> <i class="fa fa-arrow-circle-up"></i> </a> </div> <?php } } ?> <div id="wpc_finish_product_builder"> <p class="wpc_instructions"><i class="fa fa-info-circle"></i> <?php echo nl2br(@$instruction['wpc_finish']); ?> </p> <?php $selected_design = get_post_meta($post->ID, "_wpc_selected_base", true); if (!empty($selected_design)) { ?> <select id="wpc_base_design_options"> <option value="" selected>--<?php echo __('Choose Design', 'wpc'); ?> --</option> <?php $args = array('post_type' => 'wpc_base_design', 'tax_query' => array(array('taxonomy' => 'wpc_design_category', 'field' => 'term_id', 'terms' => $selected_design)), 'orderby' => 'title'); $all_posts = get_posts($args); if (!empty($all_posts)) { foreach ($all_posts as $basedesign) { ?> <option value="<?php echo $basedesign->ID; ?> "><?php echo $basedesign->post_title; ?> </option> <?php } } ?> </select> <?php } ?> <div id="wpc_final_design"> <canvas></canvas> </div> <?php $additional_comment = get_post_meta($post->ID, "_wpc_additional_comment", true); if (!empty($additional_comment)) { ?> <div class="row" style="margin-top: 10px"> <div class="col-sm-4"> <label><?php echo __("Additional Instructions", "wpc"); ?> </label></div> <div class="col-sm-8"> <textarea id="wpc_additional_comment_text" rows="8" style="width: 100%" ></textarea> </div> </div> <?php } ?> <button class="wpc_finish_product"><?php _e('Finish Builder', 'wpc'); ?> </button> <button class="wpc_finish_reset"><?php _e('Reset All', 'wpc'); ?> </button> <div class="single_variation_wrap"> <div class="variations_button"> <div class="quantity"><input type="number" size="4" class="input-text qty text" id="wpc_fake_qty" title="Qty" value="1" step="1" min="1"></div> <button class="single_add_to_cart_button fusion-button button-default button-small alt" id="wpc_fake_add-to_cart" type="button"><?php echo __('Add to Cart', 'wpc'); ?> </button> </div> </div> <input type="hidden" name="wpc_extra_item[wpc_product_emb_type]" class="wpc_extra_item wpc_hidden_emb" id="wpc_product_emb_type" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_image]" class="wpc_extra_item wpc_hidden_emb wpc_emb_cart_image" id="wpc_product_emb_image" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_text]" class="wpc_extra_item wpc_hidden_emb wpc_emb_cart_text" id="wpc_product_emb_text" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_font]" class="wpc_extra_item wpc_hidden_emb wpc_emb_cart_text" id="wpc_product_emb_font" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_font_size]" class="wpc_extra_item wpc_hidden_emb wpc_emb_cart_text" id="wpc_product_emb_fontsize" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_font_weight]" class="wpc_extra_item wpc_hidden_emb wpc_emb_cart_text" id="wpc_product_emb_fontweight" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_font_style]" class="wpc_extra_item wpc_hidden_emb wpc_emb_cart_text" id="wpc_product_emb_fontstyle" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_color]" class="wpc_extra_item wpc_hidden_emb wpc_emb_cart_text" id="wpc_product_emb_fontcolor" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_position]" class="wpc_extra_item wpc_hidden_emb" id="wpc_product_emb_position" /> <input type="hidden" name="wpc_extra_item[wpc_product_emb_angle]" class="wpc_extra_item wpc_hidden_emb" id="wpc_product_emb_angle" /> <input type="hidden" name="wpc_extra_item[wpc_product_extra_comment]" class="wpc_extra_item wpc_hidden_emb" id="wpc_product_emb_extra_comment" /> <input type="hidden" name="wpc_extra_item[wpc_product_additional_comment]" class="wpc_extra_item" id="wpc_product_additional_comment" /> </div> </div> <div class="col-sm-6 plright"> <div id="tbstl" class="row"> <div class="col-sm-6"> <h4><?php echo __('Chosen Options', 'wpc'); ?> </h4> <table id="wpc_original_options" class="wpc_options_display"> <?php foreach ($attributes as $name => $options) { ?> <tr class="wpc_hidden"> <th id="wpc_attributes_names_<?php echo $name; ?> "><?php echo wc_attribute_label($name); ?> </th> <td id="wpc_attributes_values_<?php echo $name; ?> "></td> <?php } ?> </tr> </table> </div> <div class="col-sm-6"> <h4><?php echo __('Chosen Colors', 'wpc'); ?> </h4> <table id="wpc_custom_options" class="wpc_options_display"> <?php foreach ($attributes as $name => $options) { ?> <tr class="wpc_hidden"> <th id="wpc1_attributes_names_<?php echo $name; ?> "><?php echo wc_attribute_label($name); ?> </th> <td id="wpc1_attributes_values_<?php echo $name; ?> "></td> </tr> <?php } ?> </table> </div> <?php $emb_layer = get_post_meta($post->ID, '_wpc_emb_layer', true); if (!empty($emb_layer)) { ?> <div class="col-sm-6"> <h4><?php echo __('Embroidery', 'wpc'); ?> </h4> <table class="wpc_options_display"> <tr class="wpc_hidden"> <th><?php echo __('Type', 'wpc'); ?> </th> <td class="wpc_emb_options" id="wpc_emb_options_type"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Image', 'wpc'); ?> </th> <td class="wpc_emb_options emb_options_for_image" id="wpc_emb_options_image"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Text', 'wpc'); ?> </th> <td class="wpc_emb_options emb_options_for_text" id="wpc_emb_options_text"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Font', 'wpc'); ?> </th> <td class="wpc_emb_options emb_options_for_text" id="wpc_emb_options_font"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Font Size', 'wpc'); ?> </th> <td class="wpc_emb_options emb_options_for_text" id="wpc_emb_options_fontsize"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Font Weight', 'wpc'); ?> </th> <td class="wpc_emb_options emb_options_for_text" id="wpc_emb_options_fontweight"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Font Style', 'wpc'); ?> </th> <td class="wpc_emb_options emb_options_for_text" id="wpc_emb_options_fontstyle"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Color', 'wpc'); ?> </th> <td class="wpc_emb_options emb_options_for_text" id="wpc_emb_options_fontcolor"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Rotation', 'wpc'); ?> </th> <td class="wpc_emb_options" id="wpc_emb_options_angle"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Position', 'wpc'); ?> </th> <td class="wpc_emb_options" id="wpc_emb_options_position"></td> </tr> <tr class="wpc_hidden"> <th><?php echo __('Additional Comment', 'wpc'); ?> </th> <td class="wpc_emb_options" id="wpc_emb_options_extra_comment"></td> </tr> </table> </div> <?php } ?> </div> </div> </div> <script type="text/javascript"> var defaultModel=<?php echo self::$default_model; ?> , productId=<?php echo $product->id; ?> , initialModel=<?php echo self::$default_model; ?> ; </script> <?php $base_layer = get_post_meta($product->id, "_wpc_base_color_dependency", true); $avilable_models = get_post_meta($product->id, "_wpc_available_models", true); ?> <?php if (!empty($avilable_models)) { foreach ($avilable_models as $k => $model) { ?> <div id="wpc_base_images_<?php echo $model; ?> " class="wpc_hidden" data-attribute="<?php echo $base_layer; ?> "> <?php $base_image = get_post_meta($product->id, '_wpc_base_image_base_' . $model, true); $texture_image = get_post_meta($product->id, '_wpc_base_image_texture_' . $model, true); ?> <img src="<?php echo $base_image; ?> " class="base_image"> <img src="<?php echo $texture_image; ?> " class="texture_image"> </div> <?php } } ?> <?php } }