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'];
        }
    }
Example #2
0
 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);
 }
Example #3
0
File: base.php Project: RA2WP/RA2WP
/**
 * Modifies product name field placeholder
 *
 * @param str $message
 * @return str
 */
function al_enter_title_here($message)
{
    $screen = get_current_screen();
    if (ic_string_contains($screen->id, 'al_product')) {
        if (is_plural_form_active()) {
            $names = get_catalog_names();
            $message = sprintf(__('Enter %s name here', 'ecommerce-product-catalog'), ic_strtolower($names['singular']));
        } else {
            $message = __('Enter item name here', 'ecommerce-product-catalog');
        }
    }
    return $message;
}
/**
 * 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'] = ucfirst($names['singular']);
        $labels = array('name' => sprintf(__('%s Categories', 'al-ecommerce-product-catalog'), $names['singular']), 'singular_name' => sprintf(__('%s Category', 'al-ecommerce-product-catalog'), $names['singular']), 'search_items' => sprintf(__('Search %s Categories', 'al-ecommerce-product-catalog'), $names['singular']), 'all_items' => sprintf(__('All %s Categories', 'al-ecommerce-product-catalog'), $names['singular']), 'parent_item' => sprintf(__('Parent %s Category', 'al-ecommerce-product-catalog'), $names['singular']), 'parent_item_colon' => sprintf(__('Parent %s Category:', 'al-ecommerce-product-catalog'), $names['singular']), 'edit_item' => sprintf(__('Edit %s Category', 'al-ecommerce-product-catalog'), $names['singular']), 'update_item' => sprintf(__('Update %s Category', 'al-ecommerce-product-catalog'), $names['singular']), 'add_new_item' => sprintf(__('Add New %s Category', 'al-ecommerce-product-catalog'), $names['singular']), 'new_item_name' => sprintf(__('New %s Category', 'al-ecommerce-product-catalog'), $names['singular']), 'menu_name' => sprintf(__('%s Categories', 'al-ecommerce-product-catalog'), $names['singular']));
    } else {
        $labels = array('name' => __('Categories', 'al-ecommerce-product-catalog'), 'singular_name' => __('Category', 'al-ecommerce-product-catalog'), 'search_items' => __('Search Categories', 'al-ecommerce-product-catalog'), 'all_items' => __('All Categories', 'al-ecommerce-product-catalog'), 'parent_item' => __('Parent Category', 'al-ecommerce-product-catalog'), 'parent_item_colon' => __('Parent Category:', 'al-ecommerce-product-catalog'), 'edit_item' => __('Edit Category', 'al-ecommerce-product-catalog'), 'update_item' => __('Update Category', 'al-ecommerce-product-catalog'), 'add_new_item' => __('Add New Category', 'al-ecommerce-product-catalog'), 'new_item_name' => __('New Category', 'al-ecommerce-product-catalog'), 'menu_name' => __('Categories', 'al-ecommerce-product-catalog'));
    }
    $args = array('public' => $category_enable, 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => apply_filters('product_category_slug_value_register', 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');
}
Example #5
0
    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'];
        }
    }
Example #6
0
 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 modify_add_product_image_label($label)
{
    if (is_plural_form_active()) {
        $names = get_catalog_names();
        $names['singular'] = strtolower($names['singular']);
        $label = str_replace(__('Set featured image'), sprintf(__('Set %s image', 'al-ecommerce-product-catalog'), $names['singular']), $label);
        $label = str_replace(__('Remove featured image'), sprintf(__('Remove %s image', 'al-ecommerce-product-catalog'), $names['singular']), $label);
    } else {
        $label = str_replace(__('Set featured image'), __('Set image', 'al-ecommerce-product-catalog'), $label);
        $label = str_replace(__('Remove featured image'), __('Remove image', 'al-ecommerce-product-catalog'), $label);
    }
    return $label;
}