| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Frequently Bought Together Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
// Settings |
| 14 |
Merchant_Admin_Options::create( array( |
| 15 |
'title' => __( 'Settings', 'merchant' ), |
| 16 |
'module' => Merchant_Frequently_Bought_Together::MODULE_ID, |
| 17 |
'fields' => array( |
| 18 |
array( |
| 19 |
'id' => 'single_product_placement', |
| 20 |
'type' => 'select', |
| 21 |
'title' => __( 'Placement on product page', 'merchant' ), |
| 22 |
'options' => array( |
| 23 |
'after-summary' => __( 'After product summary', 'merchant' ), |
| 24 |
'after-tabs' => __( 'After product tabs', 'merchant' ), |
| 25 |
'bottom' => __( 'At the bottom', 'merchant' ), |
| 26 |
), |
| 27 |
'default' => 'after-summary', |
| 28 |
), |
| 29 |
), |
| 30 |
) ); |
| 31 |
|
| 32 |
// Text Formatting Settings |
| 33 |
Merchant_Admin_Options::create( array( |
| 34 |
'title' => __( 'Text Formatting Settings', 'merchant' ), |
| 35 |
'module' => Merchant_Frequently_Bought_Together::MODULE_ID, |
| 36 |
'fields' => array( |
| 37 |
array( |
| 38 |
'id' => 'title', |
| 39 |
'type' => 'text', |
| 40 |
'title' => __( 'Title', 'merchant' ), |
| 41 |
'default' => __( 'Frequently Bought Together', 'merchant' ), |
| 42 |
), |
| 43 |
|
| 44 |
array( |
| 45 |
'id' => 'price_label', |
| 46 |
'type' => 'text', |
| 47 |
'title' => __( 'Price label', 'merchant' ), |
| 48 |
'default' => __( 'Bundle price', 'merchant' ), |
| 49 |
), |
| 50 |
|
| 51 |
array( |
| 52 |
'id' => 'save_label', |
| 53 |
'type' => 'text', |
| 54 |
'title' => __( 'You save label', 'merchant' ), |
| 55 |
'default' => __( 'You save: {amount}', 'merchant' ), |
| 56 |
), |
| 57 |
|
| 58 |
array( |
| 59 |
'id' => 'no_variation_selected_text', |
| 60 |
'type' => 'text', |
| 61 |
'title' => __( 'No variation selected text', 'merchant' ), |
| 62 |
'default' => __( 'Please select an option to see your savings.', 'merchant' ), |
| 63 |
), |
| 64 |
|
| 65 |
array( |
| 66 |
'id' => 'no_variation_selected_text_has_no_discount', |
| 67 |
'type' => 'text', |
| 68 |
'title' => __( 'No variation selected text (no discount)', 'merchant' ), |
| 69 |
'desc' => __( 'This text will be displayed whether the bundle has 0% discount and contains a variable product.', 'merchant' ), |
| 70 |
'default' => __( 'Please select an option to see the total price.', 'merchant' ), |
| 71 |
), |
| 72 |
|
| 73 |
array( |
| 74 |
'id' => 'button_text', |
| 75 |
'type' => 'text', |
| 76 |
'title' => __( 'Button text', 'merchant' ), |
| 77 |
'default' => __( 'Add to cart', 'merchant' ), |
| 78 |
), |
| 79 |
), |
| 80 |
) ); |
| 81 |
|
| 82 |
// Style Settings |
| 83 |
Merchant_Admin_Options::create( array( |
| 84 |
'module' => Merchant_Frequently_Bought_Together::MODULE_ID, |
| 85 |
'title' => __( 'Style Settings', 'merchant' ), |
| 86 |
'fields' => array( |
| 87 |
|
| 88 |
array( |
| 89 |
'id' => 'plus_bg_color', |
| 90 |
'type' => 'color', |
| 91 |
'title' => esc_html__( 'Plus sign background color', 'merchant' ), |
| 92 |
'default' => '#212121', |
| 93 |
), |
| 94 |
|
| 95 |
array( |
| 96 |
'id' => 'plus_text_color', |
| 97 |
'type' => 'color', |
| 98 |
'title' => esc_html__( 'Plus sign text color', 'merchant' ), |
| 99 |
'default' => '#fff', |
| 100 |
), |
| 101 |
|
| 102 |
array( |
| 103 |
'id' => 'bundle_border_color', |
| 104 |
'type' => 'color', |
| 105 |
'title' => esc_html__( 'Bundle border color', 'merchant' ), |
| 106 |
'default' => '#f9f9f9', |
| 107 |
), |
| 108 |
|
| 109 |
array( |
| 110 |
'id' => 'bundle_border_radius', |
| 111 |
'type' => 'range', |
| 112 |
'title' => __( 'Bundle border radius', 'merchant' ), |
| 113 |
'min' => 0, |
| 114 |
'max' => 100, |
| 115 |
'step' => 1, |
| 116 |
'unit' => 'px', |
| 117 |
'default' => 5, |
| 118 |
), |
| 119 |
), |
| 120 |
) ); |
| 121 |
|
| 122 |
// Shortcode |
| 123 |
$merchant_module_id = Merchant_Frequently_Bought_Together::MODULE_ID; |
| 124 |
Merchant_Admin_Options::create( array( |
| 125 |
'module' => $merchant_module_id, |
| 126 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 127 |
'fields' => array( |
| 128 |
array( |
| 129 |
'id' => 'use_shortcode', |
| 130 |
'type' => 'switcher', |
| 131 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 132 |
'default' => 0, |
| 133 |
'desc' => 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.', |
| 134 |
'merchant' ), |
| 135 |
), |
| 136 |
array( |
| 137 |
'id' => 'shortcode_text', |
| 138 |
'type' => 'text_readonly', |
| 139 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 140 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 141 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 142 |
), |
| 143 |
), |
| 144 |
) ); |