← All changes
|
includes/elementor/modules/checkout/widgets/settings-controls.php
+97
-8
1.2.1
→
2.7.0
View file →
| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | defined( 'ABSPATH' ) || die(); |
| 6 | 6 | |
| 7 | 7 | use Elementor\Settings; |
| 8 | +use Elementor\Plugin; | |
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * Checkout settings controls. |
| 11 | 12 | * |
| @@ -32,11 +33,13 @@ | ||
| 32 | 33 | 'shipping_city' => esc_html__( 'Shipping City', 'sellkit' ), |
| 33 | 34 | 'shipping_postcode' => esc_html__( 'Shipping Postcode', 'sellkit' ), |
| 34 | 35 | 'shipping_country' => esc_html__( 'Shipping Country', 'sellkit' ), |
| 35 | 36 | 'shipping_state' => esc_html__( 'Shipping State', 'sellkit' ), |
| 37 | + 'custom_field_pro' => esc_html__( 'Custom Field (Sellkit Pro)', 'sellkit' ), | |
| 36 | 38 | ]; |
| 37 | 39 | |
| 38 | 40 | if ( sellkit()->has_pro ) { |
| 41 | + unset( $fields['custom_field_pro'] ); | |
| 39 | 42 | $fields = \Sellkit_Elementor_Checkout_Pro_Module::checkout_custom_fields( $fields ); |
| 40 | 43 | } |
| 41 | 44 | |
| 42 | 45 | return $fields; |
| @@ -53,11 +56,13 @@ | ||
| 53 | 56 | 'billing_postcode' => esc_html__( 'Billing Postcode', 'sellkit' ), |
| 54 | 57 | 'billing_country' => esc_html__( 'Billing Country', 'sellkit' ), |
| 55 | 58 | 'billing_state' => esc_html__( 'Billing State', 'sellkit' ), |
| 56 | 59 | 'billing_phone' => esc_html__( 'Billing Phone', 'sellkit' ), |
| 60 | + 'custom_field_pro' => esc_html__( 'Custom Field (Sellkit Pro)', 'sellkit' ), | |
| 57 | 61 | ]; |
| 58 | 62 | |
| 59 | 63 | if ( sellkit()->has_pro ) { |
| 64 | + unset( $fields['custom_field_pro'] ); | |
| 60 | 65 | $fields = \Sellkit_Elementor_Checkout_Pro_Module::checkout_custom_fields( $fields ); |
| 61 | 66 | } |
| 62 | 67 | |
| 63 | 68 | return $fields; |
| @@ -154,20 +159,34 @@ | ||
| 154 | 159 | ); |
| 155 | 160 | |
| 156 | 161 | if ( sellkit()->has_pro ) { |
| 157 | 162 | \Sellkit_Elementor_Checkout_Pro_Module::express_checkout_control( $this ); |
| 163 | + } else { | |
| 164 | + $this->add_control( | |
| 165 | + 'show_express_checkout_promotions', | |
| 166 | + [ | |
| 167 | + 'label' => esc_html__( 'Express Checkout', 'sellkit' ), | |
| 168 | + 'classes' => 'elementor-control-checkout-express-promotion', | |
| 169 | + 'type' => 'switcher', | |
| 170 | + 'label_on' => esc_html__( 'Show', 'sellkit' ), | |
| 171 | + 'label_off' => esc_html__( 'Hide', 'sellkit' ), | |
| 172 | + 'return_value' => 'yes', | |
| 173 | + 'default' => 'no', | |
| 174 | + ] | |
| 175 | + ); | |
| 158 | 176 | } |
| 159 | 177 | |
| 160 | 178 | $this->add_control( |
| 161 | 179 | 'show_sticky_cart_details', |
| 162 | 180 | [ |
| 163 | - 'label' => esc_html__( 'Checkout Sticky Cart', 'sellkit' ), | |
| 164 | - 'type' => 'switcher', | |
| 165 | - 'label_on' => esc_html__( 'Show', 'sellkit' ), | |
| 166 | - 'label_off' => esc_html__( 'Hide', 'sellkit' ), | |
| 181 | + 'label' => esc_html__( 'Checkout Sticky Cart', 'sellkit' ), | |
| 182 | + 'type' => 'switcher', | |
| 183 | + 'frontend_available' => true, | |
| 184 | + 'label_on' => esc_html__( 'Show', 'sellkit' ), | |
| 185 | + 'label_off' => esc_html__( 'Hide', 'sellkit' ), | |
| 167 | 186 | 'return_value' => 'yes', |
| 168 | - 'default' => 'yes', | |
| 169 | - 'condition' => [ | |
| 187 | + 'default' => 'yes', | |
| 188 | + 'condition' => [ | |
| 170 | 189 | 'layout-type' => 'multi-step', |
| 171 | 190 | ], |
| 172 | 191 | ] |
| 173 | 192 | ); |
| @@ -172,8 +191,21 @@ | ||
| 172 | 191 | ] |
| 173 | 192 | ); |
| 174 | 193 | |
| 175 | 194 | $this->add_control( |
| 195 | + 'sticky_cart_offset', | |
| 196 | + [ | |
| 197 | + 'label' => esc_html__( 'Offset', 'sellkit' ), | |
| 198 | + 'type' => 'number', | |
| 199 | + 'frontend_available' => true, | |
| 200 | + 'condition' => [ | |
| 201 | + 'layout-type' => 'multi-step', | |
| 202 | + 'show_sticky_cart_details' => 'yes', | |
| 203 | + ], | |
| 204 | + ] | |
| 205 | + ); | |
| 206 | + | |
| 207 | + $this->add_control( | |
| 176 | 208 | 'place_order_btn_txt', |
| 177 | 209 | [ |
| 178 | 210 | 'label' => esc_html__( 'Place Order Button Text', 'sellkit' ), |
| 179 | 211 | 'type' => 'text', |
| @@ -184,12 +216,69 @@ | ||
| 184 | 216 | |
| 185 | 217 | $this->end_controls_section(); |
| 186 | 218 | } |
| 187 | 219 | |
| 220 | + public function get_template( $texts ) { | |
| 221 | + ob_start(); | |
| 222 | + ?> | |
| 223 | + <div class="elementor-nerd-box"> | |
| 224 | + <span class="sellkit-checkout-promotion-rocket"></span> | |
| 225 | + <div class="sellkit-checkout-autocomplete-promotion-title"><?php echo esc_html( $texts['title'] ); ?></div> | |
| 226 | + <?php foreach ( $texts['messages'] as $message ) { ?> | |
| 227 | + <div class="sellkit-checkout-promotion-message"><?php echo wp_kses_post( $message ); ?></div> | |
| 228 | + <?php } | |
| 229 | + | |
| 230 | + // Show a `Go Pro` button only if the user doesn't have Pro. | |
| 231 | + if ( $texts['link'] ) { ?> | |
| 232 | + <a | |
| 233 | + class="sellkit-checkout-autocomplete-promotion-btn" | |
| 234 | + href="https://getsellkit.com/pricing/" | |
| 235 | + target="_blank" | |
| 236 | + > | |
| 237 | + <?php echo esc_html__( 'Upgrade Now', 'sellkit' ); ?> | |
| 238 | + </a> | |
| 239 | + <?php } ?> | |
| 240 | + </div> | |
| 241 | + <?php | |
| 242 | + | |
| 243 | + return ob_get_clean(); | |
| 244 | + } | |
| 245 | + | |
| 188 | 246 | private function google_autocomplete_settings() { |
| 189 | 247 | if ( sellkit()->has_pro ) { |
| 190 | 248 | \Sellkit_Elementor_Checkout_Pro_Module::google_address_autocomplete( $this ); |
| 249 | + return; | |
| 191 | 250 | } |
| 251 | + | |
| 252 | + $messages = [ | |
| 253 | + sprintf( | |
| 254 | + /* translators: 1: bold tag 2: bold tag */ | |
| 255 | + esc_html__( 'You are using a free version of Sellkit. Upgrade to %1$s Sellkit Pro %2$s to use this feature.', 'sellkit' ), | |
| 256 | + '<b>', | |
| 257 | + '</b>' | |
| 258 | + ), | |
| 259 | + ]; | |
| 260 | + | |
| 261 | + $this->start_controls_section( | |
| 262 | + 'google_autocomplete_settings', | |
| 263 | + [ | |
| 264 | + 'label' => esc_html__( 'Address Autocomplete', 'sellkit' ), | |
| 265 | + ] | |
| 266 | + ); | |
| 267 | + | |
| 268 | + $this->add_control( | |
| 269 | + 'sellkit_checkout_autocomplete_address_promotion', | |
| 270 | + [ | |
| 271 | + 'type' => 'raw_html', | |
| 272 | + 'raw' => $this->get_template( [ | |
| 273 | + 'title' => esc_html__( 'Upgrade to Sellkit Pro', 'sellkit' ), | |
| 274 | + 'messages' => $messages, | |
| 275 | + 'link' => 'https://getsellkit.com/pricing/', | |
| 276 | + ] ), | |
| 277 | + ] | |
| 278 | + ); | |
| 279 | + | |
| 280 | + $this->end_controls_section(); | |
| 192 | 281 | } |
| 193 | 282 | |
| 194 | 283 | private function coupon_form_visibility() { |
| 195 | 284 | $this->start_controls_section( |
| @@ -528,9 +617,9 @@ | ||
| 528 | 617 | 'shipping_list_required' => 'no', |
| 529 | 618 | 'shipping_list_clear' => 'no', |
| 530 | 619 | ], |
| 531 | 620 | ], |
| 532 | - 'title_field' => '{{{ shipping_list_field }}}', | |
| 621 | + 'title_field' => '{{{ shipping_list_placeholder }}}', | |
| 533 | 622 | ] |
| 534 | 623 | ); |
| 535 | 624 | |
| 536 | 625 | $this->end_controls_section(); |
| @@ -838,9 +927,9 @@ | ||
| 838 | 927 | 'billing_list_required' => 'no', |
| 839 | 928 | 'billing_list_clear' => 'no', |
| 840 | 929 | ], |
| 841 | 930 | ], |
| 842 | - 'title_field' => '{{{ billing_list_field }}}', | |
| 931 | + 'title_field' => '{{{ billing_list_placeholder }}}', | |
| 843 | 932 | ] |
| 844 | 933 | ); |
| 845 | 934 | |
| 846 | 935 | $this->end_controls_section(); |