function add_settings() { $product_cats = array(); $product_categories = get_terms('product_cat', 'orderby=name&hide_empty=0'); foreach ($product_categories as $product_category) { $product_cats[$product_category->term_id] = $product_category->name; } $products = wcj_get_products(); $settings = array(array('title' => __('Custom Price Labels - Globally', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('This section lets you set price labels for all products globally.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_options'), array('title' => __('Add before the price', 'woocommerce-jetpack'), 'desc_tip' => __('Enter text to add before all products prices. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_add_before_text', 'default' => '', 'type' => 'textarea', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly'), 'css' => 'width:30%;min-width:300px;'), array('title' => __('Add after the price', 'woocommerce-jetpack'), 'desc_tip' => __('Enter text to add after all products prices. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_add_after_text', 'default' => '', 'type' => 'textarea', 'css' => 'width:30%;min-width:300px;'), array('title' => __('Add between regular and sale prices', 'woocommerce-jetpack'), 'desc_tip' => __('Enter text to add between regular and sale prices. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_between_regular_and_sale_text', 'default' => '', 'type' => 'textarea', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly'), 'css' => 'width:30%;min-width:300px;'), array('title' => __('Remove from price', 'woocommerce-jetpack'), 'desc_tip' => __('Enter text to remove from all products prices. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_remove_text', 'default' => '', 'type' => 'textarea', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly'), 'css' => 'width:30%;min-width:300px;'), array('title' => __('Replace in price', 'woocommerce-jetpack'), 'desc_tip' => __('Enter text to replace in all products prices. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_replace_text', 'default' => '', 'type' => 'textarea', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly'), 'css' => 'width:30%;min-width:300px;'), array('title' => '', 'desc_tip' => __('Enter text to replace with. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_replace_with_text', 'default' => '', 'type' => 'textarea', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly'), 'css' => 'width:30%;min-width:300px;'), array('title' => __('Products - Include', 'woocommerce-jetpack'), 'desc_tip' => __('Apply global price labels only for selected products. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_products_incl', 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products), array('title' => __('Products - Exclude', 'woocommerce-jetpack'), 'desc_tip' => __('Do not apply global price labels only for selected products. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_products_excl', 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products), array('title' => __('Product Categories - Include', 'woocommerce-jetpack'), 'desc_tip' => __('Apply global price labels only for selected product categories. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_product_cats_incl', 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $product_cats), array('title' => __('Product Categories - Exclude', 'woocommerce-jetpack'), 'desc_tip' => __('Do not apply global price labels only for selected product categories. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_product_cats_excl', 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $product_cats), array('title' => __('Product Types - Include', 'woocommerce-jetpack'), 'desc_tip' => __('Apply global price labels only for selected product types. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_global_price_labels_product_types_incl', 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => array_merge(wc_get_product_types(), array('variation' => __('Variable product\'s variation', 'woocommerce-jetpack')))), array('type' => 'sectionend', 'id' => 'wcj_global_price_labels_options'), array('title' => __('Custom Price Labels - Per Product', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_local_price_labels_options'), array('title' => __('Enable', 'woocommerce-jetpack'), 'desc' => __('This will add metaboxes to each product\'s admin edit page.', 'woocommerce-jetpack'), 'id' => 'wcj_local_price_labels_enabled', 'default' => 'yes', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_local_price_labels_options')); return $settings; }
function add_settings() { $product_cats = array(); $product_categories = get_terms('product_cat', 'orderby=name&hide_empty=0'); foreach ($product_categories as $product_category) { $product_cats[$product_category->term_id] = $product_category->name; } $products = wcj_get_products(); $settings = array(array('title' => __('Shop Page Display Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('This will work only when "Shop Page Display" in "WooCommerce > Settings > Products > Product Listings" is set to "Show subcategories" or "Show both".', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_shop_page_options'), array('title' => __('Categories Count', 'woocommerce-jetpack'), 'desc' => __('Hide categories count on shop page', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_hide_cats_count_on_shop', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Exclude Categories', 'woocommerce-jetpack'), 'desc_tip' => __(' Excludes one or more categories from the shop page. This parameter takes a comma-separated list of categories by unique ID, in ascending order. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_exclude_cats_on_shop', 'default' => '', 'type' => 'text', 'css' => 'width:50%;min-width:300px;'), array('title' => __('Hide Empty', 'woocommerce-jetpack'), 'desc' => __('Hide empty categories on shop page', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_hide_empty_cats_on_shop', 'default' => 'yes', 'type' => 'checkbox'), array('title' => __('Show Products', 'woocommerce-jetpack'), 'desc' => __('Show products if no categories are displayed on shop page', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_show_products_if_no_cats_on_shop', 'default' => 'yes', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_product_listings_shop_page_options'), array('title' => __('Category Display Options', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('This will work only when "Default Category Display" in "WooCommerce > Settings > Products > Product Listings" is set to "Show subcategories" or "Show both".', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_archive_pages_options'), array('title' => __('Subcategories Count', 'woocommerce-jetpack'), 'desc' => __('Hide subcategories count on category pages', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_hide_cats_count_on_archive', 'default' => 'no', 'type' => 'checkbox', 'custom_attributes' => apply_filters('booster_get_message', '', 'disabled'), 'desc_tip' => apply_filters('booster_get_message', '', 'desc')), array('title' => __('Exclude Subcategories', 'woocommerce-jetpack'), 'desc_tip' => __(' Excludes one or more categories from the category (archive) pages. This parameter takes a comma-separated list of categories by unique ID, in ascending order. Leave blank to disable.', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_exclude_cats_on_archives', 'default' => '', 'type' => 'text', 'css' => 'width:50%;min-width:300px;'), array('title' => __('Hide Empty', 'woocommerce-jetpack'), 'desc' => __('Hide empty subcategories on category pages', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_hide_empty_cats_on_archives', 'default' => 'yes', 'type' => 'checkbox'), array('title' => __('Show Products', 'woocommerce-jetpack'), 'desc' => __('Show products if no categories are displayed on category page', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_show_products_if_no_cats_on_archives', 'default' => 'yes', 'type' => 'checkbox'), array('type' => 'sectionend', 'id' => 'wcj_product_listings_archive_pages_options'), array('title' => __('Products per Page Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_products_per_page_options'), array('title' => __('Enable Products per Page', 'woocommerce-jetpack'), 'desc' => __('Enable', 'woocommerce-jetpack'), 'id' => 'wcj_products_per_page_enabled', 'default' => 'no', 'type' => 'checkbox'), array('title' => __('Select Options', 'woocommerce-jetpack'), 'desc' => __('Name|Number; one per line; -1 for all products', 'woocommerce-jetpack'), 'id' => 'wcj_products_per_page_select_options', 'default' => '10|10' . PHP_EOL . '25|25' . PHP_EOL . '50|50' . PHP_EOL . '100|100' . PHP_EOL . 'All|-1', 'type' => 'textarea', 'css' => 'height:200px;', 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly'), 'desc_tip' => apply_filters('booster_get_message', '', 'desc_no_link')), array('title' => __('Default', 'woocommerce-jetpack'), 'id' => 'wcj_products_per_page_default', 'default' => get_option('posts_per_page'), 'type' => 'number', 'custom_attributes' => array('min' => -1)), array('title' => __('Position', 'woocommerce-jetpack'), 'id' => 'wcj_products_per_page_position', 'default' => array('woocommerce_before_shop_loop'), 'type' => 'multiselect', 'class' => 'chosen_select', 'options' => array('woocommerce_before_shop_loop' => __('Before shop loop', 'woocommerce-jetpack'), 'woocommerce_after_shop_loop' => __('After shop loop', 'woocommerce-jetpack'))), array('title' => __('Position Priority', 'woocommerce-jetpack'), 'id' => 'wcj_products_per_page_position_priority', 'default' => 40, 'type' => 'number', 'custom_attributes' => array('min' => 0)), array('title' => __('Text', 'woocommerce-jetpack'), 'id' => 'wcj_products_per_page_text', 'default' => __('Products <strong>%from% - %to%</strong> from <strong>%total%</strong>. Products on page %select_form%', 'woocommerce-jetpack'), 'type' => 'textarea', 'css' => 'width:66%;min-width:300px;'), array('type' => 'sectionend', 'id' => 'wcj_products_per_page_options'), array('title' => __('TAX Display Prices in the Shop', 'woocommerce-jetpack'), 'type' => 'title', 'desc' => __('If you want to display part of your products including TAX and another part excluding TAX, you can set it here.', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_display_taxes_options'), array('title' => __('Products - Including TAX', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_display_taxes_products_incl_tax', 'desc_tip' => __('Select products to display including TAX.', 'woocommerce-jetpack'), 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products), array('title' => __('Products - Excluding TAX', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_display_taxes_products_excl_tax', 'desc_tip' => __('Select products to display excluding TAX.', 'woocommerce-jetpack'), 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products), array('title' => __('Product Categories - Including TAX', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_display_taxes_product_cats_incl_tax', 'desc_tip' => __('Select product categories to display including TAX.', 'woocommerce-jetpack'), 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $product_cats), array('title' => __('Product Categories - Excluding TAX', 'woocommerce-jetpack'), 'id' => 'wcj_product_listings_display_taxes_product_cats_excl_tax', 'desc_tip' => __('Select product categories to display excluding TAX.', 'woocommerce-jetpack'), 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $product_cats), array('type' => 'sectionend', 'id' => 'wcj_product_listings_display_taxes_options')); return $settings; }
/** * add_settings. * * @version 2.5.0 */ function add_settings() { $products = wcj_get_products(); $settings = array(); $single_or_archive_array = array('single', 'archive'); foreach ($single_or_archive_array as $single_or_archive) { $single_or_archive_desc = 'single' === $single_or_archive ? __('Single', 'woocommerce-jetpack') : __('Archive', 'woocommerce-jetpack'); $settings = array_merge($settings, array(array('title' => __('Product Custom Info Blocks', 'woocommerce-jetpack') . ' - ' . $single_or_archive_desc, 'type' => 'title', 'id' => 'wcj_product_custom_info_options_' . $single_or_archive), array('title' => __('Total Blocks', 'woocommerce-jetpack'), 'id' => 'wcj_product_custom_info_total_number_' . $single_or_archive, 'default' => 1, 'type' => 'custom_number', 'desc' => apply_filters('booster_get_message', '', 'desc'), 'custom_attributes' => apply_filters('booster_get_message', '', 'readonly')), array('type' => 'sectionend', 'id' => 'wcj_product_custom_info_options_' . $single_or_archive))); for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_product_custom_info_total_number_' . $single_or_archive, 1)); $i++) { $settings = array_merge($settings, array(array('title' => __('Info Block', 'woocommerce-jetpack') . ' #' . $i . ' - ' . $single_or_archive_desc, 'type' => 'title', 'id' => 'wcj_product_custom_info_options_' . $single_or_archive . '_' . $i), array('title' => __('Content', 'woocommerce-jetpack'), 'id' => 'wcj_product_custom_info_content_' . $single_or_archive . '_' . $i, 'default' => '[wcj_product_total_sales before="Total sales: " after=" pcs."]', 'type' => 'textarea', 'css' => 'width:30%;min-width:300px;height:100px;'), array('title' => __('Position', 'woocommerce-jetpack'), 'id' => 'wcj_product_custom_info_hook_' . $single_or_archive . '_' . $i, 'default' => 'single' === $single_or_archive ? 'woocommerce_after_single_product_summary' : 'woocommerce_after_shop_loop_item_title', 'type' => 'select', 'options' => 'single' === $single_or_archive ? array('woocommerce_before_single_product' => __('Before single product', 'woocommerce-jetpack'), 'woocommerce_before_single_product_summary' => __('Before single product summary', 'woocommerce-jetpack'), 'woocommerce_single_product_summary' => __('Inside single product summary', 'woocommerce-jetpack'), 'woocommerce_after_single_product_summary' => __('After single product summary', 'woocommerce-jetpack'), 'woocommerce_after_single_product' => __('After single product', 'woocommerce-jetpack'), 'woocommerce_before_add_to_cart_form' => __('Before add to cart form', 'woocommerce-jetpack'), 'woocommerce_before_add_to_cart_button' => __('Before add to cart button', 'woocommerce-jetpack'), 'woocommerce_after_add_to_cart_button' => __('After add to cart button', 'woocommerce-jetpack'), 'woocommerce_after_add_to_cart_form' => __('After add to cart form', 'woocommerce-jetpack')) : array('woocommerce_before_shop_loop_item' => __('Before product', 'woocommerce-jetpack'), 'woocommerce_before_shop_loop_item_title' => __('Before product title', 'woocommerce-jetpack'), 'woocommerce_shop_loop_item_title' => __('Inside product title', 'woocommerce-jetpack'), 'woocommerce_after_shop_loop_item_title' => __('After product title', 'woocommerce-jetpack'), 'woocommerce_after_shop_loop_item' => __('After product', 'woocommerce-jetpack')), 'css' => 'width:250px;'), array('title' => __('Position Order (i.e. Priority)', 'woocommerce-jetpack'), 'id' => 'wcj_product_custom_info_priority_' . $single_or_archive . '_' . $i, 'default' => 10, 'type' => 'number', 'css' => 'width:250px;'), array('title' => __('Products to Include', 'woocommerce-jetpack'), 'desc_tip' => __('Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_product_custom_info_products_to_include_' . $single_or_archive . '_' . $i, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products), array('title' => __('Products to Exclude', 'woocommerce-jetpack'), 'desc_tip' => __('Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_product_custom_info_products_to_exclude_' . $single_or_archive . '_' . $i, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products), array('type' => 'sectionend', 'id' => 'wcj_product_custom_info_options_' . $single_or_archive . '_' . $i))); } } return $settings; }
/** * add_per_category_settings. * * @version 2.5.0 */ function add_per_category_settings($settings) { $settings[] = array('title' => __('Options', 'woocommerce-jetpack'), 'type' => 'title', 'id' => 'wcj_gateways_per_category_options'); $product_cats = array(); $product_categories = get_terms('product_cat', 'orderby=name&hide_empty=0'); foreach ($product_categories as $product_category) { $product_cats[$product_category->term_id] = $product_category->name; } $products = wcj_get_products(); global $woocommerce; $available_gateways = $woocommerce->payment_gateways->payment_gateways(); foreach ($available_gateways as $gateway_id => $gateway) { $settings[] = array('title' => $gateway->title, 'desc' => __('Product Categories - Include', 'woocommerce-jetpack'), 'desc_tip' => __('Show gateway only if there is product of selected category in cart. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_per_category_' . $gateway_id, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $product_cats); $settings[] = array('title' => '', 'desc' => __('Product Categories - Exclude', 'woocommerce-jetpack'), 'desc_tip' => __('Hide gateway if there is product of selected category in cart. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_per_category_excl_' . $gateway_id, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $product_cats); $settings[] = array('title' => '', 'desc' => __('Products - Include', 'woocommerce-jetpack') . '. ' . apply_filters('booster_get_message', '', 'desc'), 'desc_tip' => __('Show gateway only if there is selected products in cart. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_per_products_' . $gateway_id, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products, 'custom_attributes' => apply_filters('booster_get_message', '', 'disabled')); $settings[] = array('title' => '', 'desc' => __('Products - Exclude', 'woocommerce-jetpack') . '. ' . apply_filters('booster_get_message', '', 'desc'), 'desc_tip' => __('Hide gateway if there is selected products in cart. Leave blank to disable the option.', 'woocommerce-jetpack'), 'id' => 'wcj_gateways_per_products_excl_' . $gateway_id, 'default' => '', 'type' => 'multiselect', 'class' => 'chosen_select', 'css' => 'width: 450px;', 'options' => $products, 'custom_attributes' => apply_filters('booster_get_message', '', 'disabled')); } $settings[] = array('type' => 'sectionend', 'id' => 'wcj_gateways_per_category_options'); return $settings; }