| 1 |
<?php |
| 2 |
/** |
| 3 |
* Merchant Buy Now |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
/** |
| 11 |
* Settings |
| 12 |
*/ |
| 13 |
Merchant_Admin_Options::create( array( |
| 14 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 15 |
'module' => 'buy-now', |
| 16 |
'fields' => array( |
| 17 |
|
| 18 |
array( |
| 19 |
'id' => 'button-text', |
| 20 |
'type' => 'text', |
| 21 |
'title' => esc_html__( 'Button text', 'merchant' ), |
| 22 |
'default' => esc_html__( 'Buy Now', 'merchant' ), |
| 23 |
), |
| 24 |
|
| 25 |
// Customize The Button or Inherit from Themes. |
| 26 |
array( |
| 27 |
'id' => 'customize-button', |
| 28 |
'type' => 'switcher', |
| 29 |
'title' => esc_html__( 'Customize Button', 'merchant' ), |
| 30 |
'default' => 1, |
| 31 |
), |
| 32 |
|
| 33 |
array( |
| 34 |
'id' => 'text-color', |
| 35 |
'type' => 'color', |
| 36 |
'title' => esc_html__( 'Button text color', 'merchant' ), |
| 37 |
'default' => '#ffffff', |
| 38 |
'condition' => array( 'customize-button', '==', true ), |
| 39 |
), |
| 40 |
|
| 41 |
array( |
| 42 |
'id' => 'text-hover-color', |
| 43 |
'type' => 'color', |
| 44 |
'title' => esc_html__( 'Button text color hover', 'merchant' ), |
| 45 |
'default' => '#ffffff', |
| 46 |
'condition' => array( 'customize-button', '==', true ), |
| 47 |
), |
| 48 |
|
| 49 |
array( |
| 50 |
'id' => 'border-color', |
| 51 |
'type' => 'color', |
| 52 |
'title' => esc_html__( 'Button border color', 'merchant' ), |
| 53 |
'default' => '#212121', |
| 54 |
'condition' => array( 'customize-button', '==', true ), |
| 55 |
), |
| 56 |
|
| 57 |
array( |
| 58 |
'id' => 'border-hover-color', |
| 59 |
'type' => 'color', |
| 60 |
'title' => esc_html__( 'Button border color hover', 'merchant' ), |
| 61 |
'default' => '#414141', |
| 62 |
'condition' => array( 'customize-button', '==', true ), |
| 63 |
), |
| 64 |
|
| 65 |
array( |
| 66 |
'id' => 'background-color', |
| 67 |
'type' => 'color', |
| 68 |
'title' => esc_html__( 'Button background color', 'merchant' ), |
| 69 |
'default' => '#212121', |
| 70 |
'condition' => array( 'customize-button', '==', true ), |
| 71 |
), |
| 72 |
|
| 73 |
array( |
| 74 |
'id' => 'background-hover-color', |
| 75 |
'type' => 'color', |
| 76 |
'title' => esc_html__( 'Button background color hover', 'merchant' ), |
| 77 |
'default' => '#414141', |
| 78 |
'condition' => array( 'customize-button', '==', true ), |
| 79 |
), |
| 80 |
|
| 81 |
array( |
| 82 |
'id' => 'font-size', |
| 83 |
'type' => 'range', |
| 84 |
'title' => esc_html__( 'Font size', 'merchant' ), |
| 85 |
'min' => 1, |
| 86 |
'max' => 100, |
| 87 |
'step' => 1, |
| 88 |
'default' => 16, |
| 89 |
'unit' => 'px', |
| 90 |
'condition' => array( 'customize-button', '==', true ), |
| 91 |
), |
| 92 |
|
| 93 |
array( |
| 94 |
'id' => 'padding_top_bottom', |
| 95 |
'type' => 'range', |
| 96 |
'title' => esc_html__( 'Padding Top/Bottom', 'merchant' ), |
| 97 |
'min' => 0, |
| 98 |
'max' => 100, |
| 99 |
'step' => 1, |
| 100 |
'default' => 12, |
| 101 |
'unit' => 'px', |
| 102 |
'condition' => array( 'customize-button', '==', true ), |
| 103 |
), |
| 104 |
|
| 105 |
array( |
| 106 |
'id' => 'padding_left_right', |
| 107 |
'type' => 'range', |
| 108 |
'title' => esc_html__( 'Padding Left/Right', 'merchant' ), |
| 109 |
'min' => 0, |
| 110 |
'max' => 100, |
| 111 |
'step' => 1, |
| 112 |
'default' => 24, |
| 113 |
'unit' => 'px', |
| 114 |
'condition' => array( 'customize-button', '==', true ), |
| 115 |
), |
| 116 |
|
| 117 |
array( |
| 118 |
'id' => 'border-radius', |
| 119 |
'type' => 'range', |
| 120 |
'title' => esc_html__( 'Border radius', 'merchant' ), |
| 121 |
'min' => 0, |
| 122 |
'max' => 35, |
| 123 |
'step' => 1, |
| 124 |
'unit' => 'px', |
| 125 |
'default' => 0, |
| 126 |
'condition' => array( 'customize-button', '==', true ), |
| 127 |
), |
| 128 |
|
| 129 |
), |
| 130 |
) ); |
| 131 |
|
| 132 |
// Display Settings |
| 133 |
Merchant_Admin_Options::create( array( |
| 134 |
'module' => 'buy-now', |
| 135 |
'title' => esc_html__( 'Display Settings', 'merchant' ), |
| 136 |
'fields' => array( |
| 137 |
|
| 138 |
array( |
| 139 |
'id' => 'display-archive', |
| 140 |
'type' => 'checkbox', |
| 141 |
'title' => __( 'Show on product archive', 'merchant' ), |
| 142 |
'default' => 1, |
| 143 |
), |
| 144 |
array( |
| 145 |
'id' => 'display-product', |
| 146 |
'type' => 'checkbox', |
| 147 |
'title' => __( 'Show on single product page', 'merchant' ), |
| 148 |
'default' => 1, |
| 149 |
), |
| 150 |
array( |
| 151 |
'id' => 'display-upsell-related', |
| 152 |
'type' => 'checkbox', |
| 153 |
'title' => __( 'Show on upsell and related products', 'merchant' ), |
| 154 |
'default' => 1, |
| 155 |
), |
| 156 |
|
| 157 |
// Loading position/priority on shop archive. |
| 158 |
array( |
| 159 |
'id' => 'hook-order-shop-archive', |
| 160 |
'type' => 'hook_select', |
| 161 |
'title' => __( 'Loading position and priority on shop archive', 'merchant' ), |
| 162 |
'desc' => __( 'Note: This is a developer level feature. The buy now button module is "hooked" into a specific location on the shop archive pages. Themes and other plugins might also add additional elements to the same location. By modifying the loading postiion and priority, you have the ability to customize the placement of this element on that particular location. A lower number = a higher priority, so the module will appear higher on the page.', 'merchant' ), |
| 163 |
'options' => array( |
| 164 |
'woocommerce_before_shop_loop_item' => __( 'Before shop loop item', 'merchant' ), |
| 165 |
'woocommerce_before_shop_loop_item_title' => __( 'Before shop loop item title', 'merchant' ), |
| 166 |
'woocommerce_shop_loop_item_title' => __( 'Shop loop item title', 'merchant' ), |
| 167 |
'woocommerce_after_shop_loop_item_title' => __( 'After shop loop item title', 'merchant' ), |
| 168 |
'woocommerce_after_shop_loop_item' => __( 'After shop loop item', 'merchant' ), |
| 169 |
), |
| 170 |
'min' => -999, |
| 171 |
'max' => 999, |
| 172 |
'step' => 1, |
| 173 |
'unit' => '', |
| 174 |
'order' => true, |
| 175 |
'default' => array( |
| 176 |
'hook_name' => 'woocommerce_after_shop_loop_item', |
| 177 |
'hook_priority' => 10, |
| 178 |
), |
| 179 |
), |
| 180 |
|
| 181 |
// Loading position/priority on single product. |
| 182 |
array( |
| 183 |
'id' => 'hook-order-single-product', |
| 184 |
'type' => 'hook_select', |
| 185 |
'title' => __( 'Loading position and priority on single product', 'merchant' ), |
| 186 |
'desc' => __( 'Note: This is a developer level feature. The buy now button module is "hooked" into a specific location on the single product pages. Themes and other plugins might also add additional elements to the same location. By modifying the loading postiion and priority, you have the ability to customize the placement of this element on that particular location. A lower number = a higher priority, so the module will appear higher on the page.', 'merchant' ), |
| 187 |
'options' => array( |
| 188 |
'woocommerce_before_add_to_cart_button' => __( 'Before add to cart button', 'merchant' ), |
| 189 |
'woocommerce_after_add_to_cart_button' => __( 'After add to cart button', 'merchant' ), |
| 190 |
'woocommerce_before_add_to_cart_quantity' => __( 'Before add to cart quantity', 'merchant' ), |
| 191 |
'woocommerce_after_add_to_cart_quantity' => __( 'After add to cart quantity', 'merchant' ), |
| 192 |
), |
| 193 |
'min' => -999, |
| 194 |
'max' => 999, |
| 195 |
'step' => 1, |
| 196 |
'unit' => '', |
| 197 |
'order' => true, |
| 198 |
'default' => array( |
| 199 |
'hook_name' => 'woocommerce_after_add_to_cart_button', |
| 200 |
'hook_priority' => 10, |
| 201 |
), |
| 202 |
), |
| 203 |
), |
| 204 |
) ); |