Enabled product bundles
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Add to Cart Button Visibility
|
||||
*
|
||||
* @version 3.3.0
|
||||
* @since 3.3.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_button_disable',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Hide', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'Show', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Single Product Page', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_button_disable_content',
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'title' => '',
|
||||
'css' => 'width:100%;',
|
||||
'tooltip' => __( 'Content to replace add to cart button on single product page.', 'woocommerce-jetpack' ) . ' ' .
|
||||
__( 'You can use HTML and/or shortcodes here.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_button_loop_disable',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Hide', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'Show', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Category/Archives', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_button_loop_disable_content',
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'title' => '',
|
||||
'css' => 'width:100%;',
|
||||
'tooltip' => __( 'Content to replace add to cart button on category/archives.', 'woocommerce-jetpack' ) . ' ' .
|
||||
__( 'You can use HTML and/or shortcodes here.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Admin Tools
|
||||
*
|
||||
* @version 3.5.0
|
||||
* @since 3.3.0
|
||||
* @author Algoritmika Ltd.
|
||||
* @todo (maybe) sort `$products` with available variations listed at the top
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$products = wcj_get_product_ids_for_meta_box_options( get_the_ID(), true );
|
||||
$settings = array();
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
$settings = array_merge( $settings, array(
|
||||
array(
|
||||
'type' => 'title',
|
||||
'title' => sprintf( __( 'Product ID: %s', 'woocommerce-jetpack' ), $product_id ) . $desc,
|
||||
'css' => 'background-color:#cddc39;color:black;',
|
||||
),
|
||||
array(
|
||||
'name' => '_regular_price' . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => __( 'Regular price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_regular_price',
|
||||
),
|
||||
array(
|
||||
'name' => '_sale_price' . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => __( 'Sale price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_sale_price',
|
||||
),
|
||||
) );
|
||||
}
|
||||
return $settings;
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Coupon by User Role
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 3.6.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Invalidate for roles', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Invalidate coupon for selected user roles.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_coupon_by_user_role_invalid',
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'multiple' => 'true',
|
||||
'class' => 'chosen_select',
|
||||
'options' => wcj_get_user_roles_options(),
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Crowdfunding
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'name' => 'wcj_crowdfunding_goal_sum',
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'Goal', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_crowdfunding_startdate',
|
||||
'default' => '',
|
||||
'type' => 'date',
|
||||
'title' => __( 'Start Date', 'woocommerce-jetpack' )
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_crowdfunding_deadline',
|
||||
'default' => '',
|
||||
'type' => 'date',
|
||||
'title' => __( 'Deadline', 'woocommerce-jetpack' )
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Currency per Product
|
||||
*
|
||||
* @version 3.7.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$currency_codes = array();
|
||||
$currency_codes[''] = __( 'Default', 'woocommerce-jetpack' );
|
||||
$currency_codes[ get_option( 'woocommerce_currency' ) ] = get_option( 'woocommerce_currency' );
|
||||
$currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
|
||||
$total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_currency_per_product_total_number', 1 ) );
|
||||
for ( $i = 1; $i <= $total_number; $i++ ) {
|
||||
$currency_codes[ get_option( 'wcj_currency_per_product_currency_' . $i ) ] = get_option( 'wcj_currency_per_product_currency_' . $i );
|
||||
}
|
||||
$options = array(
|
||||
array(
|
||||
'name' => 'wcj_currency_per_product_currency',
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'title' => __( 'Product Currency', 'woocommerce-jetpack' ),
|
||||
'options' => $currency_codes,
|
||||
'tooltip' => __( 'Update product after you change this field\'s value.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
);
|
||||
return $options;
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Custom CSS
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Add CSS', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_css_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'CSS', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_css',
|
||||
'default' => get_option( 'wcj_custom_css_per_product_default_value', '' ),
|
||||
'type' => 'textarea',
|
||||
'css' => 'width:100%;min-height:100px;',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - General
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'PayPal Email', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_paypal_per_product_email',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Max Products per User
|
||||
*
|
||||
* @version 3.5.0
|
||||
* @since 3.5.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Max Qty', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_max_products_per_user_qty',
|
||||
'default' => 0,
|
||||
'type' => 'number',
|
||||
'tooltip' => __( 'If set to zero, and "All Products" section is enabled - global maximum quantity will be used; in case if "All Products" section is disabled - no maximum quantity will be used.', 'woocommerce-jetpack' ),
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Multicurrency Product Base Price
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
/*
|
||||
$main_product_id = get_the_ID();
|
||||
$_product = wc_get_product( $main_product_id );
|
||||
$products = array();
|
||||
if ( $_product->is_type( 'variable' ) ) {
|
||||
$available_variations = $_product->get_available_variations();
|
||||
foreach ( $available_variations as $variation ) {
|
||||
$variation_product = wc_get_product( $variation['variation_id'] );
|
||||
$products[ $variation['variation_id'] ] = ' (' . wcj_get_product_formatted_variation( $variation_product, true ) . ')';
|
||||
}
|
||||
} else {
|
||||
$products[ $main_product_id ] = '';
|
||||
}
|
||||
$options = array();
|
||||
$total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
$currency_codes = array();
|
||||
$currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
|
||||
for ( $i = 1; $i <= $total_number; $i++ ) {
|
||||
$currency_codes[ get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ] = get_option( 'wcj_multicurrency_base_price_currency_' . $i );
|
||||
}
|
||||
$options[] = array(
|
||||
'name' => 'wcj_multicurrency_base_price_currency_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'title' => __( 'Product Currency', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_multicurrency_base_price_currency',
|
||||
'options' => $currency_codes,
|
||||
);
|
||||
}
|
||||
return $options;
|
||||
*/
|
||||
$currency_codes = array();
|
||||
$currency_codes[ get_woocommerce_currency() ] = get_woocommerce_currency();
|
||||
$total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_multicurrency_base_price_total_number', 1 ) );
|
||||
for ( $i = 1; $i <= $total_number; $i++ ) {
|
||||
$currency_codes[ get_option( 'wcj_multicurrency_base_price_currency_' . $i ) ] = get_option( 'wcj_multicurrency_base_price_currency_' . $i );
|
||||
}
|
||||
$options = array(
|
||||
array(
|
||||
'name' => 'wcj_multicurrency_base_price_currency',
|
||||
'default' => get_woocommerce_currency(),
|
||||
'type' => 'select',
|
||||
'title' => __( 'Product Currency', 'woocommerce-jetpack' ),
|
||||
'options' => $currency_codes,
|
||||
),
|
||||
);
|
||||
return $options;
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Multicurrency (Currency Switcher)
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$main_product_id = get_the_ID();
|
||||
$_product = wc_get_product( $main_product_id );
|
||||
if ( ! $_product ) {
|
||||
return array();
|
||||
}
|
||||
$products = array();
|
||||
if ( $_product->is_type( 'variable' ) ) {
|
||||
$list_available_variations_only = ( 'yes' === get_option( 'wcj_multicurrency_per_product_list_available_variations_only', 'yes' ) );
|
||||
$available_variations = ( $list_available_variations_only ? $_product->get_available_variations() : $_product->get_children() );
|
||||
foreach ( $available_variations as $variation ) {
|
||||
$variation_id = ( $list_available_variations_only ? $variation['variation_id'] : $variation );
|
||||
$variation_product = wc_get_product( $variation_id );
|
||||
$products[ $variation_id ] = ' (' . wcj_get_product_formatted_variation( $variation_product, true ) . ')';
|
||||
}
|
||||
} else {
|
||||
$products[ $main_product_id ] = '';
|
||||
}
|
||||
$currencies = array();
|
||||
$total_number = apply_filters( 'booster_option', 2, get_option( 'wcj_multicurrency_total_number', 2 ) );
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
for ( $i = 1; $i <= $total_number; $i++ ) {
|
||||
$currency_code = get_option( 'wcj_multicurrency_currency_' . $i );
|
||||
$currencies = array_merge( $currencies, array(
|
||||
array(
|
||||
'name' => 'wcj_multicurrency_per_product_regular_price_' . $currency_code . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => '[' . $currency_code . '] ' . __( 'Regular Price', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_multicurrency_per_product_regular_price_' . $currency_code,
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_multicurrency_per_product_sale_price_' . $currency_code . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => '[' . $currency_code . '] ' . __( 'Sale Price', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_multicurrency_per_product_sale_price_' . $currency_code,
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
return $currencies;
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Offer Price
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.9.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Enable Offer Price', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_offer_price_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Price Step', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Number of decimals', 'woocommerce' ) . '. ' . __( 'Leave blank to use global value.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_offer_price_price_step',
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'placeholder' => get_option( 'wcj_offer_price_price_step', get_option( 'woocommerce_price_num_decimals' ) ),
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Minimal Price', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Leave blank to use global value.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_offer_price_min_price',
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'placeholder' => get_option( 'wcj_offer_price_min_price', 0 ),
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Maximal Price', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Set zero to disable.', 'woocommerce-jetpack' ) . ' ' . __( 'Leave blank to use global value.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_offer_price_max_price',
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'placeholder' => get_option( 'wcj_offer_price_max_price', 0 ),
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Default Price', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Set zero to disable.', 'woocommerce-jetpack' ) . ' ' . __( 'Leave blank to use global value.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_offer_price_default_price',
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'placeholder' => get_option( 'wcj_offer_price_default_price', 0 ),
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Order Numbers
|
||||
*
|
||||
* @version 3.5.0
|
||||
* @since 3.5.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Number', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_order_number',
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'custom_attributes' => 'required min="1"',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Order Min/Max Quantities
|
||||
*
|
||||
* @version 3.7.0
|
||||
* @since 3.2.2
|
||||
* @author Algoritmika Ltd.
|
||||
* @todo test "Set 0 to use global settings. Set -1 to disable"
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$main_product_id = get_the_ID();
|
||||
$_product = wc_get_product( $main_product_id );
|
||||
if ( ! $_product ) {
|
||||
return array();
|
||||
}
|
||||
$products = array();
|
||||
if ( $_product->is_type( 'variable' ) ) {
|
||||
$available_variations = $_product->get_available_variations();
|
||||
foreach ( $available_variations as $variation ) {
|
||||
$variation_product = wc_get_product( $variation['variation_id'] );
|
||||
$products[ $variation['variation_id'] ] = ' (' . wcj_get_product_formatted_variation( $variation_product, true ) . ')';
|
||||
}
|
||||
} else {
|
||||
$products[ $main_product_id ] = '';
|
||||
}
|
||||
$quantities = array();
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
if ( $this->is_min_per_product_enabled ) {
|
||||
$quantities = array_merge( $quantities, array(
|
||||
array(
|
||||
'name' => 'wcj_order_quantities_min' . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'title' => __( 'Minimum Quantity', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_order_quantities_min',
|
||||
'custom_attributes' => 'min="-1"',
|
||||
'tooltip' => __( 'Set 0 to use global settings. Set -1 to disable.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
if ( $this->is_max_per_product_enabled ) {
|
||||
$quantities = array_merge( $quantities, array(
|
||||
array(
|
||||
'name' => 'wcj_order_quantities_max' . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'title' => __( 'Maximum Quantity', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_order_quantities_max',
|
||||
'custom_attributes' => 'min="-1"',
|
||||
'tooltip' => __( 'Set 0 to use global settings. Set -1 to disable.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
if ( $this->is_step_per_product_enabled ) {
|
||||
$quantities = array_merge( $quantities, array(
|
||||
array(
|
||||
'name' => 'wcj_order_quantities_step' . '_' . $main_product_id,
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
'title' => __( 'Quantity Step', 'woocommerce-jetpack' ),
|
||||
'desc' => ( $_product->is_type( 'variable' ) ? __( 'All variations', 'woocommerce-jetpack' ) : '' ),
|
||||
'product_id' => $main_product_id,
|
||||
'meta_name' => '_' . 'wcj_order_quantities_step',
|
||||
'custom_attributes' => 'min="0"',
|
||||
'tooltip' => __( 'Set 0 to use global settings.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
return $quantities;
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Orders
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$order_id = get_the_ID();
|
||||
$_order = wc_get_order( $order_id );
|
||||
if ( ! $_order ) {
|
||||
return array();
|
||||
}
|
||||
$options = array(
|
||||
array(
|
||||
'title' => __( 'Order Currency', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Save order after you change this field.', 'woocommerce-jetpack' ),
|
||||
'name' => ( 'filter' === get_option( 'wcj_order_admin_currency_method', 'filter' ) ? 'wcj_order_currency' : 'order_currency' ),
|
||||
'default' => wcj_get_order_currency( $_order ),
|
||||
'type' => 'select',
|
||||
'options' => wcj_get_currencies_names_and_symbols( 'names' ),
|
||||
),
|
||||
);
|
||||
return $options;
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - PDF Invoicing
|
||||
*
|
||||
* @version 3.5.0
|
||||
* @since 3.5.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$order_id = get_the_ID();
|
||||
$_order = wc_get_order( $order_id );
|
||||
if ( ! $_order ) {
|
||||
return array();
|
||||
}
|
||||
$options = array();
|
||||
$invoice_types = wcj_get_enabled_invoice_types();
|
||||
if ( ! empty( $invoice_types ) ) {
|
||||
foreach ( $invoice_types as $invoice_type ) {
|
||||
if ( wcj_is_invoice_created( $order_id, $invoice_type['id'] ) ) {
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'title' => sprintf( __( '%s number', 'woocommerce-jetpack' ), $invoice_type['title'] ),
|
||||
'name' => 'wcj_invoicing_' . $invoice_type['id'] . '_number_id',
|
||||
'default' => '',
|
||||
'type' => 'number',
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Price by Country
|
||||
*
|
||||
* @version 3.3.0
|
||||
* @since 3.3.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$products = wcj_get_product_ids_for_meta_box_options( get_the_ID() );
|
||||
$groups = array();
|
||||
$total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) );
|
||||
for ( $i = 1; $i <= $total_number; $i++ ) {
|
||||
$group_currency_code = get_option( 'wcj_price_by_country_exchange_rate_currency_group_' . $i );
|
||||
$admin_title = get_option( 'wcj_price_by_country_countries_group_admin_title_' . $i, __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i );
|
||||
$countries = '';
|
||||
switch ( get_option( 'wcj_price_by_country_selection', 'comma_list' ) ) {
|
||||
case 'comma_list':
|
||||
$countries .= get_option( 'wcj_price_by_country_exchange_rate_countries_group_' . $i );
|
||||
break;
|
||||
case 'multiselect':
|
||||
$countries .= implode( ',', get_option( 'wcj_price_by_country_countries_group_' . $i ) );
|
||||
break;
|
||||
case 'chosen_select':
|
||||
$countries .= implode( ',', get_option( 'wcj_price_by_country_countries_group_chosen_select_' . $i ) );
|
||||
break;
|
||||
}
|
||||
$admin_title = '<details>' . '<summary>' . $admin_title . ' [' . $group_currency_code . ']' . '</summary>' .
|
||||
'<p>' . $countries . ' (' . count( explode( ',', $countries ) ) . ')' . '</p>' . '</details>';
|
||||
$groups = array_merge( $groups, array(
|
||||
array(
|
||||
'type' => 'title',
|
||||
'title' => $admin_title,
|
||||
'css' => 'background-color:#cddc39;color:black;',
|
||||
),
|
||||
) );
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
$groups = array_merge( $groups, array(
|
||||
array(
|
||||
'name' => 'wcj_price_by_country_regular_price_local_' . $i . '_' . $product_id,
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'Regular price', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_price_by_country_regular_price_local_' . $i,
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_price_by_country_sale_price_local_' . $i . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => __( 'Sale price', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_price_by_country_sale_price_local_' . $i,
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_price_by_country_make_empty_price_local_' . $i . '_' . $product_id,
|
||||
'default' => 'off',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'off' => __( 'No', 'woocommerce-jetpack' ),
|
||||
'on' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Make empty price', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_price_by_country_make_empty_price_local_' . $i,
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
return $groups;
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Price based on User Role
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
* @todo (maybe) add option to disable "Copy to ..." buttons
|
||||
* @todo (maybe) "Copy to ..." for "Make Empty Price"
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$main_product_id = get_the_ID();
|
||||
$_product = wc_get_product( $main_product_id );
|
||||
$products = array();
|
||||
if ( $_product->is_type( 'variable' ) ) {
|
||||
$available_variations = $_product->get_available_variations();
|
||||
foreach ( $available_variations as $variation ) {
|
||||
$variation_product = wc_get_product( $variation['variation_id'] );
|
||||
$products[ $variation['variation_id'] ] = ' (' . wcj_get_product_formatted_variation( $variation_product, true ) . ')';
|
||||
}
|
||||
} else {
|
||||
$products[ $main_product_id ] = '';
|
||||
}
|
||||
$options = array(
|
||||
array(
|
||||
'type' => 'title',
|
||||
'title' => __( 'Per Product Settings (press Update after changing)', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_price_by_user_role_per_product_settings_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Enabled', 'woocommerce-jetpack' ),
|
||||
),
|
||||
);
|
||||
if ( 'yes' === get_post_meta( wcj_get_product_id( $_product ), '_' . 'wcj_price_by_user_role_per_product_settings_enabled', true ) ) {
|
||||
$visible_roles = get_option( 'wcj_price_by_user_role_per_product_show_roles', '' );
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
foreach ( wcj_get_user_roles() as $role_key => $role_data ) {
|
||||
if ( ! empty( $visible_roles ) ) {
|
||||
if ( ! in_array( $role_key, $visible_roles ) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// "Copy price to all user roles" buttons
|
||||
$roles_for_copy = ( ! empty( $visible_roles ) ? array_flip( $visible_roles ) : wcj_get_user_roles() );
|
||||
unset( $roles_for_copy[ $role_key ] );
|
||||
$roles_for_copy = array_keys( $roles_for_copy );
|
||||
if ( ! empty( $roles_for_copy ) ) {
|
||||
$copy_to_roles_regular = $this->get_admin_settings_copy_link( 'copy_to_roles', 'regular', $product_id, $role_key, $roles_for_copy, array() );
|
||||
$copy_to_roles_sale = $this->get_admin_settings_copy_link( 'copy_to_roles', 'sale', $product_id, $role_key, $roles_for_copy, array() );
|
||||
} else {
|
||||
$copy_to_roles_regular = '';
|
||||
$copy_to_roles_sale = '';
|
||||
}
|
||||
// "Copy price to all variations" buttons
|
||||
$products_for_copy = $products;
|
||||
unset( $products_for_copy[ $product_id ] );
|
||||
$products_for_copy = array_keys( $products_for_copy );
|
||||
if ( ! empty( $products_for_copy ) ) {
|
||||
$copy_to_variations_regular = $this->get_admin_settings_copy_link( 'copy_to_variations', 'regular', $product_id, $role_key, array(), $products_for_copy );
|
||||
$copy_to_variations_sale = $this->get_admin_settings_copy_link( 'copy_to_variations', 'sale', $product_id, $role_key, array(), $products_for_copy );
|
||||
} else {
|
||||
$copy_to_variations_regular = '';
|
||||
$copy_to_variations_sale = '';
|
||||
}
|
||||
// "Copy price to all user roles & variations" buttons
|
||||
if ( ! empty( $roles_for_copy ) && ! empty( $products_for_copy ) ) {
|
||||
$copy_to_roles_and_variations_regular = $this->get_admin_settings_copy_link( 'copy_to_roles_and_variations', 'regular', $product_id, $role_key,
|
||||
$roles_for_copy, $products_for_copy );
|
||||
$copy_to_roles_and_variations_sale = $this->get_admin_settings_copy_link( 'copy_to_roles_and_variations', 'sale', $product_id, $role_key,
|
||||
$roles_for_copy, $products_for_copy );
|
||||
} else {
|
||||
$copy_to_roles_and_variations_regular = '';
|
||||
$copy_to_roles_and_variations_sale = '';
|
||||
}
|
||||
$copy_buttons_regular = $copy_to_roles_regular . $copy_to_variations_regular . $copy_to_roles_and_variations_regular;
|
||||
$copy_buttons_sale = $copy_to_roles_sale . $copy_to_variations_sale . $copy_to_roles_and_variations_sale;
|
||||
// Settings
|
||||
if ( 'fixed' === get_option( 'wcj_price_by_user_role_per_product_type', 'fixed' ) ) {
|
||||
$prices_or_multiplier = array(
|
||||
array(
|
||||
'name' => 'wcj_price_by_user_role_regular_price_' . $role_key . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => __( 'Regular Price', 'woocommerce-jetpack' ) . $copy_buttons_regular,
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_price_by_user_role_regular_price_' . $role_key,
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_price_by_user_role_sale_price_' . $role_key . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => __( 'Sale Price', 'woocommerce-jetpack' ) . $copy_buttons_sale,
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_price_by_user_role_sale_price_' . $role_key,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
$prices_or_multiplier = array(
|
||||
array(
|
||||
'name' => 'wcj_price_by_user_role_multiplier_' . $role_key . '_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'title' => __( 'Multiplier', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_price_by_user_role_multiplier_' . $role_key,
|
||||
),
|
||||
);
|
||||
}
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'type' => 'title',
|
||||
'title' => '<em>' . $role_data['name'] . '</em>',
|
||||
),
|
||||
),
|
||||
$prices_or_multiplier,
|
||||
array(
|
||||
array(
|
||||
'name' => 'wcj_price_by_user_role_empty_price_' . $role_key . '_' . $product_id,
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Make Empty Price', 'woocommerce-jetpack' ),
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_price_by_user_role_empty_price_' . $role_key,
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Add To Cart
|
||||
*
|
||||
* @version 3.3.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$options = array();
|
||||
if ( 'yes' === apply_filters( 'booster_option', 'no', get_option( 'wcj_add_to_cart_redirect_per_product_enabled', 'no' ) ) ) {
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_redirect_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Add to Cart Local Redirect', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_redirect_url',
|
||||
'tooltip' => __( 'Redirect URL. Leave empty to redirect to checkout page (skipping the cart page).', 'woocommerce-jetpack' ),
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'title' => __( 'Add to Cart Local Redirect URL', 'woocommerce-jetpack' ),
|
||||
'css' => 'width:100%;',
|
||||
),
|
||||
) );
|
||||
}
|
||||
if ( 'per_product' === get_option( 'wcj_add_to_cart_on_visit_enabled', 'no' ) ) {
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_on_visit_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Add to Cart on Visit', 'woocommerce-jetpack' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
if ( 'yes' === get_option( 'wcj_add_to_cart_button_custom_loop_url_per_product_enabled', 'no' ) ) {
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_button_loop_custom_url',
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'title' => __( 'Custom Add to Cart Button URL (Category/Archives)', 'woocommerce-jetpack' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
if ( 'yes' === get_option( 'wcj_add_to_cart_button_ajax_per_product_enabled', 'no' ) ) {
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'name' => 'wcj_add_to_cart_button_ajax_disable',
|
||||
'default' => 'as_shop_default',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'as_shop_default' => __( 'As shop default (no changes)', 'woocommerce-jetpack' ),
|
||||
'yes' => __( 'Disable', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'Enable', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Disable Add to Cart Button AJAX', 'woocommerce-jetpack' ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Addons
|
||||
*
|
||||
* @version 3.7.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$options = array(
|
||||
array(
|
||||
'name' => 'wcj_product_addons_per_product_settings_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Enabled', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_addons_per_product_total_number',
|
||||
'tooltip' => __( 'Save product after you change this number.', 'woocommerce-jetpack' ),
|
||||
'default' => 0,
|
||||
'type' => 'number',
|
||||
'title' => __( 'Product Addons Total Number', 'woocommerce-jetpack' ),
|
||||
),
|
||||
);
|
||||
$total_number = get_post_meta( get_the_ID(), '_' . 'wcj_product_addons_per_product_total_number', true );
|
||||
for ( $i = 1; $i <= $total_number; $i++ ) {
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'title' => __( 'Product Addon', 'woocommerce-jetpack' ) . ' #' . $i . ' - ' . __( 'Enable', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_enabled_' . $i,
|
||||
'default' => 'yes',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Type', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_type_' . $i,
|
||||
'default' => 'checkbox',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'checkbox' => __( 'Checkbox', 'woocommerce-jetpack' ),
|
||||
'radio' => __( 'Radio Buttons', 'woocommerce-jetpack' ),
|
||||
'select' => __( 'Select Box', 'woocommerce-jetpack' ),
|
||||
'text' => __( 'Text', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Title', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_title_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'css' => 'width:100%;',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Label(s)', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'For radio and select enter one value per line.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_label_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'css' => 'width:100%;height:100px;',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Price(s)', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'For radio and select enter one value per line.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_price_' . $i,
|
||||
'default' => 0,
|
||||
'type' => 'textarea',
|
||||
'css' => 'height:100px;',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Tooltip(s)', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'For radio enter one value per line.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_tooltip_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'css' => 'width:100%;height:100px;',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Default Value', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'For checkbox use \'checked\'; for radio and select enter default label. Leave blank for no default value.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_default_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'css' => 'width:100%;',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Placeholder', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'For "Select Box" type only.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_placeholder_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'css' => 'width:100%;',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'HTML Class', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_class_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'css' => 'width:100%;',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Is required', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_required_' . $i,
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Quantity', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Leave empty to disable quantity calculation for the addon. When set to zero - addon will be disabled.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_addons_per_product_qty_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
),
|
||||
) );
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Bookings
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Enabled', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_bookings_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Visibility by Condition
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 3.6.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$option_styling = ( 'standard' === get_option( 'wcj_' . $this->id . '_select_style', 'chosen_select' ) ?
|
||||
array(
|
||||
'tooltip' => __( 'Use "Control" key to select/deselect multiple options. Hold "Control" and "A" to select all options. Leave empty to disable.', 'woocommerce-jetpack' ),
|
||||
'css' => 'height:200px;',
|
||||
'class' => 'widefat',
|
||||
'show_value' => true,
|
||||
) :
|
||||
array(
|
||||
'css' => 'width:100%;',
|
||||
'class' => 'chosen_select',
|
||||
)
|
||||
);
|
||||
$all_options = $this->get_options_list();
|
||||
$options = array();
|
||||
if ( 'invisible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
|
||||
$options = array_merge( $options, array( array_merge(
|
||||
array(
|
||||
'title' => __( 'Visible', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_' . $this->id . '_visible',
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'options' => $all_options,
|
||||
'multiple' => true,
|
||||
), $option_styling )
|
||||
) );
|
||||
}
|
||||
if ( 'visible' != apply_filters( 'booster_option', 'visible', get_option( 'wcj_' . $this->id . '_visibility_method', 'visible' ) ) ) {
|
||||
$options = array_merge( $options, array( array_merge(
|
||||
array(
|
||||
'title' => __( 'Invisible', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_' . $this->id . '_invisible',
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'options' => $all_options,
|
||||
'multiple' => true,
|
||||
), $option_styling )
|
||||
) );
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Availability by Date
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 2.9.1
|
||||
* @author Algoritmika Ltd.
|
||||
* @todo (maybe) Direct Date: all products
|
||||
* @todo (maybe) Direct Date: option to disable months in admin product edit page
|
||||
* @todo (maybe) Direct Date: add time also
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$settings = array(
|
||||
array(
|
||||
'title' => __( 'Enable/Disable per Product Settings', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_by_date_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'no' => __( 'Disabled', 'woocommerce-jetpack' ),
|
||||
'yes' => __( 'Enabled', 'woocommerce-jetpack' ),
|
||||
),
|
||||
// 'tooltip' => __( 'Date formats:', 'woocommerce-jetpack' ) . ' ' . '<code>DD-DD</code>' . ', ' . '<code>DD-DD,DD-DD</code>' . ', ' . '<code>-</code>' . '.',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Direct Date', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_by_date_direct_date',
|
||||
'default' => '',
|
||||
'type' => 'date',
|
||||
'tooltip' => __( 'Fill this if you want to set one date from which the product will be available.', 'woocommerce-jetpack' ) . ' ' .
|
||||
__( 'If this field is filled in, monthly settings fields are ignored.', 'woocommerce-jetpack' ),
|
||||
'custom_attributes' => ( '' != ( $format = get_option( 'wcj_product_by_date_direct_date_format', '' ) ) ?
|
||||
'dateformat="' . wcj_date_format_php_to_js( $format ) . '"' : '' ),
|
||||
),
|
||||
);
|
||||
$_timestamp = 1; // January 1 1970
|
||||
for ( $i = 1; $i <= 12; $i++ ) {
|
||||
$settings = array_merge( $settings, array(
|
||||
array(
|
||||
'title' => date_i18n( 'F', $_timestamp ),
|
||||
'name' => 'wcj_product_by_date_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'css' => 'width:300px;',
|
||||
),
|
||||
) );
|
||||
$_timestamp = strtotime( '+1 month', $_timestamp );
|
||||
}
|
||||
return $settings;
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Availability by Time
|
||||
*
|
||||
* @version 2.9.1
|
||||
* @since 2.9.1
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$settings = array(
|
||||
array(
|
||||
'title' => __( 'Enable/Disable per Product Settings', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_by_time_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'no' => __( 'Disabled', 'woocommerce-jetpack' ),
|
||||
'yes' => __( 'Enabled', 'woocommerce-jetpack' ),
|
||||
),
|
||||
// 'tooltip' => __( 'Time formats:', 'woocommerce-jetpack' ) . ' ' . '<code>HH:MM-HH:MM</code>' . ', ' . '<code>HH:MM-HH:MM,HH:MM-HH:MM</code>' . ', ' . '<code>-</code>' . '.',
|
||||
),
|
||||
);
|
||||
$_timestamp = strtotime( 'next Sunday' );
|
||||
for ( $i = 0; $i < 7; $i++ ) {
|
||||
$settings = array_merge( $settings, array(
|
||||
array(
|
||||
'title' => date_i18n( 'l', $_timestamp ),
|
||||
'name' => 'wcj_product_by_time_' . $i,
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'css' => 'width:300px;',
|
||||
),
|
||||
) );
|
||||
$_timestamp = strtotime( '+1 day', $_timestamp );
|
||||
}
|
||||
return $settings;
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Images
|
||||
*
|
||||
* @version 2.9.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'name' => 'wcj_product_images_meta_custom_on_single',
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'title' => __( 'Replace image with custom HTML on single product page', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'You can use shortcodes here.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_images_meta_custom_on_archives',
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'title' => __( 'Replace image with custom HTML on archives', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'You can use shortcodes here.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_images_hide_image_on_single',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Hide Image on Single', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_images_hide_thumb_on_single',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Hide Thumbnails on Single', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_images_hide_image_on_archives',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Hide Image on Archives', 'woocommerce-jetpack' ),
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product MSRP
|
||||
*
|
||||
* @version 3.6.0
|
||||
* @since 3.6.0
|
||||
* @author Algoritmika Ltd.
|
||||
* @todo (maybe) `wcj_product_msrp_variable_as_simple_enabled`
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$main_product_id = get_the_ID();
|
||||
$_product = wc_get_product( $main_product_id );
|
||||
if ( ! $_product ) {
|
||||
return array();
|
||||
}
|
||||
$products = array();
|
||||
if ( $_product->is_type( 'variable' ) && 'no' === get_option( 'wcj_product_msrp_variable_as_simple_enabled', 'no' ) ) {
|
||||
$available_variations = $_product->get_available_variations();
|
||||
foreach ( $available_variations as $variation ) {
|
||||
$variation_product = wc_get_product( $variation['variation_id'] );
|
||||
$products[ $variation['variation_id'] ] = ' (' . wcj_get_product_formatted_variation( $variation_product, true ) . ')';
|
||||
}
|
||||
} else {
|
||||
$products[ $main_product_id ] = '';
|
||||
}
|
||||
|
||||
$options = array();
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
$options[] = array(
|
||||
'name' => 'wcj_msrp_' . $product_id,
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'MSRP', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_msrp',
|
||||
);
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Custom CSS
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Enabled', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_open_price_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Default Price', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'name' => 'wcj_product_open_price_default_price',
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Min Price', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'name' => 'wcj_product_open_price_min_price',
|
||||
'default' => 1,
|
||||
'type' => 'price',
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Max Price', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'name' => 'wcj_product_open_price_max_price',
|
||||
'default' => '',
|
||||
'type' => 'price',
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Price by Formula
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$options = array(
|
||||
array(
|
||||
'name' => 'wcj_product_price_by_formula_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Enabled', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( '\'Enabled\' option is ignored if \'Enable Price Calculation By Formula For All Products\' option is checked in module\'s settings.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_price_by_formula_calculation',
|
||||
'default' => 'per_product',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'per_product' => __( 'Use values below', 'woocommerce-jetpack' ),
|
||||
'global' => __( 'Use default values', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Calculation', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_price_by_formula_eval',
|
||||
'default' => get_option( 'wcj_product_price_by_formula_eval', '' ),
|
||||
'type' => 'text',
|
||||
'title' => __( 'Formula', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_product_price_by_formula_total_params',
|
||||
'default' => get_option( 'wcj_product_price_by_formula_total_params', 1 ),
|
||||
'type' => 'number',
|
||||
'title' => __( 'Number of Parameters', 'woocommerce-jetpack' ),
|
||||
),
|
||||
);
|
||||
$total_params = get_post_meta( get_the_ID(), '_' . 'wcj_product_price_by_formula_total_params', false );
|
||||
if ( empty( $total_params ) ) {
|
||||
$total_params = get_option( 'wcj_product_price_by_formula_total_params', 1 );
|
||||
} else {
|
||||
$total_params = $total_params[0];
|
||||
}
|
||||
for ( $i = 1; $i <= $total_params; $i++ ) {
|
||||
$options[] = array(
|
||||
'name' => 'wcj_product_price_by_formula_param_' . $i,
|
||||
'default' => get_option( 'wcj_product_price_by_formula_param_' . $i, '' ),
|
||||
'type' => 'text',
|
||||
'title' => 'p' . $i,
|
||||
);
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Product Cost Price
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
* @todo wcj_purchase_price_currency
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$main_product_id = get_the_ID();
|
||||
$_product = wc_get_product( $main_product_id );
|
||||
if ( ! $_product ) {
|
||||
return array();
|
||||
}
|
||||
$products = array();
|
||||
if ( $_product->is_type( 'variable' ) && 'no' === get_option( 'wcj_purchase_data_variable_as_simple_enabled', 'no' ) ) {
|
||||
$available_variations = $_product->get_available_variations();
|
||||
foreach ( $available_variations as $variation ) {
|
||||
$variation_product = wc_get_product( $variation['variation_id'] );
|
||||
$products[ $variation['variation_id'] ] = ' (' . wcj_get_product_formatted_variation( $variation_product, true ) . ')';
|
||||
}
|
||||
} else {
|
||||
$products[ $main_product_id ] = '';
|
||||
}
|
||||
$options = array();
|
||||
foreach ( $products as $product_id => $desc ) {
|
||||
$product_options = array(
|
||||
array(
|
||||
'name' => 'wcj_purchase_price_' . $product_id,
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'Product cost (purchase) price', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_purchase_price',
|
||||
'enabled' => get_option( 'wcj_purchase_price_enabled', 'yes' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_purchase_price_extra_' . $product_id,
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'Extra expenses (shipping etc.)', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_purchase_price_extra',
|
||||
'enabled' => get_option( 'wcj_purchase_price_extra_enabled', 'yes' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_purchase_price_affiliate_commission_' . $product_id,
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'Affiliate commission', 'woocommerce-jetpack' ) . ' (' . get_woocommerce_currency_symbol() . ')',
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_purchase_price_affiliate_commission',
|
||||
'enabled' => get_option( 'wcj_purchase_price_affiliate_commission_enabled', 'no' ),
|
||||
),
|
||||
);
|
||||
$total_number = apply_filters( 'booster_option', 1, get_option( 'wcj_purchase_data_custom_price_fields_total_number', 1 ) );
|
||||
for ( $i = 1; $i <= $total_number; $i++ ) {
|
||||
$the_title = get_option( 'wcj_purchase_data_custom_price_field_name_' . $i, '' );
|
||||
if ( '' == $the_title ) {
|
||||
continue;
|
||||
}
|
||||
$the_type = get_option( 'wcj_purchase_data_custom_price_field_type_' . $i, 'fixed' );
|
||||
$the_default_value = get_option( 'wcj_purchase_data_custom_price_field_default_value_' . $i, 0 );
|
||||
$the_title .= ( 'fixed' === $the_type ) ? ' (' . get_woocommerce_currency_symbol() . ')' : ' (' . '%' . ')';
|
||||
$product_options[] = array(
|
||||
'name' => 'wcj_purchase_price_custom_field_' . $i . '_' . $product_id,
|
||||
'default' => $the_default_value,
|
||||
'type' => 'price',
|
||||
'title' => $the_title,
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_purchase_price_custom_field_' . $i,
|
||||
'enabled' => 'yes',
|
||||
);
|
||||
}
|
||||
$product_options = array_merge( $product_options, array(
|
||||
array(
|
||||
'name' => 'wcj_purchase_date_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'date',
|
||||
'title' => '<em>' . __( '(Last) Purchase date', 'woocommerce-jetpack' ) . '</em>',
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_purchase_date',
|
||||
'enabled' => get_option( 'wcj_purchase_date_enabled', 'yes' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_purchase_partner_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'text',
|
||||
'title' => '<em>' . __( 'Seller', 'woocommerce-jetpack' ) . '</em>',
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_purchase_partner',
|
||||
'enabled' => get_option( 'wcj_purchase_partner_enabled', 'yes' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_purchase_info_' . $product_id,
|
||||
'default' => '',
|
||||
'type' => 'textarea',
|
||||
'title' => '<em>' . __( 'Purchase info', 'woocommerce-jetpack' ) . '</em>',
|
||||
'desc' => $desc,
|
||||
'product_id' => $product_id,
|
||||
'meta_name' => '_' . 'wcj_purchase_info',
|
||||
'enabled' => get_option( 'wcj_purchase_info_enabled', 'yes' ),
|
||||
),
|
||||
) );
|
||||
$product_options = apply_filters( 'wcj_purchase_data_product_options', $product_options, $product_id, $desc );
|
||||
$options = array_merge( $options, $product_options );
|
||||
}
|
||||
return $options;
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Related Products
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$product_id = get_the_ID();
|
||||
$products = wcj_get_products( array(), 'publish' );
|
||||
unset( $products[ $product_id ] );
|
||||
$options = array(
|
||||
array(
|
||||
'title' => __( 'Enable', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'If enabled and no products selected - will hide related products section on frontend for current product.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_info_related_products_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Related Products', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Hold Control (Ctrl) key to select multiple products.', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_product_info_related_products_ids',
|
||||
'default' => '',
|
||||
'type' => 'select',
|
||||
'options' => $products,
|
||||
'multiple' => true,
|
||||
'css' => 'height:300px;',
|
||||
),
|
||||
);
|
||||
return $options;
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Sale Flash
|
||||
*
|
||||
* @version 3.2.4
|
||||
* @since 3.2.4
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
return array(
|
||||
array(
|
||||
'title' => __( 'Enable', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_sale_flash_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => __( 'HTML', 'woocommerce-jetpack' ),
|
||||
'name' => 'wcj_sale_flash',
|
||||
'default' => '<span class="onsale">' . __( 'Sale!', 'woocommerce' ) . '</span>',
|
||||
'type' => 'textarea',
|
||||
'css' => 'width:100%;min-height:100px;',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* Booster for WooCommerce - Settings Meta Box - Wholesale Price
|
||||
*
|
||||
* @version 2.8.0
|
||||
* @since 2.8.0
|
||||
* @author Algoritmika Ltd.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$product_id = get_the_ID();
|
||||
$_product = wc_get_product( $product_id );
|
||||
if ( ! $_product ) {
|
||||
return array();
|
||||
}
|
||||
$discount_type_options = array(
|
||||
'percent' => __( 'Percent', 'woocommerce-jetpack' ),
|
||||
'fixed' => __( 'Fixed', 'woocommerce-jetpack' ),
|
||||
'price_directly' => __( 'Price directly', 'woocommerce-jetpack' ),
|
||||
);
|
||||
if ( $_product->is_type( 'variable' ) ) {
|
||||
unset( $discount_type_options['price_directly'] );
|
||||
}
|
||||
$options = array(
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_per_product_enabled',
|
||||
'default' => 'no',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes', 'woocommerce-jetpack' ),
|
||||
'no' => __( 'No', 'woocommerce-jetpack' ),
|
||||
),
|
||||
'title' => __( 'Enable per Product Levels', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_discount_type',
|
||||
'default' => 'percent',
|
||||
'type' => 'select',
|
||||
'options' => $discount_type_options,
|
||||
'title' => __( 'Discount Type', 'woocommerce-jetpack' ),
|
||||
// 'tooltip' => __( '\'Price directly\' option is only available for simple (i.e. non variable) product type.', 'woocommerce-jetpack' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_levels_number',
|
||||
'default' => 0,
|
||||
'type' => 'number',
|
||||
'title' => __( 'Number of levels', 'woocommerce-jetpack' ),
|
||||
'tooltip' => __( 'Save product after you change this number.', 'woocommerce-jetpack' ) . apply_filters( 'booster_option', ' ' . __( 'Free Booster\'s version is limited to one level maximum. Please visit https://booster.io to get full version.', 'woocommerce-jetpack' ), '' ),
|
||||
'custom_attributes' => 'min="0" max="' . apply_filters( 'booster_option', 1, 1000 ) . '"',
|
||||
),
|
||||
);
|
||||
for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_post_meta( $product_id, '_' . 'wcj_wholesale_price_levels_number', true ) ); $i++ ) {
|
||||
$options = array_merge( $options, array(
|
||||
/*
|
||||
array(
|
||||
'type' => 'title',
|
||||
'title' => __( 'Level', 'woocommerce-jetpack' ) . ' #' . $i,
|
||||
),
|
||||
*/
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_level_min_qty_' . $i,
|
||||
'default' => 0,
|
||||
'type' => 'number',
|
||||
'title' => __( 'Level', 'woocommerce-jetpack' ) . ' #' . $i . ' ' . __( 'Min quantity', 'woocommerce-jetpack' ),
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_level_discount_' . $i,
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'Level', 'woocommerce-jetpack' ) . ' #' . $i . ' ' . ( 'price_directly' === get_post_meta( $product_id, '_' . 'wcj_wholesale_price_discount_type', true ) ? __( 'Price', 'woocommerce-jetpack' ) : __( 'Discount', 'woocommerce-jetpack' ) ),
|
||||
),
|
||||
) );
|
||||
}
|
||||
$user_roles = get_option( 'wcj_wholesale_price_by_user_role_roles', '' );
|
||||
if ( ! empty( $user_roles ) ) {
|
||||
foreach ( $user_roles as $user_role_key ) {
|
||||
$options = array_merge( $options, array(
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_levels_number_' . $user_role_key,
|
||||
'default' => 0,
|
||||
'type' => 'number',
|
||||
'title' => __( 'Number of levels', 'woocommerce-jetpack' ) . ' [' . $user_role_key . ']',
|
||||
'tooltip' => __( 'Save product after you change this number.', 'woocommerce-jetpack' ) . apply_filters( 'booster_option', ' ' . __( 'Free Booster\'s version is limited to one level maximum. Please visit https://booster.io to get full version.', 'woocommerce-jetpack' ), '' ),
|
||||
'custom_attributes' => 'min="0" max="' . apply_filters( 'booster_option', 1, 1000 ) . '"',
|
||||
),
|
||||
) );
|
||||
for ( $i = 1; $i <= apply_filters( 'booster_option', 1, get_post_meta( $product_id, '_' . 'wcj_wholesale_price_levels_number_' . $user_role_key, true ) ); $i++ ) {
|
||||
$options = array_merge( $options, array(
|
||||
/*
|
||||
array(
|
||||
'type' => 'title',
|
||||
'title' => __( 'Level', 'woocommerce-jetpack' ) . ' #' . $i,
|
||||
),
|
||||
*/
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_level_min_qty_' . $user_role_key . '_' . $i,
|
||||
'default' => 0,
|
||||
'type' => 'number',
|
||||
'title' => __( 'Level', 'woocommerce-jetpack' ) . ' #' . $i . ' ' . __( 'Min quantity', 'woocommerce-jetpack' ) . ' [' . $user_role_key . ']',
|
||||
'custom_attributes' => 'min="0"',
|
||||
),
|
||||
array(
|
||||
'name' => 'wcj_wholesale_price_level_discount_' . $user_role_key . '_' . $i,
|
||||
'default' => 0,
|
||||
'type' => 'price',
|
||||
'title' => __( 'Level', 'woocommerce-jetpack' ) . ' #' . $i . ' ' . __( 'Discount', 'woocommerce-jetpack' ) . ' [' . $user_role_key . ']',
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
Reference in New Issue
Block a user