cart-totals.php
981 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use ShopEngine\Widgets\Products; |
| 8 | |
| 9 | class ShopEngine_Cart_Totals extends \ShopEngine\Base\Widget |
| 10 | { |
| 11 | |
| 12 | public function config() { |
| 13 | return new ShopEngine_Cart_Totals_Config(); |
| 14 | } |
| 15 | |
| 16 | protected function register_controls() { |
| 17 | |
| 18 | /* |
| 19 | ------------------------------- |
| 20 | Style Tab - Cart Table |
| 21 | ------------------------------- |
| 22 | */ |
| 23 | |
| 24 | $this->start_controls_section( |
| 25 | 'shopengine_cart_table_section', |
| 26 | array( |
| 27 | 'label' => esc_html__('Table', 'shopengine'), |
| 28 | 'tab' => Controls_Manager::TAB_STYLE, |
| 29 | ) |
| 30 | ); |
| 31 | |
| 32 | $this->add_group_control( |
| 33 | Group_Control_Typography::get_type(), |
| 34 | array( |
| 35 | 'name' => 'shopengine_cart_totals_typography', |
| 36 | 'label' => esc_html__('Title and Price Typography', 'shopengine'), |
| 37 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals :is(a:not(.checkout-button), tr, td, th, #shipping_method .price, #shipping_method .amount)', |
| 38 | 'exclude' => ['font_family', 'text_decoration', 'font_style'], |
| 39 | 'fields_options' => [ |
| 40 | 'typography' => [ |
| 41 | 'default' => 'custom', |
| 42 | ], |
| 43 | 'font_family' => [ |
| 44 | 'default' => 'Barlow', |
| 45 | ], |
| 46 | 'font_size' => [ |
| 47 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 48 | 'size_units' => ['px'], |
| 49 | 'default' => [ |
| 50 | 'size' => '18', |
| 51 | 'unit' => 'px', |
| 52 | ], |
| 53 | ], |
| 54 | 'font_weight' => [ |
| 55 | 'default' => '600', |
| 56 | ], |
| 57 | 'text_transform' => [ |
| 58 | 'default' => 'none', |
| 59 | ], |
| 60 | 'line_height' => [ |
| 61 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 62 | 'default' => [ |
| 63 | 'size' => '22', |
| 64 | 'unit' => 'px', |
| 65 | ], |
| 66 | 'size_units' => ['px'], |
| 67 | 'tablet_default' => [ |
| 68 | 'unit' => 'px', |
| 69 | ], |
| 70 | 'mobile_default' => [ |
| 71 | 'unit' => 'px', |
| 72 | ], |
| 73 | ], |
| 74 | 'letter_spacing' => [ |
| 75 | 'default' => [ |
| 76 | 'size' => '0.4', |
| 77 | ], |
| 78 | ], |
| 79 | ], |
| 80 | ) |
| 81 | ); |
| 82 | |
| 83 | $this->add_control( |
| 84 | 'shopengine_cart_totals_table_heading_color', |
| 85 | [ |
| 86 | 'label' => esc_html__('Title Color', 'shopengine'), |
| 87 | 'type' => Controls_Manager::COLOR, |
| 88 | 'default' => '#404040', |
| 89 | 'alpha' => false, |
| 90 | 'selectors' => [ |
| 91 | '{{WRAPPER}} .shopengine-cart-totals .shop_table tr th' => 'color: {{VALUE}};', |
| 92 | '{{WRAPPER}} .shopengine-cart-totals .shop_table tr.shipping td:before' => 'color: {{VALUE}};', |
| 93 | ], |
| 94 | 'separator' => 'before', |
| 95 | ] |
| 96 | ); |
| 97 | |
| 98 | $this->add_control( |
| 99 | 'shopengine_cart_totals_table_data_color', |
| 100 | [ |
| 101 | 'label' => esc_html__('Price Color', 'shopengine'), |
| 102 | 'type' => Controls_Manager::COLOR, |
| 103 | 'default' => '#505255', |
| 104 | 'alpha' => false, |
| 105 | 'selectors' => [ |
| 106 | '{{WRAPPER}} .shopengine-cart-totals .shop_table tr :is(td, td *, td::before)' => 'color: {{VALUE}};' |
| 107 | ], |
| 108 | ] |
| 109 | ); |
| 110 | |
| 111 | /* |
| 112 | * Style heading - Shipping Methods |
| 113 | */ |
| 114 | $this->add_control( |
| 115 | 'sshopengine_cart_totals_shipping_methods_headings', |
| 116 | array( |
| 117 | 'label' => esc_html__('Shipping Methods', 'shopengine'), |
| 118 | 'type' => Controls_Manager::HEADING, |
| 119 | 'separator' => 'before', |
| 120 | ) |
| 121 | ); |
| 122 | |
| 123 | $this->add_control( |
| 124 | 'shopengine_cart_totals_shipping_methods_heading_color', |
| 125 | [ |
| 126 | 'label' => esc_html__('Color', 'shopengine'), |
| 127 | 'type' => Controls_Manager::COLOR, |
| 128 | 'default' => '#505255', |
| 129 | 'alpha' => false, |
| 130 | 'selectors' => [ |
| 131 | '{{WRAPPER}} .shopengine-cart-totals tr.shipping :is(ul li label, p, form a)' => 'color: {{VALUE}};', |
| 132 | '{{WRAPPER}} .shopengine-cart-totals tr.shipping ul li input[type=radio]' => 'border-color: {{VALUE}};', |
| 133 | '{{WRAPPER}} .shopengine-cart-totals tr.shipping ul li input[type=radio]:checked' => 'border-color: {{VALUE}};', |
| 134 | '{{WRAPPER}} .shopengine-cart-totals tr.shipping ul li input[type=radio]:checked:before' => 'background: {{VALUE}};', |
| 135 | ], |
| 136 | ] |
| 137 | ); |
| 138 | |
| 139 | $this->add_group_control( |
| 140 | Group_Control_Typography::get_type(), |
| 141 | array( |
| 142 | 'name' => 'shopengine_cart_totals_shipping_methods_heading_typography', |
| 143 | 'label' => esc_html__('Typography', 'shopengine'), |
| 144 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals tr.shipping :is(ul li label, form a, p)', |
| 145 | 'exclude' => ['font_family', 'text_decoration', 'font_style'], |
| 146 | 'fields_options' => [ |
| 147 | 'typography' => [ |
| 148 | 'default' => 'custom', |
| 149 | ], |
| 150 | 'font_size' => [ |
| 151 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 152 | 'size_units' => ['px'], |
| 153 | 'default' => [ |
| 154 | 'size' => '16', |
| 155 | 'unit' => 'px', |
| 156 | ], |
| 157 | ], |
| 158 | 'font_weight' => [ |
| 159 | 'default' => '400', |
| 160 | ], |
| 161 | 'text_transform' => [ |
| 162 | 'default' => 'none', |
| 163 | ], |
| 164 | 'line_height' => [ |
| 165 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 166 | 'default' => [ |
| 167 | 'size' => '20', |
| 168 | 'unit' => 'px', |
| 169 | ], |
| 170 | 'size_units' => ['px'], |
| 171 | 'tablet_default' => [ |
| 172 | 'unit' => 'px', |
| 173 | ], |
| 174 | 'mobile_default' => [ |
| 175 | 'unit' => 'px', |
| 176 | ], |
| 177 | ], |
| 178 | 'letter_spacing' => [ |
| 179 | 'default' => [ |
| 180 | 'size' => '0.4', |
| 181 | ], |
| 182 | ], |
| 183 | ], |
| 184 | ) |
| 185 | ); |
| 186 | |
| 187 | $this->add_control( |
| 188 | 'shopengine_ship_method_desc', |
| 189 | [ |
| 190 | 'type' => Controls_Manager::RAW_HTML, |
| 191 | 'raw' => esc_html__( 'Shipping Methods can be added from WooCommerce > Settings > Shipping.', 'shopengine' ), |
| 192 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 193 | ] |
| 194 | ); |
| 195 | |
| 196 | /* |
| 197 | * Style heading - Table Row |
| 198 | */ |
| 199 | $this->add_control( |
| 200 | 'shopengine_cart_totals_table_row_heading', |
| 201 | array( |
| 202 | 'label' => esc_html__('Table Row', 'shopengine'), |
| 203 | 'type' => Controls_Manager::HEADING, |
| 204 | 'separator' => 'before', |
| 205 | ) |
| 206 | ); |
| 207 | |
| 208 | $this->add_group_control( |
| 209 | Group_Control_Border::get_type(), |
| 210 | [ |
| 211 | 'name' => 'shopengine_cart_totals_table_row_border', |
| 212 | 'label' => esc_html__('Border', 'shopengine'), |
| 213 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals .shop_table tr:not(:last-of-type)', |
| 214 | 'fields_options' => [ |
| 215 | 'border' => [ |
| 216 | 'default' => 'solid', |
| 217 | ], |
| 218 | 'width' => [ |
| 219 | 'label' => esc_html__('Width (px)', 'shopengine'), |
| 220 | 'allowed_dimensions' => ['top','bottom','left','right'], |
| 221 | 'size_units' => ['px'], |
| 222 | 'default' => [ |
| 223 | 'top' => '0', |
| 224 | 'right' => '0', |
| 225 | 'bottom' => '1', |
| 226 | 'left' => '0', |
| 227 | 'isLinked' => false, |
| 228 | ], |
| 229 | ], |
| 230 | 'color' => [ |
| 231 | 'default' => '#DEDFE2', |
| 232 | 'alpha' => false, |
| 233 | ] |
| 234 | ], |
| 235 | ] |
| 236 | ); |
| 237 | |
| 238 | $this->add_control( |
| 239 | 'shopengine_cart_totals_table_row_spacing', |
| 240 | [ |
| 241 | 'label' => esc_html__('Row Spacing (px)', 'shopengine'), |
| 242 | 'type' => Controls_Manager::SLIDER, |
| 243 | 'size_units' => ['px'], |
| 244 | 'range' => [ |
| 245 | 'px' => [ |
| 246 | 'min' => 0, |
| 247 | 'max' => 100, |
| 248 | 'step' => 1, |
| 249 | ], |
| 250 | ], |
| 251 | 'default' => [ |
| 252 | 'unit' => 'px', |
| 253 | 'size' => 26, |
| 254 | ], |
| 255 | 'selectors' => [ |
| 256 | '{{WRAPPER}} .shopengine-cart-totals .shop_table tr:not(:first-of-type) :is(td, th)' => 'padding: {{SIZE}}{{UNIT}} 0;', |
| 257 | '{{WRAPPER}} .shopengine-cart-totals .shop_table tr:first-of-type :is(td, th)' => 'padding: 0 0 {{SIZE}}{{UNIT}} 0;', |
| 258 | ], |
| 259 | 'separator' => 'before', |
| 260 | ] |
| 261 | ); |
| 262 | |
| 263 | $this->end_controls_section(); |
| 264 | |
| 265 | |
| 266 | /* |
| 267 | ------------------------------- |
| 268 | Table Input controls |
| 269 | ------------------------------- |
| 270 | */ |
| 271 | |
| 272 | $this->start_controls_section( |
| 273 | 'shopengine_section_ct_input_section', |
| 274 | array( |
| 275 | 'label' => esc_html__('Input', 'shopengine'), |
| 276 | 'tab' => Controls_Manager::TAB_STYLE, |
| 277 | ) |
| 278 | ); |
| 279 | |
| 280 | |
| 281 | $this->add_control( |
| 282 | 'shopengine_input_input_font_size', |
| 283 | [ |
| 284 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 285 | 'type' => Controls_Manager::SLIDER, |
| 286 | 'size_units' => ['px'], |
| 287 | 'range' => [ |
| 288 | 'px' => [ |
| 289 | 'min' => 0, |
| 290 | 'max' => 100, |
| 291 | 'step' => 1, |
| 292 | ], |
| 293 | ], |
| 294 | 'default' => [ |
| 295 | 'unit' => 'px', |
| 296 | 'size' => 18, |
| 297 | ], |
| 298 | 'selectors' => [ |
| 299 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-selection)' => 'font-size: {{SIZE}}{{UNIT}};', |
| 300 | ], |
| 301 | ] |
| 302 | ); |
| 303 | |
| 304 | $this->add_control( |
| 305 | 'shopengine_input_padding', |
| 306 | [ |
| 307 | 'label' => esc_html__('Padding', 'shopengine'), |
| 308 | 'type' => Controls_Manager::DIMENSIONS, |
| 309 | 'size_units' => ['px'], |
| 310 | 'default' => [ |
| 311 | 'top' => 12, |
| 312 | 'right' => 20, |
| 313 | 'bottom'=> 12, |
| 314 | 'left' => 20, |
| 315 | 'size_unit' => 'px', |
| 316 | 'is_linked' => false, |
| 317 | ], |
| 318 | 'selectors' => [ |
| 319 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-selection__rendered)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 320 | '.rtl {{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-selection__rendered)' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 321 | ], |
| 322 | 'separator' => 'before' |
| 323 | ] |
| 324 | ); |
| 325 | |
| 326 | $this->add_control( |
| 327 | 'shopengine_input_margin', |
| 328 | [ |
| 329 | 'label' => esc_html__('Margin (px)', 'shopengine'), |
| 330 | 'type' => Controls_Manager::DIMENSIONS, |
| 331 | 'size_units' => ['px'], |
| 332 | 'default' => [ |
| 333 | 'top' => 10, |
| 334 | 'right' => 0, |
| 335 | 'bottom'=> 10, |
| 336 | 'left' => 0, |
| 337 | 'size_unit' => 'px', |
| 338 | 'is_linked' => false, |
| 339 | ], |
| 340 | 'selectors' => [ |
| 341 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container)' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 342 | '.rtl {{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container)' => 'margin: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 343 | ], |
| 344 | ] |
| 345 | ); |
| 346 | |
| 347 | $this->start_controls_tabs('shopengine_input_tabs_style'); |
| 348 | |
| 349 | $this->start_controls_tab( |
| 350 | 'shopengine_input_tabnormal', |
| 351 | [ |
| 352 | 'label' => esc_html__('Normal', 'shopengine'), |
| 353 | ] |
| 354 | ); |
| 355 | |
| 356 | $this->add_control( |
| 357 | 'shopengine_input_color', |
| 358 | [ |
| 359 | 'label' => esc_html__('Input Color', 'shopengine'), |
| 360 | 'type' => Controls_Manager::COLOR, |
| 361 | 'alpha' => false, |
| 362 | 'default' => '#101010', |
| 363 | 'selectors' => [ |
| 364 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-selection)' => 'color: {{VALUE}};', |
| 365 | |
| 366 | ], |
| 367 | 'default' => '#101010', |
| 368 | ] |
| 369 | ); |
| 370 | |
| 371 | $this->add_control( |
| 372 | 'shopengine_input_background', |
| 373 | [ |
| 374 | 'label' => esc_html__('Input Background color', 'shopengine'), |
| 375 | 'type' => Controls_Manager::COLOR, |
| 376 | 'alpha' => false, |
| 377 | 'default' => '#ffffff', |
| 378 | 'selectors' => [ |
| 379 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, select2-container, .select2-container)' => 'background-color: {{VALUE}} !important;', |
| 380 | ], |
| 381 | ] |
| 382 | ); |
| 383 | |
| 384 | |
| 385 | |
| 386 | $this->add_group_control( |
| 387 | Group_Control_Border::get_type(), |
| 388 | [ |
| 389 | 'name' => 'shopengine_input_border', |
| 390 | 'label' => esc_html__('Border', 'shopengine'), |
| 391 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container)', |
| 392 | 'fields_options' => [ |
| 393 | 'width' => [ |
| 394 | 'selectors' => [ |
| 395 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container)' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 396 | '.rtl {{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container)' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 397 | ] |
| 398 | ] |
| 399 | ], |
| 400 | ] |
| 401 | ); |
| 402 | |
| 403 | $this->end_controls_tab(); |
| 404 | |
| 405 | $this->start_controls_tab( |
| 406 | 'shopengine_input_tabfocus', |
| 407 | [ |
| 408 | 'label' => esc_html__('Focus', 'shopengine'), |
| 409 | ] |
| 410 | ); |
| 411 | |
| 412 | $this->add_control( |
| 413 | 'shopengine_input_color_focus', |
| 414 | [ |
| 415 | 'label' => esc_html__('Input Color', 'shopengine'), |
| 416 | 'type' => Controls_Manager::COLOR, |
| 417 | 'alpha' => false, |
| 418 | 'selectors' => [ |
| 419 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-selection):focus' => 'color: {{VALUE}};', |
| 420 | ], |
| 421 | 'default' => '#000000', |
| 422 | ] |
| 423 | ); |
| 424 | |
| 425 | |
| 426 | $this->add_control( |
| 427 | 'shopengine_input_background_focus', |
| 428 | [ |
| 429 | 'label' => esc_html__('Input Background color', 'shopengine'), |
| 430 | 'type' => Controls_Manager::COLOR, |
| 431 | 'alpha' => false, |
| 432 | 'default' => '#ffffff', |
| 433 | 'selectors' => [ |
| 434 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container, .select2-container):focus' => 'background-color: {{VALUE}} !important;', |
| 435 | ], |
| 436 | ] |
| 437 | ); |
| 438 | |
| 439 | $this->add_group_control( |
| 440 | Group_Control_Border::get_type(), |
| 441 | [ |
| 442 | 'name' => 'shopengine_input_border_focus', |
| 443 | 'label' => esc_html__('Border', 'shopengine'), |
| 444 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container):focus', |
| 445 | 'fields_options' => [ |
| 446 | 'width' => [ |
| 447 | 'selectors' => [ |
| 448 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container):focus' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 449 | '.rtl {{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container):focus' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 450 | ] |
| 451 | ] |
| 452 | ], |
| 453 | ] |
| 454 | ); |
| 455 | |
| 456 | $this->end_controls_tab(); |
| 457 | |
| 458 | $this->end_controls_tabs(); |
| 459 | |
| 460 | |
| 461 | $this->add_control( |
| 462 | 'shopengine_input_border_radius', |
| 463 | [ |
| 464 | 'label' => esc_html__('Border Radius (px)', 'shopengine'), |
| 465 | 'type' => Controls_Manager::DIMENSIONS, |
| 466 | 'size_units' => ['px'], |
| 467 | 'default' => [ |
| 468 | 'top' => '4', |
| 469 | 'right' => '4', |
| 470 | 'bottom' => '4', |
| 471 | 'left' => '4', |
| 472 | 'unit' => 'px', |
| 473 | 'isLinked' => true, |
| 474 | ], |
| 475 | 'selectors' => [ |
| 476 | '{{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 477 | '.rtl {{WRAPPER}} .shopengine-cart-totals .woocommerce-shipping-calculator :is(select, input, .select2-container)' => 'border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};', |
| 478 | ], |
| 479 | 'separator' => 'before' |
| 480 | ] |
| 481 | ); |
| 482 | |
| 483 | |
| 484 | $this->end_controls_section(); |
| 485 | |
| 486 | /* |
| 487 | ------------------------------- |
| 488 | Style Tab - Update Shipping |
| 489 | ------------------------------- |
| 490 | */ |
| 491 | $this->start_controls_section( |
| 492 | 'shopengine_section_cart_totals_update_shipping_button', |
| 493 | array( |
| 494 | 'label' => esc_html__('Update Shipping Button', 'shopengine'), |
| 495 | 'tab' => Controls_Manager::TAB_STYLE, |
| 496 | ) |
| 497 | ); |
| 498 | |
| 499 | $this->add_group_control( |
| 500 | Group_Control_Typography::get_type(), |
| 501 | array( |
| 502 | 'name' => 'shopengine_cart_totals_update_shipping_typography', |
| 503 | 'label' => esc_html__('Typography', 'shopengine'), |
| 504 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button', |
| 505 | 'exclude' => ['font_family', 'text_decoration', 'font_style'], |
| 506 | 'fields_options' => [ |
| 507 | 'typography' => [ |
| 508 | 'default' => 'custom', |
| 509 | ], |
| 510 | 'font_size' => [ |
| 511 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 512 | 'size_units' => ['px'], |
| 513 | 'default' => [ |
| 514 | 'size' => '16', |
| 515 | 'unit' => 'px', |
| 516 | ], |
| 517 | ], |
| 518 | 'font_weight' => [ |
| 519 | 'default' => '500', |
| 520 | ], |
| 521 | 'text_transform' => [ |
| 522 | 'default' => 'none', |
| 523 | ], |
| 524 | 'line_height' => [ |
| 525 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 526 | 'default' => [ |
| 527 | 'size' => '19', |
| 528 | 'unit' => 'px', |
| 529 | ], |
| 530 | 'size_units' => ['px'], |
| 531 | 'tablet_default' => [ |
| 532 | 'unit' => 'px', |
| 533 | ], |
| 534 | 'mobile_default' => [ |
| 535 | 'unit' => 'px', |
| 536 | ], |
| 537 | ], |
| 538 | 'letter_spacing' => [ |
| 539 | 'default' => [ |
| 540 | 'size' => '-0.4', |
| 541 | ], |
| 542 | ], |
| 543 | ], |
| 544 | ) |
| 545 | ); |
| 546 | |
| 547 | $this->start_controls_tabs( |
| 548 | 'shopengine_cart_totals_update_shipping_button_tabs' |
| 549 | ); |
| 550 | |
| 551 | $this->start_controls_tab( |
| 552 | 'shopengine_cart_totals_update_shipping_button_normal_tab', |
| 553 | [ |
| 554 | 'label' => esc_html__('Normal', 'shopengine'), |
| 555 | ] |
| 556 | ); |
| 557 | |
| 558 | $this->add_control( |
| 559 | 'shopengine_cart_totals_update_shipping_button_color', |
| 560 | [ |
| 561 | 'label' => esc_html__('Color', 'shopengine'), |
| 562 | 'type' => Controls_Manager::COLOR, |
| 563 | 'default' => '#FFFFFF', |
| 564 | 'alpha' => false, |
| 565 | 'selectors' => [ |
| 566 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'color: {{VALUE}} !important;', |
| 567 | ], |
| 568 | ] |
| 569 | ); |
| 570 | |
| 571 | $this->add_control( |
| 572 | 'shopengine_cart_totals_update_shipping_button_background_color', |
| 573 | [ |
| 574 | 'label' => esc_html__('Background', 'shopengine'), |
| 575 | 'type' => Controls_Manager::COLOR, |
| 576 | 'default' => '#3A3A3A', |
| 577 | 'alpha' => false, |
| 578 | 'selectors' => [ |
| 579 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'background: {{VALUE}} !important;', |
| 580 | ], |
| 581 | ] |
| 582 | ); |
| 583 | |
| 584 | $this->end_controls_tab(); |
| 585 | |
| 586 | $this->start_controls_tab( |
| 587 | 'shopengine_cart_totals_update_shipping_button_hover_tab', |
| 588 | [ |
| 589 | 'label' => esc_html__('Hover', 'shopengine'), |
| 590 | ] |
| 591 | ); |
| 592 | |
| 593 | $this->add_control( |
| 594 | 'shopengine_cart_totals_update_shipping_button_hover_color', |
| 595 | [ |
| 596 | 'label' => esc_html__('Color', 'shopengine'), |
| 597 | 'type' => Controls_Manager::COLOR, |
| 598 | 'default' => '', |
| 599 | 'selectors' => [ |
| 600 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button:hover' => 'color: {{VALUE}} !important;', |
| 601 | ], |
| 602 | ] |
| 603 | ); |
| 604 | |
| 605 | $this->add_control( |
| 606 | 'shopengine_cart_totals_update_shipping_button_background_hover_color', |
| 607 | [ |
| 608 | 'label' => esc_html__('Background', 'shopengine'), |
| 609 | 'type' => Controls_Manager::COLOR, |
| 610 | 'default' => '#707070', |
| 611 | 'alpha' => false, |
| 612 | 'selectors' => [ |
| 613 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button:hover' => 'background: {{VALUE}} !important;', |
| 614 | ], |
| 615 | ] |
| 616 | ); |
| 617 | |
| 618 | $this->add_control( |
| 619 | 'shopengine_cart_totals_update_shipping_button_hover_border_color', |
| 620 | [ |
| 621 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 622 | 'type' => Controls_Manager::COLOR, |
| 623 | 'default' => '#707070', |
| 624 | 'alpha' => false, |
| 625 | 'selectors' => [ |
| 626 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'border-color: {{VALUE}};', |
| 627 | ], |
| 628 | ] |
| 629 | ); |
| 630 | |
| 631 | $this->end_controls_tab(); |
| 632 | $this->end_controls_tabs(); |
| 633 | |
| 634 | $this->add_group_control( |
| 635 | Group_Control_Border::get_type(), |
| 636 | [ |
| 637 | 'name' => 'shopengine_cart_totals_update_shipping_button_border', |
| 638 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button', |
| 639 | 'separator' => 'before', |
| 640 | 'fields_options' => [ |
| 641 | 'width' => [ |
| 642 | 'selectors' => [ |
| 643 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 644 | '.rtl {{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 645 | ] |
| 646 | ] |
| 647 | ], |
| 648 | ] |
| 649 | ); |
| 650 | |
| 651 | $this->add_control( |
| 652 | 'shopengine_cart_totals_update_shipping_button_border_radius', |
| 653 | [ |
| 654 | 'label' => esc_html__('Border Radius (px)', 'shopengine'), |
| 655 | 'type' => Controls_Manager::DIMENSIONS, |
| 656 | 'size_units' => ['px'], |
| 657 | 'selectors' => [ |
| 658 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 659 | '.rtl {{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 660 | ], |
| 661 | ] |
| 662 | ); |
| 663 | |
| 664 | $this->add_responsive_control( |
| 665 | 'shopengine_cart_totals_update_shipping_button_padding', |
| 666 | [ |
| 667 | 'label' => esc_html__('Padding (px)', 'shopengine'), |
| 668 | 'type' => Controls_Manager::DIMENSIONS, |
| 669 | 'default' => [ |
| 670 | 'top' => '13', |
| 671 | 'right' => '5', |
| 672 | 'bottom' => '13', |
| 673 | 'left' => '5', |
| 674 | 'unit' => 'px', |
| 675 | 'isLinked' => false, |
| 676 | ], |
| 677 | 'size_units' => ['px'], |
| 678 | 'selectors' => [ |
| 679 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 680 | '.rtl {{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 681 | ], |
| 682 | 'separator' => 'before', |
| 683 | ] |
| 684 | ); |
| 685 | |
| 686 | $this->add_control( |
| 687 | 'shopengine_cart_totals_update_shipping_button_width', |
| 688 | [ |
| 689 | 'label' => esc_html__('Update Button Width', 'shopengine'), |
| 690 | 'type' => Controls_Manager::SLIDER, |
| 691 | 'size_units' => ['px', '%'], |
| 692 | 'range' => [ |
| 693 | 'px' => [ |
| 694 | 'min' => -100, |
| 695 | 'max' => 600, |
| 696 | 'step' => 5, |
| 697 | ], |
| 698 | '%' => [ |
| 699 | 'min' => 0, |
| 700 | 'max' => 100, |
| 701 | ], |
| 702 | ], |
| 703 | 'default' => [ |
| 704 | 'unit' => '%', |
| 705 | 'size' => 100, |
| 706 | ], |
| 707 | 'selectors' => [ |
| 708 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .shop_table tr.shipping form .shipping-calculator-form p button' => 'width: {{SIZE}}{{UNIT}};', |
| 709 | ], |
| 710 | ] |
| 711 | ); |
| 712 | |
| 713 | $this->end_controls_section(); |
| 714 | |
| 715 | /* |
| 716 | ------------------------------- |
| 717 | Style Tab - Checkout Button |
| 718 | ------------------------------- |
| 719 | */ |
| 720 | $this->start_controls_section( |
| 721 | 'shopengine_section_cart_totals_checkout_button', |
| 722 | array( |
| 723 | 'label' => esc_html__('Checkout Button', 'shopengine'), |
| 724 | 'tab' => Controls_Manager::TAB_STYLE, |
| 725 | ) |
| 726 | ); |
| 727 | |
| 728 | $this->add_group_control( |
| 729 | Group_Control_Typography::get_type(), |
| 730 | array( |
| 731 | 'name' => 'shopengine_cart_totals_checkout_button_typography', |
| 732 | 'label' => esc_html__('Typography', 'shopengine'), |
| 733 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals .wc-proceed-to-checkout :is(a, .button, button, .checkout-button)', |
| 734 | 'exclude' => ['font_family', 'text_decoration', 'font_style'], |
| 735 | 'fields_options' => [ |
| 736 | 'typography' => [ |
| 737 | 'default' => 'custom', |
| 738 | ], |
| 739 | 'font_size' => [ |
| 740 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 741 | 'size_units' => ['px'], |
| 742 | 'default' => [ |
| 743 | 'size' => '16', |
| 744 | 'unit' => 'px', |
| 745 | ], |
| 746 | ], |
| 747 | 'font_weight' => [ |
| 748 | 'default' => '500', |
| 749 | ], |
| 750 | 'text_transform' => [ |
| 751 | 'default' => 'none', |
| 752 | ], |
| 753 | 'line_height' => [ |
| 754 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 755 | 'default' => [ |
| 756 | 'size' => '19', |
| 757 | 'unit' => 'px', |
| 758 | ], |
| 759 | 'size_units' => ['px'], |
| 760 | 'tablet_default' => [ |
| 761 | 'unit' => 'px', |
| 762 | ], |
| 763 | 'mobile_default' => [ |
| 764 | 'unit' => 'px', |
| 765 | ], |
| 766 | ], |
| 767 | 'letter_spacing' => [ |
| 768 | 'default' => [ |
| 769 | 'size' => '-0.4', |
| 770 | ], |
| 771 | ], |
| 772 | ], |
| 773 | ) |
| 774 | ); |
| 775 | |
| 776 | $this->start_controls_tabs( |
| 777 | 'shopengine_cart_totals_checkout_button_tabs' |
| 778 | ); |
| 779 | |
| 780 | $this->start_controls_tab( |
| 781 | 'shopengine_cart_totals_checkout_button_normal_tab', |
| 782 | [ |
| 783 | 'label' => esc_html__('Normal', 'shopengine'), |
| 784 | ] |
| 785 | ); |
| 786 | |
| 787 | $this->add_control( |
| 788 | 'shopengine_cart_totals_checkout_button_color', |
| 789 | [ |
| 790 | 'label' => esc_html__('Color', 'shopengine'), |
| 791 | 'type' => Controls_Manager::COLOR, |
| 792 | 'default' => '#FFFFFF', |
| 793 | 'alpha' => false, |
| 794 | 'selectors' => [ |
| 795 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'color: {{VALUE}} !important;', |
| 796 | ], |
| 797 | ] |
| 798 | ); |
| 799 | |
| 800 | $this->add_control( |
| 801 | 'shopengine_cart_totals_checkout_button_background_color', |
| 802 | [ |
| 803 | 'label' => esc_html__('Background', 'shopengine'), |
| 804 | 'type' => Controls_Manager::COLOR, |
| 805 | 'default' => '#3A3A3A', |
| 806 | 'alpha' => false, |
| 807 | 'selectors' => [ |
| 808 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'background: {{VALUE}} !important;', |
| 809 | ], |
| 810 | ] |
| 811 | ); |
| 812 | |
| 813 | $this->end_controls_tab(); |
| 814 | |
| 815 | $this->start_controls_tab( |
| 816 | 'shopengine_cart_totals_checkout_button_hover_tab', |
| 817 | [ |
| 818 | 'label' => esc_html__('Hover', 'shopengine'), |
| 819 | ] |
| 820 | ); |
| 821 | |
| 822 | $this->add_control( |
| 823 | 'shopengine_cart_totals_checkout_button_hover_color', |
| 824 | [ |
| 825 | 'label' => esc_html__('Color', 'shopengine'), |
| 826 | 'type' => Controls_Manager::COLOR, |
| 827 | 'default' => '', |
| 828 | 'selectors' => [ |
| 829 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button):hover' => 'color: {{VALUE}} !important;', |
| 830 | ], |
| 831 | ] |
| 832 | ); |
| 833 | |
| 834 | $this->add_control( |
| 835 | 'shopengine_cart_totals_checkout_button_background_hover_color', |
| 836 | [ |
| 837 | 'label' => esc_html__('Background', 'shopengine'), |
| 838 | 'type' => Controls_Manager::COLOR, |
| 839 | 'default' => '#707070', |
| 840 | 'alpha' => false, |
| 841 | 'selectors' => [ |
| 842 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button):hover' => 'background: {{VALUE}} !important;', |
| 843 | ], |
| 844 | ] |
| 845 | ); |
| 846 | |
| 847 | $this->add_control( |
| 848 | 'shopengine_cart_totals_checkout_button_hover_border_color', |
| 849 | [ |
| 850 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 851 | 'type' => Controls_Manager::COLOR, |
| 852 | 'default' => '#707070', |
| 853 | 'alpha' => false, |
| 854 | 'selectors' => [ |
| 855 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'border-color: {{VALUE}};', |
| 856 | ], |
| 857 | ] |
| 858 | ); |
| 859 | |
| 860 | $this->end_controls_tab(); |
| 861 | $this->end_controls_tabs(); |
| 862 | |
| 863 | $this->add_group_control( |
| 864 | Group_Control_Border::get_type(), |
| 865 | [ |
| 866 | 'name' => 'shopengine_cart_totals_checkout_button_border', |
| 867 | 'selector' => '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)', |
| 868 | 'separator' => 'before', |
| 869 | 'fields_options' => [ |
| 870 | 'width' => [ |
| 871 | 'selectors' => [ |
| 872 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 873 | '.rtl {{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}}', |
| 874 | ] |
| 875 | ] |
| 876 | ], |
| 877 | ] |
| 878 | ); |
| 879 | |
| 880 | $this->add_control( |
| 881 | 'shopengine_cart_totals_checkout_button_border_radius', |
| 882 | [ |
| 883 | 'label' => esc_html__('Border Radius (px)', 'shopengine'), |
| 884 | 'type' => Controls_Manager::DIMENSIONS, |
| 885 | 'size_units' => ['px'], |
| 886 | 'selectors' => [ |
| 887 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 888 | '.rtl {{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 889 | ], |
| 890 | ] |
| 891 | ); |
| 892 | |
| 893 | $this->add_responsive_control( |
| 894 | 'shopengine_cart_totals_checkout_button_padding', |
| 895 | [ |
| 896 | 'label' => esc_html__('Padding (px)', 'shopengine'), |
| 897 | 'type' => Controls_Manager::DIMENSIONS, |
| 898 | 'default' => [ |
| 899 | 'top' => '13', |
| 900 | 'right' => '5', |
| 901 | 'bottom' => '13', |
| 902 | 'left' => '5', |
| 903 | 'unit' => 'px', |
| 904 | 'isLinked' => false, |
| 905 | ], |
| 906 | 'size_units' => ['px'], |
| 907 | 'selectors' => [ |
| 908 | '{{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 909 | '.rtl {{WRAPPER}} .shopengine-cart-totals :is(.wc-proceed-to-checkout .button, button)' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}} !important;', |
| 910 | ], |
| 911 | 'separator' => 'before', |
| 912 | ] |
| 913 | ); |
| 914 | |
| 915 | $this->add_control( |
| 916 | 'shopengine_cart_totals_checkout_button_width', |
| 917 | [ |
| 918 | 'label' => esc_html__('Checkout Button Width', 'shopengine'), |
| 919 | 'type' => Controls_Manager::SLIDER, |
| 920 | 'size_units' => ['px', '%'], |
| 921 | 'range' => [ |
| 922 | 'px' => [ |
| 923 | 'min' => -100, |
| 924 | 'max' => 600, |
| 925 | 'step' => 5, |
| 926 | ], |
| 927 | '%' => [ |
| 928 | 'min' => 0, |
| 929 | 'max' => 100, |
| 930 | ], |
| 931 | ], |
| 932 | 'default' => [ |
| 933 | 'unit' => '%', |
| 934 | 'size' => 100, |
| 935 | ], |
| 936 | 'selectors' => [ |
| 937 | '{{WRAPPER}} .shopengine-cart-totals .cart_totals .wc-proceed-to-checkout' => 'width: {{SIZE}}{{UNIT}};', |
| 938 | ], |
| 939 | ] |
| 940 | ); |
| 941 | |
| 942 | $this->end_controls_section(); |
| 943 | |
| 944 | |
| 945 | /* |
| 946 | -------------------------- |
| 947 | Style Tab - Global Font |
| 948 | -------------------------- |
| 949 | */ |
| 950 | $this->start_controls_section( |
| 951 | 'shopengine_cart_totals_global_font_section', |
| 952 | [ |
| 953 | 'label' => esc_html__('Global Font', 'shopengine'), |
| 954 | 'tab' => Controls_Manager::TAB_STYLE, |
| 955 | ] |
| 956 | ); |
| 957 | |
| 958 | $this->add_control( |
| 959 | 'shopengine_cart_totals_global_font_family', |
| 960 | [ |
| 961 | 'label' => esc_html__('Font Family', 'shopengine'), |
| 962 | 'description' => esc_html__('This font family is set for this specific widget.', 'shopengine'), |
| 963 | 'type' => Controls_Manager::FONT, |
| 964 | 'selectors' => [ |
| 965 | '{{WRAPPER}} .shopengine-cart-totals :is(a, h2, tr, td, th, .price, .amount, span,)' => 'font-family: {{VALUE}};', |
| 966 | ], |
| 967 | ] |
| 968 | ); |
| 969 | } |
| 970 | |
| 971 | protected function screen() { |
| 972 | |
| 973 | $settings = $this->get_settings_for_display(); |
| 974 | |
| 975 | $post_type = get_post_type(); |
| 976 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 977 | |
| 978 | include $tpl; |
| 979 | } |
| 980 | } |
| 981 |