function is_ic_sku_enabled() { $archive_multiple_settings = get_multiple_settings(); if ($archive_multiple_settings['disable_sku'] != 1) { return true; } return false; }
function create_product_categories() { $archive_multiple_settings = get_multiple_settings(); $category_enable = true; if (get_integration_type() == 'simple') { $category_enable = false; } $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'])); $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'); // flush_rewrite_rules(false); // check_permalink_options_update(); }
function enable_simple_mode() { $archive_multiple_settings = get_multiple_settings(); $archive_multiple_settings['integration_type'] = 'simple'; update_option('archive_multiple_settings', $archive_multiple_settings); update_option('product_adder_theme_support_check', ''); }
function show_parent_product_categories($echo = 1, $return = '') { $multiple_settings = get_multiple_settings(); $taxonomy_name = apply_filters('current_product_catalog_taxonomy', 'al_product-cat'); $archive_template = get_product_listing_template(); if ($multiple_settings['product_listing_cats'] == 'on') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none=No_cat&echo=0&title_li=&taxonomy=' . $taxonomy_name . '&parent=0'); if (!strpos($product_subcategories, 'No_cat')) { $return = '<div class="product-subcategories">' . $product_subcategories . '</div>'; } } else { $show_categories = do_shortcode('[show_categories parent="0"]'); if (!empty($show_categories)) { $return = '<div class="product-subcategories ' . $archive_template . '">' . $show_categories; if ($archive_template != 'list') { $return .= '<hr>'; } $return .= '</div>'; } } } return echo_ic_setting($return, $echo); }
function get_integration_type() { $settings = get_multiple_settings(); return $settings['integration_type']; }
/** * Checks if theme default sidebar catalog styled should be enabled on product pages * * @return boolean */ function is_ic_default_theme_sided_sidebar_active() { $settings = get_multiple_settings(); if (isset($settings['default_sidebar']) && ($settings['default_sidebar'] == 'left' || $settings['default_sidebar'] == 'right')) { return true; } return false; }
/** * Shows categories on product listing for custom templates usage * * @return string */ function ic_product_listing_categories_shortcode() { ob_start(); $multiple_settings = get_multiple_settings(); $archive_template = get_product_listing_template(); ic_product_listing_categories($archive_template, $multiple_settings); return ob_get_clean(); }
/** * Shows sorting drop down * * @global string $product_sort * @param string $archive_template * @param array $multiple_settings */ function show_product_order_dropdown($archive_template = null, $multiple_settings = null, $instance = null) { $multiple_settings = empty($multiple_settings) ? get_multiple_settings() : $multiple_settings; $sort_options = get_product_sort_options(); $selected = isset($_GET['product_order']) ? esc_attr($_GET['product_order']) : $multiple_settings['product_order']; $action = get_filter_widget_action($instance); echo '<form class="product_order" action="' . $action . '"><select class="product_order_selector" name="product_order">'; foreach ($sort_options as $name => $value) { $option = '<option value="' . $name . '" ' . selected($name, $selected, 0) . '>' . $value . '</option>'; echo apply_filters('product_order_dropdown_options', $option, $name, $value, $multiple_settings, $selected); } echo '</select>'; foreach ($_GET as $key => $get_value) { if ($key != 'product_order') { echo '<input type="hidden" value="' . esc_attr($get_value) . '" name="' . esc_attr($key) . '" />'; } } echo '</form>'; }
function ecommerce_product_catalog_upgrade() { if (is_admin()) { $plugin_data = get_plugin_data(AL_PLUGIN_MAIN_FILE); $plugin_version = $plugin_data["Version"]; $database_plugin_version = get_option('ecommerce_product_catalog_ver', $plugin_version); if ($database_plugin_version != $plugin_version) { update_option('ecommerce_product_catalog_ver', $plugin_version); $first_version = (string) get_option('first_activation_version', $plugin_version); if (version_compare($first_version, '1.9.0') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) { $hide_info = 0; enable_advanced_mode($hide_info); } if (version_compare($first_version, '2.0.0') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) { $archive_multiple_settings = get_multiple_settings(); $archive_multiple_settings['product_listing_cats'] = 'off'; $archive_multiple_settings['cat_template'] = 'link'; update_option('archive_multiple_settings', $archive_multiple_settings); } if (version_compare($first_version, '2.0.1') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) { add_product_caps(); } if (version_compare($first_version, '2.0.4') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) { delete_transient('implecode_extensions_data'); } if (version_compare($first_version, '2.2.5') < 0 && version_compare($database_plugin_version, '2.2.5') < 0) { $archive_names = get_option('archive_names'); $archive_names['all_main_categories'] = ''; $archive_names['all_products'] = ''; $archive_names['all_subcategories'] = ''; update_option('archive_names', $archive_names); } if (version_compare($first_version, '2.3.6') < 0 && version_compare($database_plugin_version, '2.3.6') < 0) { $archive_multiple_settings = get_multiple_settings(); $archive_multiple_settings['default_sidebar'] = 1; update_option('archive_multiple_settings', $archive_multiple_settings); } if (version_compare($first_version, '2.4.0') < 0 && version_compare($database_plugin_version, '2.4.0') < 0) { $archive_multiple_settings = get_multiple_settings(); $archive_multiple_settings['related'] = 'categories'; update_option('archive_multiple_settings', $archive_multiple_settings); update_option('old_sort_bar', 1); } flush_rewrite_rules(); } } }
<?php if (!defined('ABSPATH')) { exit; // Exit if accessed directly } /** * The template for displaying products archive content. * * @version 1.1.3 * @package ecommerce-product-catalog/templates * @author Norbert Dreszer */ global $post; $default_archive_names = default_archive_names(); $multiple_settings = get_multiple_settings(); $archive_names = get_archive_names(); do_action('product_listing_begin', $multiple_settings); $listing_class = apply_filters('product_listing_classes', 'al_product responsive type-page'); ?> <article id="product_listing" <?php post_class($listing_class); ?> > <?php do_action('before_product_listing_entry', $post, $archive_names); ?> <div class="entry-content"> <?php $archive_template = get_product_listing_template(); do_action('product_listing_entry_inside', $archive_template, $multiple_settings);
/** * Shows categories on product listing for custom templates usage * * @return string */ function ic_product_listing_categories() { ob_start(); $multiple_settings = get_multiple_settings(); $archive_template = get_product_listing_template(); $taxonomy_name = apply_filters('current_product_catalog_taxonomy', 'al_product-cat'); if (!is_tax() && !is_search()) { $before_archive = content_product_adder_archive_before(); if ($before_archive != '<div class="entry-summary"></div>') { echo $before_archive; } if ($multiple_settings['product_listing_cats'] == 'on' || $multiple_settings['product_listing_cats'] == 'cats_only') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none = No_cat&echo = 0&title_li = &taxonomy = ' . $taxonomy_name . '&parent = 0'); if (!strpos($product_subcategories, 'No_cat')) { do_action('before_product_listing_category_list'); echo '<div class = "product-subcategories">' . $product_subcategories . '</div>'; } } else { $show_categories = do_shortcode('[show_categories parent = "0" shortcode_query = "no"]'); if (!empty($show_categories)) { do_action('before_product_listing_category_list'); echo $show_categories; if ($archive_template != 'list' && !is_ic_only_main_cats()) { echo '<hr>'; } } } } } else { if (is_tax()) { $term = get_queried_object()->term_id; if (is_ic_category_image_enabled()) { $term_img = get_product_category_image_id($term); echo wp_get_attachment_image($term_img, apply_filters('product_cat_image_size', 'large'), false, array('class' => 'product-category-image')); } $term_description = term_description(); if (!empty($term_description)) { echo '<div class = "taxonomy-description">' . $term_description . '</div>'; } if ($multiple_settings['category_top_cats'] == 'on' || $multiple_settings['category_top_cats'] == 'only_subcategories') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none = No_cat&echo = 0&title_li = &taxonomy = ' . $taxonomy_name . '&child_of = ' . $term); if (!strpos($product_subcategories, 'No_cat')) { ?> <div class="product-subcategories"> <?php do_action('before_category_subcategories'); echo $product_subcategories; ?> </div> <?php } } else { $show_categories = do_shortcode('[show_categories parent = ' . get_queried_object_id() . ' shortcode_query = no]'); if (!empty($show_categories)) { do_action('before_category_subcategories'); echo $show_categories; if ($archive_template != 'list' && !is_ic_only_main_cats()) { echo '<hr>'; } } } } } } return ob_get_clean(); }
function show_product_order_dropdown($archive_template, $multiple_settings = null) { $multiple_settings = empty($multiple_settings) ? get_multiple_settings() : $multiple_settings; global $product_sort; if (isset($product_sort) && $product_sort == 1 || !isset($product_sort)) { $sort_options = get_product_sort_options(); $selected = isset($_GET['product_order']) ? $_GET['product_order'] : $multiple_settings['product_order']; echo '<form id="product_order"><select id="product_order_selector" name="product_order">'; foreach ($sort_options as $name => $value) { $option = '<option value="' . $name . '" ' . selected($name, $selected, 0) . '>' . $value . '</option>'; echo apply_filters('product_order_dropdown_options', $option, $name, $value, $multiple_settings, $selected); } echo '</select>'; foreach ($_GET as $key => $get_value) { if ($key != 'product_order') { echo '<input type="hidden" value="' . $get_value . '" name="' . $key . '" />'; } } echo '</form>'; echo '<script>jQuery("#product_order_selector").change(function() { jQuery("#product_order").submit(); });</script>'; } }
/** * Checks if category image is enabled on category page * @return boolean */ function is_ic_category_image_enabled() { $multiple_settings = get_multiple_settings(); if ($multiple_settings['cat_image_disabled'] != 1) { return true; } return false; }
function get_product_slug() { $page_id = get_product_listing_id(); $slug = urldecode(untrailingslashit(get_page_uri($page_id))); if (empty($slug)) { $settings = get_multiple_settings(); $slug = ic_lcfirst($settings['catalog_plural']); } return apply_filters('product_slug', $slug); }