function widget($args, $instance) { if (get_integration_type() != 'simple') { $instance['title'] = isset($instance['title']) ? $instance['title'] : ''; $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $c = !empty($instance['count']) ? '1' : '0'; $h = !empty($instance['hierarchical']) ? '1' : '0'; $d = !empty($instance['dropdown']) ? '1' : '0'; echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'taxonomy' => 'al_product-cat'); if ($d) { if (is_plural_form_active()) { $names = get_catalog_names(); $label = sprintf(__('Select %s Category', 'ecommerce-product-catalog'), ic_ucfirst($names['singular'])); } else { $label = __('Select Category', 'ecommerce-product-catalog'); } $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'taxonomy' => 'al_product-cat', 'walker' => new my_Walker_CategoryDropdown(), 'show_option_none' => $label); wp_dropdown_categories(apply_filters('widget_product_categories_dropdown_args', $cat_args)); ?> <script type='text/javascript'> /* <![CDATA[ */ var dropdown = document.getElementById( "cat" ); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value != '' ) { location.href = "<?php echo home_url(); ?> /?al_product-cat=" + dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange = onCatChange; /* ]]> */ </script> <?php } else { ?> <ul> <?php $cat_args['title_li'] = ''; $cat_args = apply_filters('widget_product_categories_args', $cat_args, $instance); wp_list_categories($cat_args); ?> </ul> <?php do_action('after_product_category_widget', $cat_args, $instance); } echo $args['after_widget']; } }
function __construct() { if (is_plural_form_active()) { $names = get_catalog_names(); $label = sprintf(__('Related %s', 'ecommerce-product-catalog'), ic_ucfirst($names['plural'])); $sublabel = sprintf(__('Shows related %s.', 'ecommerce-product-catalog'), ic_lcfirst($names['plural'])); } else { $label = __('Related Catalog Items', 'ecommerce-product-catalog'); $sublabel = __('Shows related catalog items.', 'ecommerce-product-catalog'); } $widget_ops = array('classname' => 'related_products_widget', 'description' => $sublabel); parent::__construct('related_products_widget', $label, $widget_ops); }
/** * Registers product categories * */ function create_product_categories() { $archive_multiple_settings = get_multiple_settings(); $category_enable = true; if (get_integration_type() == 'simple') { $category_enable = false; } if (is_plural_form_active()) { $names = get_catalog_names(); $names['singular'] = ic_ucfirst($names['singular']); $labels = array('name' => sprintf(__('%s Categories', 'ecommerce-product-catalog'), $names['singular']), 'singular_name' => sprintf(__('%s Category', 'ecommerce-product-catalog'), $names['singular']), 'search_items' => sprintf(__('Search %s Categories', 'ecommerce-product-catalog'), $names['singular']), 'all_items' => sprintf(__('All %s Categories', 'ecommerce-product-catalog'), $names['singular']), 'parent_item' => sprintf(__('Parent %s Category', 'ecommerce-product-catalog'), $names['singular']), 'parent_item_colon' => sprintf(__('Parent %s Category:', 'ecommerce-product-catalog'), $names['singular']), 'edit_item' => sprintf(__('Edit %s Category', 'ecommerce-product-catalog'), $names['singular']), 'update_item' => sprintf(__('Update %s Category', 'ecommerce-product-catalog'), $names['singular']), 'add_new_item' => sprintf(__('Add New %s Category', 'ecommerce-product-catalog'), $names['singular']), 'new_item_name' => sprintf(__('New %s Category', 'ecommerce-product-catalog'), $names['singular']), 'menu_name' => sprintf(__('%s Categories', 'ecommerce-product-catalog'), $names['singular'])); } else { $labels = array('name' => __('Categories', 'ecommerce-product-catalog'), 'singular_name' => __('Category', 'ecommerce-product-catalog'), 'search_items' => __('Search Categories', 'ecommerce-product-catalog'), 'all_items' => __('All Categories', 'ecommerce-product-catalog'), 'parent_item' => __('Parent Category', 'ecommerce-product-catalog'), 'parent_item_colon' => __('Parent Category:', 'ecommerce-product-catalog'), 'edit_item' => __('Edit Category', 'ecommerce-product-catalog'), 'update_item' => __('Update Category', 'ecommerce-product-catalog'), 'add_new_item' => __('Add New Category', 'ecommerce-product-catalog'), 'new_item_name' => __('New Category', 'ecommerce-product-catalog'), 'menu_name' => __('Categories', 'ecommerce-product-catalog')); } $args = array('public' => $category_enable, 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('hierarchical' => true, 'slug' => apply_filters('product_category_slug_value_register', urldecode(sanitize_title($archive_multiple_settings['category_archive_url']))), 'with_front' => false), 'capabilities' => array('manage_terms' => 'manage_product_categories', 'edit_terms' => 'edit_product_categories', 'delete_terms' => 'delete_product_categories', 'assign_terms' => 'assign_product_categories')); register_taxonomy('al_product-cat', 'al_product', $args); register_taxonomy_for_object_type('al_product-cat', 'al_product'); }
function widget($args, $instance) { if (get_integration_type() != 'simple') { if (is_plural_form_active()) { $names = get_catalog_names(); $label = sprintf(__('%s Search', 'ecommerce-product-catalog'), ic_ucfirst($names['singular'])); } else { $label = __('Product Search', 'ecommerce-product-catalog'); } $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } // Use current theme search form if it exists $search_button_text = apply_filters('product_search_button_text', ''); echo '<form role="search" class="' . design_schemes('box', 0) . '" method="get" id="product_search_form" action="' . esc_url(home_url('/')) . '"> <input type="hidden" name="post_type" value="' . get_current_screen_post_type() . '" /> <input class="product-search-box" type="search" value="' . get_search_query() . '" id="s" name="s" placeholder="' . $label . '" /> <input class="product-search-submit" type="submit" id="searchsubmit" value="' . $search_button_text . '" /> </form>'; echo $args['after_widget']; } }
function __construct() { if (is_plural_form_active()) { $names = get_catalog_names(); $label = sprintf(__('%s Price Filter', 'ecommerce-product-catalog'), ic_ucfirst($names['singular'])); $sublabel = sprintf(__('Filter %s by price.', 'ecommerce-product-catalog'), ic_lcfirst($names['plural'])); } else { $label = __('Catalog Price Filter', 'ecommerce-product-catalog'); $sublabel = __('Filter items by price.', 'ecommerce-product-catalog'); } $widget_ops = array('classname' => 'product_price_filter', 'description' => $sublabel); parent::__construct('product_price_filter', $label, $widget_ops); }
function change_image_box() { $names = get_catalog_names(); remove_meta_box('postimagediv', 'al_product', 'side'); if (is_plural_form_active()) { $label = sprintf(__('%s Image', 'ecommerce-product-catalog'), ic_ucfirst($names['singular'])); } else { $label = sprintf(__('Image', 'ecommerce-product-catalog'), ic_ucfirst($names['singular'])); } add_meta_box('postimagediv', $label, 'post_thumbnail_meta_box', 'al_product', apply_filters('product_image_box_column', 'side'), apply_filters('product_image_box_priority', 'high')); }
function doc_helper($title, $url, $class = null) { $helper = '<div class="doc-helper ' . $class . '"><div class="doc-item"> <div class="doc-name green-box">' . sprintf(__('%s Settings in Docs', 'ecommerce-product-catalog'), ic_ucfirst($title)) . '</div> <div class="doc-description">' . sprintf(__('See %s configuration tips in the impleCode documentation', 'ecommerce-product-catalog'), $title) . '.</div> <div class="doc-button"><a href="https://implecode.com/docs/ecommerce-product-catalog/' . $url . '/?cam=catalog-docs-box&key=' . $url . '"><input class="doc_button classic-button" type="button" value="' . __('See in Docs', 'ecommerce-product-catalog') . '"></a></div> <a title="' . __('Click the button to visit impleCode documentation', 'ecommerce-product-catalog') . '" href="https://implecode.com/docs/ecommerce-product-catalog/' . $url . '/?cam=catalog-docs-box&key=' . $url . '" class="background-url"></a> </div></div>'; echo $helper; }