screens
2 years ago
checkout-form-shipping-config.php
4 years ago
checkout-form-shipping.php
1 week ago
checkout-form-shipping.php
796 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | use ShopEngine\Utils\Helper; |
| 6 | use ShopEngine\Widgets\Products; |
| 7 | |
| 8 | defined('ABSPATH') || exit; |
| 9 | |
| 10 | class ShopEngine_Checkout_Form_Shipping extends \ShopEngine\Base\Widget |
| 11 | { |
| 12 | |
| 13 | public function config() { |
| 14 | return new ShopEngine_Checkout_Form_Shipping_Config(); |
| 15 | } |
| 16 | |
| 17 | protected function register_controls() { |
| 18 | |
| 19 | $this->start_controls_section( |
| 20 | 'shopengine_section_layout', |
| 21 | [ |
| 22 | 'label' => esc_html__('Layout', 'shopengine'), |
| 23 | 'tab' => Controls_Manager::TAB_CONTENT |
| 24 | ] |
| 25 | ); |
| 26 | |
| 27 | $repeater = new Repeater(); |
| 28 | $this->add_control( |
| 29 | 'shopengine_shipping_inputs', |
| 30 | [ |
| 31 | 'label' => esc_html__('Input List', 'shopengine'), |
| 32 | 'type' => Controls_Manager::REPEATER, |
| 33 | 'fields' => $repeater->get_controls(), |
| 34 | 'default' => Helper::get_checkout_input_fields('shipping'), |
| 35 | 'title_field' => '{{{ list_title }}}', |
| 36 | 'item_actions' => [ |
| 37 | 'add' => false, |
| 38 | 'duplicate' => false, |
| 39 | 'remove' => false, |
| 40 | 'sort' => true |
| 41 | ] |
| 42 | ] |
| 43 | ); |
| 44 | |
| 45 | $this->end_controls_section(); |
| 46 | |
| 47 | /** |
| 48 | * Checkbox label title content |
| 49 | */ |
| 50 | $this->start_controls_section( |
| 51 | 'shopengine_checkout_shipping_form_general', |
| 52 | [ |
| 53 | 'label' => esc_html__('General', 'shopengine'), |
| 54 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 55 | ] |
| 56 | ); |
| 57 | |
| 58 | $this->add_control( |
| 59 | 'shopengine_checkout_shipping_form_title', |
| 60 | [ |
| 61 | 'label' => esc_html__('Form Title', 'shopengine'), |
| 62 | 'description' => esc_html__('Title for the checkout shipping form', 'shopengine'), |
| 63 | 'type' => Controls_Manager::TEXT, |
| 64 | 'separator' => 'after', |
| 65 | 'label_block' => true, |
| 66 | ] |
| 67 | ); |
| 68 | $this->end_controls_section(); |
| 69 | |
| 70 | /*================================ |
| 71 | Checkout Form Visibility Start |
| 72 | |
| 73 | - shopengine_hide_shipping_first_name_field |
| 74 | - shopengine_hide_shipping_last_name_field |
| 75 | - shopengine_hide_shipping_company_field |
| 76 | - shopengine_hide_shipping_country_field |
| 77 | - shopengine_hide_shipping_address_1_field |
| 78 | - shopengine_hide_shipping_address_2_field |
| 79 | - shopengine_hide_shipping_city_field |
| 80 | - shopengine_hide_shipping_state_field |
| 81 | - shopengine_hide_shipping_postcode_field |
| 82 | |
| 83 | ==================================*/ |
| 84 | |
| 85 | $this->start_controls_section( |
| 86 | 'shopengine_checkout_form_visibility', |
| 87 | [ |
| 88 | 'label' => esc_html__('Field Visibility', 'shopengine'), |
| 89 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 90 | ] |
| 91 | ); |
| 92 | |
| 93 | $this->add_control( |
| 94 | 'shopengine_hide_shipping_first_name_field', |
| 95 | [ |
| 96 | 'label' => esc_html__('Hide First Name', 'shopengine'), |
| 97 | 'type' => Controls_Manager::SWITCHER, |
| 98 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 99 | 'label_off' => esc_html__('No', 'shopengine'), |
| 100 | 'return_value' => 'yes', |
| 101 | 'selectors' => [ |
| 102 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_first_name_field' => 'display: none;', |
| 103 | ], |
| 104 | ] |
| 105 | ); |
| 106 | |
| 107 | $this->add_control( |
| 108 | 'shopengine_hide_shipping_last_name_field', |
| 109 | [ |
| 110 | 'label' => esc_html__('Hide Last Name', 'shopengine'), |
| 111 | 'type' => Controls_Manager::SWITCHER, |
| 112 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 113 | 'label_off' => esc_html__('No', 'shopengine'), |
| 114 | 'return_value' => 'yes', |
| 115 | 'selectors' => [ |
| 116 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_last_name_field' => 'display: none;', |
| 117 | ], |
| 118 | ] |
| 119 | ); |
| 120 | |
| 121 | $this->add_control( |
| 122 | 'shopengine_hide_shipping_company_field', |
| 123 | [ |
| 124 | 'label' => esc_html__('Hide Company Name', 'shopengine'), |
| 125 | 'type' => Controls_Manager::SWITCHER, |
| 126 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 127 | 'label_off' => esc_html__('No', 'shopengine'), |
| 128 | 'return_value' => 'yes', |
| 129 | 'selectors' => [ |
| 130 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_company_field' => 'display: none;', |
| 131 | ], |
| 132 | ] |
| 133 | ); |
| 134 | |
| 135 | $this->add_control( |
| 136 | 'shopengine_hide_shipping_country_field', |
| 137 | [ |
| 138 | 'label' => esc_html__('Hide Country/Region Name', 'shopengine'), |
| 139 | 'type' => Controls_Manager::SWITCHER, |
| 140 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 141 | 'label_off' => esc_html__('No', 'shopengine'), |
| 142 | 'return_value' => 'yes', |
| 143 | 'selectors' => [ |
| 144 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_country_field' => 'display: none;', |
| 145 | ], |
| 146 | ] |
| 147 | ); |
| 148 | |
| 149 | $this->add_control( |
| 150 | 'shopengine_hide_shipping_address_1_field', |
| 151 | [ |
| 152 | 'label' => esc_html__('Hide Street Address 1', 'shopengine'), |
| 153 | 'type' => Controls_Manager::SWITCHER, |
| 154 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 155 | 'label_off' => esc_html__('No', 'shopengine'), |
| 156 | 'return_value' => 'yes', |
| 157 | 'selectors' => [ |
| 158 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_address_1_field' => 'display: none;', |
| 159 | ], |
| 160 | ] |
| 161 | ); |
| 162 | |
| 163 | $this->add_control( |
| 164 | 'shopengine_hide_shipping_address_2_field', |
| 165 | [ |
| 166 | 'label' => esc_html__('Hide Street Address 2', 'shopengine'), |
| 167 | 'type' => Controls_Manager::SWITCHER, |
| 168 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 169 | 'label_off' => esc_html__('No', 'shopengine'), |
| 170 | 'return_value' => 'yes', |
| 171 | 'selectors' => [ |
| 172 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_address_2_field' => 'display: none;', |
| 173 | ], |
| 174 | ] |
| 175 | ); |
| 176 | |
| 177 | $this->add_control( |
| 178 | 'shopengine_hide_shipping_city_field', |
| 179 | [ |
| 180 | 'label' => esc_html__('Hide town/city', 'shopengine'), |
| 181 | 'type' => Controls_Manager::SWITCHER, |
| 182 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 183 | 'label_off' => esc_html__('No', 'shopengine'), |
| 184 | 'return_value' => 'yes', |
| 185 | 'selectors' => [ |
| 186 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_city_field' => 'display: none;', |
| 187 | ], |
| 188 | ] |
| 189 | ); |
| 190 | |
| 191 | |
| 192 | $this->add_control( |
| 193 | 'shopengine_hide_shipping_state_field', |
| 194 | [ |
| 195 | 'label' => esc_html__('Hide state', 'shopengine'), |
| 196 | 'type' => Controls_Manager::SWITCHER, |
| 197 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 198 | 'label_off' => esc_html__('No', 'shopengine'), |
| 199 | 'return_value' => 'yes', |
| 200 | 'selectors' => [ |
| 201 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_state_field' => 'display: none;', |
| 202 | ], |
| 203 | ] |
| 204 | ); |
| 205 | |
| 206 | $this->add_control( |
| 207 | 'shopengine_hide_shipping_postcode_field', |
| 208 | [ |
| 209 | 'label' => esc_html__('Hide ZIP/Postcode', 'shopengine'), |
| 210 | 'type' => Controls_Manager::SWITCHER, |
| 211 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 212 | 'label_off' => esc_html__('No', 'shopengine'), |
| 213 | 'return_value' => 'yes', |
| 214 | 'selectors' => [ |
| 215 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields #shipping_postcode_field' => 'display: none;', |
| 216 | ], |
| 217 | ] |
| 218 | ); |
| 219 | |
| 220 | |
| 221 | $this->end_controls_section(); |
| 222 | /*================================ |
| 223 | Checkout Form Visibility end |
| 224 | ==================================*/ |
| 225 | |
| 226 | /** |
| 227 | * Checkbox label title |
| 228 | */ |
| 229 | $this->start_controls_section( |
| 230 | 'shopengine_title_section', |
| 231 | [ |
| 232 | 'label' => esc_html__('Checkbox Title', 'shopengine'), |
| 233 | 'tab' => Controls_Manager::TAB_STYLE, |
| 234 | ] |
| 235 | ); |
| 236 | |
| 237 | $this->add_control( |
| 238 | 'shopengine_title_color', |
| 239 | [ |
| 240 | 'label' => esc_html__('Color', 'shopengine'), |
| 241 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 242 | 'default' => '#3A3A3A', |
| 243 | 'alpha' => false, |
| 244 | 'selectors' => [ |
| 245 | '{{WRAPPER}} .shopengine-checkout-form-shipping #ship-to-different-address > label > span' => 'color: {{VALUE}}', |
| 246 | ], |
| 247 | ] |
| 248 | ); |
| 249 | |
| 250 | $this->add_responsive_control( |
| 251 | 'shopengine_title_font_size', |
| 252 | [ |
| 253 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 254 | 'type' => Controls_Manager::SLIDER, |
| 255 | 'size_units' => ['px'], |
| 256 | 'range' => [ |
| 257 | 'px' => [ |
| 258 | 'min' => 0, |
| 259 | 'max' => 64, |
| 260 | ], |
| 261 | ], |
| 262 | 'default' => [ |
| 263 | 'size' => 18, |
| 264 | ], |
| 265 | 'selectors' => [ |
| 266 | '{{WRAPPER}} .shopengine-checkout-form-shipping #ship-to-different-address > label > span' => 'font-size: {{SIZE}}{{UNIT}};', |
| 267 | ], |
| 268 | ] |
| 269 | ); |
| 270 | |
| 271 | $this->add_group_control( |
| 272 | Group_Control_Typography::get_type(), |
| 273 | array( |
| 274 | 'name' => 'shopengine_title_typography', |
| 275 | 'label' => esc_html__('Typography', 'shopengine'), |
| 276 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-shipping #ship-to-different-address > label > span', |
| 277 | 'exclude' => ['text_decoration'], |
| 278 | 'exclude' => ['font_size'], |
| 279 | 'fields_options' => [ |
| 280 | 'typography' => [ |
| 281 | 'default' => 'custom', |
| 282 | ], |
| 283 | 'font_weight' => [ |
| 284 | 'default' => '700', |
| 285 | ], |
| 286 | 'line_height' => [ |
| 287 | 'default' => [ |
| 288 | 'size' => '22', |
| 289 | 'unit' => 'px' |
| 290 | ], |
| 291 | 'label' => 'Line-height (px)', |
| 292 | 'size_units' => ['px'] |
| 293 | ], |
| 294 | 'letter_spacing' => [ |
| 295 | 'responsive' => false, |
| 296 | ] |
| 297 | ], |
| 298 | ) |
| 299 | ); |
| 300 | |
| 301 | $this->add_responsive_control( |
| 302 | 'shopengine_title_margin', |
| 303 | [ |
| 304 | 'label' => esc_html__('Margin', 'shopengine'), |
| 305 | 'type' => Controls_Manager::DIMENSIONS, |
| 306 | 'size_units' => ['px'], |
| 307 | 'default' => [ |
| 308 | 'unit' => 'px', |
| 309 | 'top' => 0, |
| 310 | 'right' => 0, |
| 311 | 'bottom' => 25, |
| 312 | 'left' => 0, |
| 313 | 'isLinked' => true, |
| 314 | ], |
| 315 | 'selectors' => [ |
| 316 | '{{WRAPPER}} .shopengine-checkout-form-shipping #ship-to-different-address > label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 317 | '.rtl {{WRAPPER}} .shopengine-checkout-form-shipping #ship-to-different-address > label' => 'margin: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};', |
| 318 | ], |
| 319 | ] |
| 320 | ); |
| 321 | |
| 322 | $this->end_controls_section(); |
| 323 | |
| 324 | $this->start_controls_section( |
| 325 | 'shopengine_form_container_section', |
| 326 | [ |
| 327 | 'label' => esc_html__('Form Container', 'shopengine'), |
| 328 | 'tab' => Controls_Manager::TAB_STYLE, |
| 329 | ] |
| 330 | ); |
| 331 | |
| 332 | $this->add_control( |
| 333 | 'shopengine_container_alignment', |
| 334 | [ |
| 335 | 'label' => esc_html__('Alignment', 'shopengine'), |
| 336 | 'type' => Controls_Manager::CHOOSE, |
| 337 | 'options' => [ |
| 338 | 'left' => [ |
| 339 | 'title' => esc_html__('Left', 'shopengine'), |
| 340 | 'icon' => 'eicon-text-align-left', |
| 341 | ], |
| 342 | 'right' => [ |
| 343 | 'title' => esc_html__('Right', 'shopengine'), |
| 344 | 'icon' => 'eicon-text-align-right', |
| 345 | ], |
| 346 | ], |
| 347 | 'selectors' => [ |
| 348 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper' => 'text-align: {{VALUE}};', |
| 349 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper .woocommerce-input-wrapper input' => 'text-align: {{VALUE}};', |
| 350 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper .woocommerce-input-wrapper select' => 'text-align: {{VALUE}};', |
| 351 | |
| 352 | '.rtl {{WRAPPER}}.elementor-align-left :is(.shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper, #ship-to-different-address)' => 'text-align:right;', |
| 353 | '.rtl {{WRAPPER}}.elementor-align-right :is(.shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper, #ship-to-different-address)' => 'text-align:left;', |
| 354 | |
| 355 | '.rtl {{WRAPPER}}.elementor-align-left .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper .woocommerce-input-wrapper :is(input, select)' => 'text-align:right;', |
| 356 | '.rtl {{WRAPPER}}.elementor-align-right .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper .woocommerce-input-wrapper :is(input, select)' => 'text-align:left;', |
| 357 | ], |
| 358 | 'prefix_class' => 'elementor-align-', |
| 359 | ] |
| 360 | ); |
| 361 | |
| 362 | $this->add_control( |
| 363 | 'shopengine_form_container_background', |
| 364 | [ |
| 365 | 'label' => esc_html__('Form Container Background', 'shopengine'), |
| 366 | 'type' => Controls_Manager::COLOR, |
| 367 | 'alpha' => false, |
| 368 | 'default' => '#f7f8fb', |
| 369 | 'selectors' => [ |
| 370 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper' => 'background-color: {{VALUE}};', |
| 371 | ], |
| 372 | ] |
| 373 | ); |
| 374 | |
| 375 | $this->add_responsive_control( |
| 376 | 'shopengine_form_container_padding', |
| 377 | [ |
| 378 | 'label' => esc_html__('Padding', 'shopengine'), |
| 379 | 'type' => Controls_Manager::DIMENSIONS, |
| 380 | 'size_units' => ['px'], |
| 381 | 'default' => [ |
| 382 | 'top' => 25, |
| 383 | 'right' => 30, |
| 384 | 'bottom' => 25, |
| 385 | 'left' => 30, |
| 386 | ], |
| 387 | 'selectors' => [ |
| 388 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 389 | |
| 390 | '.rtl {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};', |
| 391 | ], |
| 392 | ] |
| 393 | ); |
| 394 | |
| 395 | $this->end_controls_section(); |
| 396 | |
| 397 | $this->start_controls_section( |
| 398 | 'shopengine_input_label_section', |
| 399 | [ |
| 400 | 'label' => esc_html__('Label', 'shopengine'), |
| 401 | 'tab' => Controls_Manager::TAB_STYLE, |
| 402 | ] |
| 403 | ); |
| 404 | |
| 405 | $this->add_control( |
| 406 | 'shopengine_input_label_color', |
| 407 | [ |
| 408 | 'label' => esc_html__('Color', 'shopengine'), |
| 409 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 410 | 'default' => '#3A3A3A', |
| 411 | 'alpha' => false, |
| 412 | 'selectors' => [ |
| 413 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row label' => 'color: {{VALUE}}', |
| 414 | ], |
| 415 | ] |
| 416 | ); |
| 417 | |
| 418 | $this->add_control( |
| 419 | 'shopengine_input_required_indicator_color', |
| 420 | [ |
| 421 | 'label' => esc_html__('Required Indicator Color:', 'shopengine'), |
| 422 | 'type' => Controls_Manager::COLOR, |
| 423 | 'default' => '#3A3A3A', |
| 424 | 'alpha' => false, |
| 425 | 'selectors' => [ |
| 426 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row label abbr' => 'color: {{VALUE}}', |
| 427 | ], |
| 428 | ] |
| 429 | ); |
| 430 | |
| 431 | $this->add_responsive_control( |
| 432 | 'shopengine_label_font_sizx', |
| 433 | [ |
| 434 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 435 | 'type' => Controls_Manager::SLIDER, |
| 436 | 'size_units' => ['px'], |
| 437 | 'range' => [ |
| 438 | 'px' => [ |
| 439 | 'min' => 0, |
| 440 | 'max' => 100, |
| 441 | ], |
| 442 | ], |
| 443 | 'default' => [ |
| 444 | 'size' => 22, |
| 445 | ], |
| 446 | 'selectors' => [ |
| 447 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row label' => 'font-size: {{SIZE}}{{UNIT}} !important;', |
| 448 | ], |
| 449 | |
| 450 | ] |
| 451 | ); |
| 452 | |
| 453 | $this->add_responsive_control( |
| 454 | 'shopengine_input_label_margin', |
| 455 | [ |
| 456 | 'label' => esc_html__('Margin', 'shopengine'), |
| 457 | 'type' => Controls_Manager::DIMENSIONS, |
| 458 | 'size_units' => ['px'], |
| 459 | 'default' => [ |
| 460 | 'top' => 0, |
| 461 | 'right' => 0, |
| 462 | 'bottom' => 8, |
| 463 | 'left' => 0, |
| 464 | ], |
| 465 | 'selectors' => [ |
| 466 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 467 | ], |
| 468 | ] |
| 469 | ); |
| 470 | |
| 471 | $this->end_controls_section(); |
| 472 | |
| 473 | $this->start_controls_section( |
| 474 | 'shopengine_input_section', |
| 475 | [ |
| 476 | 'label' => esc_html__('Input', 'shopengine'), |
| 477 | 'tab' => Controls_Manager::TAB_STYLE, |
| 478 | ] |
| 479 | ); |
| 480 | |
| 481 | $this->start_controls_tabs('shopengine_input_tabs_style'); |
| 482 | |
| 483 | $this->start_controls_tab( |
| 484 | 'shopengine_input_tabnormal', |
| 485 | [ |
| 486 | 'label' => esc_html__('Normal', 'shopengine'), |
| 487 | ] |
| 488 | ); |
| 489 | |
| 490 | |
| 491 | $this->add_control( |
| 492 | 'shopengine_input_color', |
| 493 | [ |
| 494 | 'label' => esc_html__('Input Color', 'shopengine'), |
| 495 | 'type' => Controls_Manager::COLOR, |
| 496 | 'alpha' => false, |
| 497 | 'selectors' => [ |
| 498 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, input::placeholder, textarea::placeholder, .woocommerce-input-wrapper .select2-selection, select)' => 'color: {{VALUE}};', |
| 499 | ], |
| 500 | 'default' => '#555', |
| 501 | ] |
| 502 | ); |
| 503 | |
| 504 | $this->add_control( |
| 505 | 'shopengine_input_background', |
| 506 | [ |
| 507 | 'label' => esc_html__('Background', 'shopengine'), |
| 508 | 'type' => Controls_Manager::COLOR, |
| 509 | 'default' => '#ffffff', |
| 510 | 'alpha' => false, |
| 511 | 'selectors' => [ |
| 512 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .woocommerce-input-wrapper .select2-selection, select)' => 'background-color: {{VALUE}};', |
| 513 | ], |
| 514 | ] |
| 515 | ); |
| 516 | |
| 517 | $this->add_group_control( |
| 518 | Group_Control_Border::get_type(), |
| 519 | [ |
| 520 | 'name' => 'shopengine_input_border', |
| 521 | 'label' => esc_html__('Border', 'shopengine'), |
| 522 | 'fields_options' => [ |
| 523 | 'border' => [ |
| 524 | 'default' => 'solid', |
| 525 | ], |
| 526 | 'width' => [ |
| 527 | 'label' => esc_html__('Border Width', 'shopengine'), |
| 528 | 'default' => [ |
| 529 | 'top' => 1, |
| 530 | 'right' => 1, |
| 531 | 'bottom' => 1, |
| 532 | 'left' => 1, |
| 533 | 'isLinked' => true, |
| 534 | ], |
| 535 | 'responsive' => false, |
| 536 | 'selectors' => [ |
| 537 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 538 | '.rtl {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 539 | ] |
| 540 | ], |
| 541 | 'color' => [ |
| 542 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 543 | 'default' => '#dee3ea', |
| 544 | 'alpha' => false, |
| 545 | 'selectors' => [ |
| 546 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'border-color: {{VALUE}} !important;' |
| 547 | ], |
| 548 | ], |
| 549 | ], |
| 550 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)', |
| 551 | ] |
| 552 | ); |
| 553 | |
| 554 | $this->end_controls_tab(); |
| 555 | |
| 556 | $this->start_controls_tab( |
| 557 | 'shopengine_input_tabfocus', |
| 558 | [ |
| 559 | 'label' => esc_html__('Focus', 'shopengine'), |
| 560 | ] |
| 561 | ); |
| 562 | |
| 563 | $this->add_control( |
| 564 | 'shopengine_input_color_focus', |
| 565 | [ |
| 566 | 'label' => esc_html__('Input Color', 'shopengine'), |
| 567 | 'type' => Controls_Manager::COLOR, |
| 568 | 'alpha' => false, |
| 569 | 'selectors' => [ |
| 570 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, input::placeholder, textarea::placeholder, .woocommerce-input-wrapper .select2-selection, select):focus' => 'color: {{VALUE}};', |
| 571 | ], |
| 572 | 'default' => '#555', |
| 573 | ] |
| 574 | ); |
| 575 | |
| 576 | $this->add_control( |
| 577 | 'shopengine_input_background_focus', |
| 578 | [ |
| 579 | 'label' => esc_html__('Background', 'shopengine'), |
| 580 | 'type' => Controls_Manager::COLOR, |
| 581 | 'default' => '#ffffff', |
| 582 | 'alpha' => false, |
| 583 | 'selectors' => [ |
| 584 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, input::placeholder, textarea::placeholder, .woocommerce-input-wrapper .select2-selection, select):focus' => 'background-color: {{VALUE}};', |
| 585 | ], |
| 586 | ] |
| 587 | ); |
| 588 | |
| 589 | $this->add_group_control( |
| 590 | Group_Control_Border::get_type(), |
| 591 | [ |
| 592 | 'name' => 'shopengine_input_border_focus', |
| 593 | 'label' => esc_html__('Border', 'shopengine'), |
| 594 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus', |
| 595 | 'fields_options' => [ |
| 596 | 'width' => [ |
| 597 | 'label' => esc_html__('Border Width', 'shopengine'), |
| 598 | 'responsive' => false, |
| 599 | 'selectors' => [ |
| 600 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 601 | '.rtl {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 602 | ] |
| 603 | ], |
| 604 | 'color' => [ |
| 605 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 606 | 'alpha' => false, |
| 607 | 'selectors' => [ |
| 608 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select):focus' => 'border-color: {{VALUE}} !important;' |
| 609 | ], |
| 610 | ], |
| 611 | ], |
| 612 | ] |
| 613 | ); |
| 614 | |
| 615 | $this->end_controls_tab(); |
| 616 | |
| 617 | $this->end_controls_tabs(); |
| 618 | |
| 619 | $this->add_control( |
| 620 | 'shopengine_input_font_sizx', |
| 621 | [ |
| 622 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 623 | 'type' => Controls_Manager::SLIDER, |
| 624 | 'size_units' => ['px'], |
| 625 | 'range' => [ |
| 626 | 'px' => [ |
| 627 | 'min' => 0, |
| 628 | 'max' => 100, |
| 629 | ], |
| 630 | ], |
| 631 | 'default' => [ |
| 632 | 'size' => 16, |
| 633 | ], |
| 634 | 'selectors' => [ |
| 635 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, input::placeholder, textarea, textarea::placeholder, .select2-selection, select)' => 'font-size: {{SIZE}}{{UNIT}} !important;', |
| 636 | ], |
| 637 | |
| 638 | ] |
| 639 | ); |
| 640 | |
| 641 | $this->add_control( |
| 642 | 'shopengine_input_border_radius', |
| 643 | [ |
| 644 | 'label' => esc_html__('Border Radius (px)', 'shopengine'), |
| 645 | 'type' => Controls_Manager::DIMENSIONS, |
| 646 | 'size_units' => ['px'], |
| 647 | 'default' => [ |
| 648 | 'top' => '4', |
| 649 | 'right' => '4', |
| 650 | 'bottom' => '4', |
| 651 | 'left' => '4', |
| 652 | 'unit' => 'px', |
| 653 | 'isLinked' => true, |
| 654 | ], |
| 655 | 'selectors' => [ |
| 656 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 657 | '.rtl {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 658 | ], |
| 659 | 'separator' => 'before' |
| 660 | ] |
| 661 | ); |
| 662 | |
| 663 | $this->add_control( |
| 664 | 'shopengine_input_padding', |
| 665 | [ |
| 666 | 'label' => esc_html__('Padding', 'shopengine'), |
| 667 | 'type' => Controls_Manager::DIMENSIONS, |
| 668 | 'size_units' => ['px'], |
| 669 | 'default' => [ |
| 670 | 'top' => 10, |
| 671 | 'right' => 16, |
| 672 | 'bottom' => 10, |
| 673 | 'left' => 16, |
| 674 | ], |
| 675 | 'separator' => 'before', |
| 676 | 'selectors' => [ |
| 677 | '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 678 | '.rtl {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper :is(input, textarea, .select2-selection, select)' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 679 | ], |
| 680 | ] |
| 681 | ); |
| 682 | |
| 683 | |
| 684 | $this->end_controls_section(); |
| 685 | |
| 686 | /** |
| 687 | ------------------------------- |
| 688 | Global Font |
| 689 | ------------------------------- |
| 690 | */ |
| 691 | $this->start_controls_section( |
| 692 | 'shopengine_typography_section', |
| 693 | [ |
| 694 | 'label' => esc_html__('Global Font', 'shopengine'), |
| 695 | 'tab' => Controls_Manager::TAB_STYLE, |
| 696 | ] |
| 697 | ); |
| 698 | |
| 699 | $this->add_group_control( |
| 700 | Group_Control_Typography::get_type(), |
| 701 | [ |
| 702 | 'name' => 'shopengine_typography_primary', |
| 703 | 'label' => esc_html__('Primary Typography', 'shopengine'), |
| 704 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields > h3 label, |
| 705 | {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row label', |
| 706 | 'exclude' => ['letter_spacing', 'font_size', 'text_decoration', 'font_style', 'line_height'], |
| 707 | 'fields_options' => [ |
| 708 | 'typography' => [ |
| 709 | 'default' => 'custom', |
| 710 | ], |
| 711 | 'font_weight' => [ |
| 712 | 'default' => '400', |
| 713 | ], |
| 714 | 'font_size' => [ |
| 715 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 716 | 'default' => [ |
| 717 | 'size' => '16', |
| 718 | 'unit' => 'px', |
| 719 | ], |
| 720 | 'size_units' => ['px'], |
| 721 | ], |
| 722 | ], |
| 723 | ] |
| 724 | ); |
| 725 | |
| 726 | $this->add_control( |
| 727 | 'shopengine_typography_primary_desc', |
| 728 | [ |
| 729 | 'type' => Controls_Manager::RAW_HTML, |
| 730 | 'raw' => esc_html__('Primary Typography : Form Title & Form Label', 'shopengine'), |
| 731 | 'content_classes' => 'elementor-control-field-description', |
| 732 | 'separator' => 'after', |
| 733 | ] |
| 734 | ); |
| 735 | |
| 736 | $this->add_group_control( |
| 737 | Group_Control_Typography::get_type(), |
| 738 | [ |
| 739 | 'name' => 'shopengine_typography_seconday', |
| 740 | 'label' => esc_html__('Secondary Typography', 'shopengine'), |
| 741 | 'selector' => '{{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row input, |
| 742 | {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row textarea, |
| 743 | {{WRAPPER}} .shopengine-checkout-form-shipping .woocommerce-shipping-fields__field-wrapper .form-row .select2-selection', |
| 744 | 'exclude' => ['font_style','font_size', 'line_height', 'letter_spacing', 'text_decoration'], |
| 745 | 'fields_options' => [ |
| 746 | 'typography' => [ |
| 747 | 'default' => 'custom', |
| 748 | ], |
| 749 | 'font_weight' => [ |
| 750 | 'default' => '400', |
| 751 | ], |
| 752 | 'font_size' => [ |
| 753 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 754 | 'default' => [ |
| 755 | 'size' => '16', |
| 756 | 'unit' => 'px', |
| 757 | ], |
| 758 | 'size_units' => ['px'], |
| 759 | ], |
| 760 | ], |
| 761 | ] |
| 762 | ); |
| 763 | |
| 764 | $this->add_control( |
| 765 | 'shopengine_typography_secondary_desc', |
| 766 | [ |
| 767 | 'type' => Controls_Manager::RAW_HTML, |
| 768 | 'raw' => esc_html__('Secondary Typography : Form Input', 'shopengine'), |
| 769 | 'content_classes' => 'elementor-control-field-description', |
| 770 | |
| 771 | ] |
| 772 | ); |
| 773 | |
| 774 | $this->end_controls_section(); |
| 775 | } |
| 776 | |
| 777 | /** |
| 778 | * Render widget output on the frontend. |
| 779 | * |
| 780 | * Written in PHP and used to generate the final HTML. |
| 781 | * |
| 782 | * @since 1.0.0 |
| 783 | * @access protected |
| 784 | */ |
| 785 | protected function screen() |
| 786 | { |
| 787 | $settings = $this->get_settings_for_display(); |
| 788 | |
| 789 | Helper::order_checkout_fields($settings['shopengine_shipping_inputs'], 'shipping'); |
| 790 | |
| 791 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 792 | |
| 793 | include $tpl; |
| 794 | } |
| 795 | } |
| 796 |