| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Product bundles Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
/** |
| 14 |
* Hook functionality before including modules options. |
| 15 |
* |
| 16 |
* @since 1.9.8 |
| 17 |
*/ |
| 18 |
do_action( 'merchant_admin_before_include_modules_options', Merchant_Product_Bundles::MODULE_ID ); |
| 19 |
|
| 20 |
Merchant_Admin_Options::create( array( |
| 21 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 22 |
'title' => esc_html__( 'Product page settings', 'merchant' ), |
| 23 |
'fields' => array( |
| 24 |
|
| 25 |
array( |
| 26 |
'id' => 'price_range', |
| 27 |
'type' => 'switcher', |
| 28 |
'title' => __( 'Display bundle price as range for variable products', 'merchant' ), |
| 29 |
'desc' => __( 'Display a price range for bundles that include variable products.', 'merchant' ), |
| 30 |
'default' => '1', |
| 31 |
), |
| 32 |
|
| 33 |
array( |
| 34 |
'id' => 'bundled_thumb', |
| 35 |
'type' => 'switcher', |
| 36 |
'title' => __( 'Display bundled product thumbnails', 'merchant' ), |
| 37 |
'default' => '1', |
| 38 |
), |
| 39 |
|
| 40 |
array( |
| 41 |
'id' => 'bundled_description', |
| 42 |
'type' => 'switcher', |
| 43 |
'title' => __( 'Display bundled product descriptions', 'merchant' ), |
| 44 |
'default' => 0, |
| 45 |
), |
| 46 |
|
| 47 |
array( |
| 48 |
'id' => 'bundled_qty', |
| 49 |
'type' => 'switcher', |
| 50 |
'title' => __( 'Display bundled product quantities', 'merchant' ), |
| 51 |
'default' => '1', |
| 52 |
), |
| 53 |
|
| 54 |
array( |
| 55 |
'id' => 'bundled_link_single', |
| 56 |
'type' => 'switcher', |
| 57 |
'title' => __( 'Make bundled product thumbnails and titles clickable', 'merchant' ), |
| 58 |
'default' => '1', |
| 59 |
), |
| 60 |
|
| 61 |
array( |
| 62 |
'id' => 'bundled_price', |
| 63 |
'type' => 'select', |
| 64 |
'title' => __( 'Display the prices of bundled products', 'merchant' ), |
| 65 |
'options' => array( |
| 66 |
'price' => __( 'Price per unit', 'merchant' ), |
| 67 |
'subtotal' => __( 'Subtotal', 'merchant' ), |
| 68 |
'no' => __( 'Hide', 'merchant' ), |
| 69 |
), |
| 70 |
'default' => 'price', |
| 71 |
), |
| 72 |
|
| 73 |
array( |
| 74 |
'id' => 'bundled_price_from', |
| 75 |
'type' => 'select', |
| 76 |
'title' => __( 'Calculate the prices of bundled products based on', 'merchant' ), |
| 77 |
'options' => array( |
| 78 |
'regular_price' => __( 'Regular price', 'merchant' ), |
| 79 |
'sale_price' => __( 'Sale Price', 'merchant' ), |
| 80 |
), |
| 81 |
'default' => 'sale_price', |
| 82 |
), |
| 83 |
|
| 84 |
array( |
| 85 |
'id' => 'placement', |
| 86 |
'type' => 'select', |
| 87 |
'title' => __( 'Where to display the bundled products', 'merchant' ), |
| 88 |
'options' => array( |
| 89 |
'woocommerce_before_add_to_cart_form' => __( 'Before add to cart section', 'merchant' ), |
| 90 |
'woocommerce_after_add_to_cart_form' => __( 'After add to cart section', 'merchant' ), |
| 91 |
), |
| 92 |
'default' => 'before_form', |
| 93 |
), |
| 94 |
), |
| 95 |
) ); |
| 96 |
|
| 97 |
// Settings |
| 98 |
Merchant_Admin_Options::create( array( |
| 99 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 100 |
'title' => esc_html__( 'Cart settings', 'merchant' ), |
| 101 |
'fields' => array( |
| 102 |
array( |
| 103 |
'id' => 'hide_bundled_cart', |
| 104 |
'type' => 'switcher', |
| 105 |
'title' => __( 'Hide bundled products in cart', 'merchant' ), |
| 106 |
'default' => 0, |
| 107 |
), |
| 108 |
|
| 109 |
array( |
| 110 |
'id' => 'hide_bundled_mini_cart', |
| 111 |
'type' => 'switcher', |
| 112 |
'title' => __( 'Hide bundled products in mini cart', 'merchant' ), |
| 113 |
'default' => 0, |
| 114 |
), |
| 115 |
|
| 116 |
// array( |
| 117 |
// 'id' => '_woopq_decimal', |
| 118 |
// 'type' => 'switcher', |
| 119 |
// 'title' => __( 'Allow decimal product quantity', 'merchant' ), |
| 120 |
// 'default' => 0, |
| 121 |
// ), |
| 122 |
|
| 123 |
array( |
| 124 |
'id' => 'bundled_link', |
| 125 |
'type' => 'switcher', |
| 126 |
'title' => __( 'Include links to bundled products on cart page', 'merchant' ), |
| 127 |
'default' => '1', |
| 128 |
), |
| 129 |
|
| 130 |
array( |
| 131 |
'id' => 'cart_contents_count', |
| 132 |
'type' => 'select', |
| 133 |
'title' => __( 'Cart contents count will include', 'merchant' ), |
| 134 |
'options' => array( |
| 135 |
'bundle' => __( 'The bundle as one product', 'merchant' ), |
| 136 |
'both' => __( 'Both bundle and bundled products', 'merchant' ), |
| 137 |
), |
| 138 |
'default' => 'bundle', |
| 139 |
), |
| 140 |
|
| 141 |
array( |
| 142 |
'id' => 'hide_bundled', |
| 143 |
'type' => 'radio', |
| 144 |
'title' => __( 'Show bundled products', 'merchant' ), |
| 145 |
'options' => array( |
| 146 |
'text' => __( 'List inline', 'merchant' ), |
| 147 |
'list' => __( 'Bulleted list', 'merchant' ), |
| 148 |
), |
| 149 |
'default' => 'text', |
| 150 |
), |
| 151 |
), |
| 152 |
) ); |
| 153 |
|
| 154 |
Merchant_Admin_Options::create( array( |
| 155 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 156 |
'title' => esc_html__( 'Order email settings', 'merchant' ), |
| 157 |
'fields' => array( |
| 158 |
array( |
| 159 |
'id' => 'hide_bundled_order_email', |
| 160 |
'type' => 'switcher', |
| 161 |
'title' => __( 'Hide bundled products in order email', 'merchant' ), |
| 162 |
'default' => 0, |
| 163 |
), |
| 164 |
), |
| 165 |
) ); |
| 166 |
|
| 167 |
// Shortcode |
| 168 |
Merchant_Admin_Options::create( array( |
| 169 |
'module' => Merchant_Product_Bundles::MODULE_ID, |
| 170 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 171 |
'fields' => array( |
| 172 |
array( |
| 173 |
'id' => 'use_shortcode', |
| 174 |
'type' => 'switcher', |
| 175 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 176 |
'default' => 0, |
| 177 |
), |
| 178 |
array( |
| 179 |
'type' => 'info', |
| 180 |
'id' => 'shortcode_info', |
| 181 |
'content' => esc_html__( 'If you are using a page builder or a theme that supports shortcodes, then you can output the module using the shortcode above. This might be useful if, for example, you find that you want to control the position of the module output more precisely than with the module settings. Note that the shortcodes can only be used on single product pages.', |
| 182 |
'merchant' ), |
| 183 |
), |
| 184 |
array( |
| 185 |
'id' => 'shortcode_text', |
| 186 |
'type' => 'text_readonly', |
| 187 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 188 |
'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Product_Bundles::MODULE_ID ) . ']', |
| 189 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 190 |
), |
| 191 |
), |
| 192 |
) ); |