public function enqueue_styles() { global $post; //only enqueue css and js files when necessary if (mspc_enabled($post->ID)) { wp_enqueue_style('semantic-ui', plugins_url('/semantic/css/semantic.min.css', MSPC_PLUGIN_ROOT_PHP), false, '0.19.0'); wp_enqueue_style('mspc', plugins_url('/css/multistep-product-configurator.css', MSPC_PLUGIN_ROOT_PHP), false, Multistep_Product_Configurator::VERSION); } }
public function add_mspc_form() { global $product; if (mspc_enabled($product->id) && $product->has_attributes()) { MSPC_Scripts_Styles::$add_script = true; $module = get_post_meta($product->id, 'mspc_module', true); //tabs, steps, accordion $columns = intval(get_post_meta($product->id, 'mspc_columns', true)); //1-6 $grid_item_layout = get_post_meta($product->id, 'mspc_grid_item_layout', true); //horizontal, vertical $auto_next = get_post_meta($product->id, 'mspc_auto_next', true); //auto-next $auto_next_class = $auto_next == 'yes' ? ' mspc-auto-next' : ''; $step_by_step = get_post_meta($product->id, 'mspc_step_by_step', true); //auto-next $step_by_step_class = $step_by_step == 'yes' ? ' mspc-step-by-step' : ''; $attributes = $product->get_variation_attributes(); $attribute_count = -1; ?> <div class="mspc-wrapper mspc-clearfix mspc-module-<?php echo $module; echo $auto_next_class; echo $step_by_step_class; ?> "> <?php if ($module == 'accordion') { //accordion ?> <div class="mspc-accordion"> <?php foreach ($attributes as $name => $options) { $attribute_count++; ?> <a href="#" class="mspc-menu-item" data-target=".mspc-<?php echo $name; ?> "> <i class="icon add"></i><span><?php echo wc_attribute_label($name); ?> </span> </a> <div class="mspc-content"> <div class="mspc-variations mspc-clearfix ui column grid doubling mspc-<?php echo $name . ' ' . $this->get_column_class($columns); ?> "> <?php echo $this->get_variation_items($name, $options, $grid_item_layout, $columns); ?> </div> </div> <?php } ?> </div> <?php } else { //steps, tabs, vertical steps ?> <div class="mspc-menu ui <?php echo $this->get_menu_class($module, sizeof($attributes)); ?> "> <?php foreach ($attributes as $name => $options) { $attribute_count++; ?> <a class="mspc-menu-item ui <?php echo $this->get_menu_item_class($module); ?> " data-target=".mspc-<?php echo $name; ?> "><?php echo wc_attribute_label($name); ?> </a> <?php } ?> </div><!-- Menu --> <div class="mspc-content ui <?php echo $this->get_content_class($module); ?> "> <?php $attribute_count = -1; foreach ($attributes as $name => $options) { ?> <div class="mspc-variations mspc-clearfix ui column grid doubling mspc-<?php echo $name . ' ' . $this->get_column_class($columns); ?> "> <?php echo $this->get_variation_items($name, $options, $grid_item_layout, $columns); ?> </div> <?php } ?> </div><!-- Content --> <?php } ?> <a href="#" class="mspc-clear-selection"><?php _e('Clear selection', 'woocommerce'); ?> </a> </div><!-- Wrapper ---> <?php } }