cart-table.php
755 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Elementor; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use ShopEngine\Widgets\Products; |
| 8 | |
| 9 | class ShopEngine_Cart_Table extends \ShopEngine\Base\Widget { |
| 10 | |
| 11 | public function config() { |
| 12 | return new ShopEngine_Cart_Table_Config(); |
| 13 | } |
| 14 | |
| 15 | |
| 16 | protected function register_controls() { |
| 17 | |
| 18 | /* |
| 19 | * Setting Tab - Content |
| 20 | */ |
| 21 | $this->start_controls_section( |
| 22 | 'shopengine_section_cart_table_general', |
| 23 | [ |
| 24 | 'label' => esc_html__('General', 'shopengine'), |
| 25 | 'type' => Controls_Manager::TAB_SETTINGS, |
| 26 | ] |
| 27 | ); |
| 28 | |
| 29 | $this->add_control( |
| 30 | 'shopengine_cart_table_footer__buttons', |
| 31 | [ |
| 32 | 'label' => esc_html__('Buttons', 'shopengine'), |
| 33 | 'type' => Controls_Manager::HEADING, |
| 34 | 'separator' => 'before', |
| 35 | ] |
| 36 | ); |
| 37 | |
| 38 | $this->add_control( |
| 39 | 'show_continue_shopping', |
| 40 | [ |
| 41 | 'label' => esc_html__('Hide Continue Shopping Button?', 'shopengine'), |
| 42 | 'type' => Controls_Manager::SWITCHER, |
| 43 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 44 | 'label_off' => esc_html__('No', 'shopengine'), |
| 45 | 'return_value' => 'none', |
| 46 | 'default' => 'inline-block', |
| 47 | 'selectors' => [ |
| 48 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer .return-to-shop' => 'display: {{VALUE}};' |
| 49 | ], |
| 50 | ] |
| 51 | ); |
| 52 | |
| 53 | $this->add_control( |
| 54 | 'show_clear_all', |
| 55 | [ |
| 56 | 'label' => esc_html__('Hide Clear All Button?', 'shopengine'), |
| 57 | 'type' => Controls_Manager::SWITCHER, |
| 58 | 'label_on' => esc_html__('Yes', 'shopengine'), |
| 59 | 'label_off' => esc_html__('No', 'shopengine'), |
| 60 | 'return_value' => 'none', |
| 61 | 'default' => 'inline-block', |
| 62 | 'selectors' => [ |
| 63 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer button[name=empty_cart]' => 'display: {{VALUE}};' |
| 64 | ], |
| 65 | ] |
| 66 | ); |
| 67 | |
| 68 | $this->end_controls_section(); |
| 69 | |
| 70 | /* |
| 71 | ============================== |
| 72 | Style Tab - Cart Table Header |
| 73 | ============================= |
| 74 | */ |
| 75 | $this->start_controls_section( |
| 76 | 'shopengine_section__cart_table_head', |
| 77 | [ |
| 78 | 'label' => esc_html__('Table Header', 'shopengine'), |
| 79 | 'tab' => Controls_Manager::TAB_STYLE, |
| 80 | ] |
| 81 | ); |
| 82 | |
| 83 | $this->add_control( |
| 84 | 'shopengine_cart_table_head__bg_color', |
| 85 | [ |
| 86 | 'label' => esc_html__( 'Background Color', 'shopengine' ), |
| 87 | 'type' => Controls_Manager::COLOR, |
| 88 | 'alpha' => false, |
| 89 | 'default' => '#F2F2F2', |
| 90 | 'alpha' => false, |
| 91 | 'selectors' => [ |
| 92 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__head' => 'background-color: {{VALUE}};', |
| 93 | ], |
| 94 | ] |
| 95 | ); |
| 96 | |
| 97 | $this->add_control( |
| 98 | 'shopengine_cart_table_head__color', |
| 99 | [ |
| 100 | 'label' => esc_html__( 'Text Color', 'shopengine' ), |
| 101 | 'type' => Controls_Manager::COLOR, |
| 102 | 'alpha' => false, |
| 103 | 'default' => '#3a3a3a', |
| 104 | 'alpha' => false, |
| 105 | 'selectors' => [ |
| 106 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__head div' => 'color: {{VALUE}};', |
| 107 | ], |
| 108 | ] |
| 109 | ); |
| 110 | |
| 111 | $this->add_group_control( |
| 112 | Group_Control_Typography::get_type(), |
| 113 | array( |
| 114 | 'name' => 'shopengine_cart_table_head_typography', |
| 115 | 'label' => esc_html__('Typography', 'shopengine'), |
| 116 | 'name' => 'shopengine_cart_table_head_typography', |
| 117 | 'label' => esc_html__('Typography', 'shopengine'), |
| 118 | 'selector' => '{{WRAPPER}} .shopengine-cart-table .shopengine-table__head div', |
| 119 | 'exclude' => ['font_style', 'text_decoration', 'font_family'], |
| 120 | 'fields_options' => [ |
| 121 | 'typography' => [ |
| 122 | 'default' => 'custom', |
| 123 | ], |
| 124 | 'font_weight' => [ |
| 125 | 'default' => '600', |
| 126 | ], |
| 127 | 'font_size' => [ |
| 128 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 129 | 'default' => [ |
| 130 | 'size' => '16', |
| 131 | 'unit' => 'px' |
| 132 | ], |
| 133 | 'size_units' => ['px'] |
| 134 | ], |
| 135 | 'text_transform' => [ |
| 136 | 'default' => 'capitalize', |
| 137 | ], |
| 138 | 'line_height' => [ |
| 139 | 'label' => esc_html__('Line-Height (px)', 'shopengine'), |
| 140 | 'default' => [ |
| 141 | 'size' => '19', |
| 142 | 'unit' => 'px' |
| 143 | ], |
| 144 | 'size_units' => ['px'] |
| 145 | ], |
| 146 | 'letter_spacing' => [ |
| 147 | 'default' => [ |
| 148 | 'size' => '0', |
| 149 | ] |
| 150 | ], |
| 151 | ], |
| 152 | ) |
| 153 | ); |
| 154 | |
| 155 | $this->add_responsive_control( |
| 156 | 'shopengine_cart_table_head__padding', |
| 157 | [ |
| 158 | 'label' => esc_html__('Padding (px)', 'shopengine'), |
| 159 | 'type' => Controls_Manager::DIMENSIONS, |
| 160 | 'size_units' => ['px'], |
| 161 | 'default' => [ |
| 162 | 'top' => '12', |
| 163 | 'right' => '40', |
| 164 | 'bottom' => '12', |
| 165 | 'left' => '40', |
| 166 | 'unit' => 'px', |
| 167 | 'isLinked' => false, |
| 168 | ], |
| 169 | 'selectors' => [ |
| 170 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__head' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 171 | ], |
| 172 | 'separator' => 'before', |
| 173 | ] |
| 174 | ); |
| 175 | |
| 176 | $this->end_controls_section(); // end ./ Style Tab - Cart Table Header |
| 177 | |
| 178 | /* |
| 179 | =============================== |
| 180 | Style Tab - Cart Table Body |
| 181 | =============================== |
| 182 | */ |
| 183 | |
| 184 | $this->start_controls_section( |
| 185 | 'shopengine_section__cart_table_content', |
| 186 | [ |
| 187 | 'label' => esc_html__('Table Body', 'shopengine'), |
| 188 | 'tab' => Controls_Manager::TAB_STYLE, |
| 189 | ] |
| 190 | ); |
| 191 | |
| 192 | $this->add_control( |
| 193 | 'shopengine_cart_table_single_cart_item_bg', |
| 194 | [ |
| 195 | 'label' => esc_html__('Background', 'shopengine'), |
| 196 | 'type' => Controls_Manager::COLOR, |
| 197 | 'alpha' => false, |
| 198 | 'default' => '#ffffff', |
| 199 | 'alpha' => false, |
| 200 | 'selectors' => [ |
| 201 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body' => 'background: {{VALUE}};', |
| 202 | ], |
| 203 | ] |
| 204 | ); |
| 205 | |
| 206 | |
| 207 | $this->add_control( |
| 208 | 'shopengine_cart_table_content__text_color', |
| 209 | [ |
| 210 | 'label' => esc_html__('Text Color', 'shopengine'), |
| 211 | 'type' => Controls_Manager::COLOR, |
| 212 | 'default' => '#979797', |
| 213 | 'alpha' => false, |
| 214 | 'selectors' => [ |
| 215 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body :is(.shopengine-table__body-item--td, div, a, span)' => 'color: {{VALUE}};' |
| 216 | ], |
| 217 | ] |
| 218 | ); |
| 219 | |
| 220 | $this->add_control( |
| 221 | 'shopengine_cart_table_border_color', |
| 222 | [ |
| 223 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 224 | 'type' => Controls_Manager::COLOR, |
| 225 | 'default' => '#F2F2F2', |
| 226 | 'alpha' => false, |
| 227 | 'selectors' => [ |
| 228 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body' => 'border-style: solid; border-width: 0 1px 1px 1px; border-color: {{VALUE}};' |
| 229 | ], |
| 230 | ] |
| 231 | ); |
| 232 | |
| 233 | $this->add_control( |
| 234 | 'shopengine_cart_table_content__text_hover_color', |
| 235 | [ |
| 236 | 'label' => esc_html__('Link Hover Color', 'shopengine'), |
| 237 | 'type' => Controls_Manager::COLOR, |
| 238 | 'alpha' => false, |
| 239 | 'default' => '#979797', |
| 240 | 'alpha' => false, |
| 241 | 'selectors' => [ |
| 242 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .shopengine-table__body-item--td a:hover' => 'color: {{VALUE}};', |
| 243 | ], |
| 244 | ] |
| 245 | ); |
| 246 | |
| 247 | $this->add_control( |
| 248 | 'shopengine_cart_table_content__price_color', |
| 249 | [ |
| 250 | 'label' => esc_html__('Price Color', 'shopengine'), |
| 251 | 'type' => Controls_Manager::COLOR, |
| 252 | 'alpha' => false, |
| 253 | 'default' => '#222222', |
| 254 | 'alpha' => false, |
| 255 | 'selectors' => [ |
| 256 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .shopengine-table__body-item--td .amount :is(span, bdi)' => 'color: {{VALUE}};', |
| 257 | '{{WRAPPER}} .shopengine-cart-table table tbody .product-subtotal' => 'color: {{VALUE}};', |
| 258 | ], |
| 259 | ] |
| 260 | ); |
| 261 | |
| 262 | $this->add_group_control( |
| 263 | Group_Control_Typography::get_type(), |
| 264 | array( |
| 265 | 'name' => 'shopengine_cart_table_content_typography', |
| 266 | 'label' => esc_html__('Typography', 'shopengine'), |
| 267 | 'selector' => '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .shopengine-table__body-item--td :is(a, .amount, bdi)', |
| 268 | 'exclude' => ['font_family', 'text_decoration', 'font_style', 'letter_spacing'], |
| 269 | 'fields_options' => [ |
| 270 | 'typography' => [ |
| 271 | 'default' => 'custom', |
| 272 | ], |
| 273 | 'font_weight' => [ |
| 274 | 'default' => '500', |
| 275 | ], |
| 276 | 'font_size' => [ |
| 277 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 278 | 'default' => [ |
| 279 | 'size' => '14', |
| 280 | 'unit' => 'px' |
| 281 | ], |
| 282 | 'size_units' => ['px'] |
| 283 | ], |
| 284 | 'text_transform' => [ |
| 285 | 'default' => 'uppercase', |
| 286 | ], |
| 287 | 'line_height' => [ |
| 288 | 'label' => esc_html__('Line Height (px)', 'shopengine'), |
| 289 | 'default' => [ |
| 290 | 'size' => '18', |
| 291 | 'unit' => 'px' |
| 292 | ], |
| 293 | 'size_units' => ['px'] |
| 294 | ], |
| 295 | 'letter_spacing' => [ |
| 296 | 'default' => [ |
| 297 | 'size' => '0', |
| 298 | ] |
| 299 | ], |
| 300 | ], |
| 301 | ) |
| 302 | ); |
| 303 | |
| 304 | $this->add_responsive_control( |
| 305 | 'shopengine_cart_table_content_padding', |
| 306 | [ |
| 307 | 'label' => esc_html__('Content Padding (px)', 'shopengine'), |
| 308 | 'type' => Controls_Manager::DIMENSIONS, |
| 309 | 'size_units' => ['px'], |
| 310 | 'desktop_default' => [ |
| 311 | 'top' => '30', |
| 312 | 'right' => '0', |
| 313 | 'bottom' => '30', |
| 314 | 'left' => '40', |
| 315 | 'unit' => 'px', |
| 316 | 'isLinked' => false, |
| 317 | ], |
| 318 | 'tablet_default' => [ |
| 319 | 'top' => '20', |
| 320 | 'right' => '30', |
| 321 | 'bottom' => '20', |
| 322 | 'left' => '10', |
| 323 | 'unit' => 'px', |
| 324 | 'isLinked' => false, |
| 325 | ], |
| 326 | 'selectors' => [ |
| 327 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 328 | ], |
| 329 | |
| 330 | ] |
| 331 | ); |
| 332 | |
| 333 | |
| 334 | $this->add_control( |
| 335 | 'shopengine_cart_table_cell_gap', |
| 336 | [ |
| 337 | 'label' => esc_html__('Row Gap', 'shopengine'), |
| 338 | 'type' => Controls_Manager::SLIDER, |
| 339 | 'size_units' => ['px'], |
| 340 | |
| 341 | 'range' => [ |
| 342 | 'px' => [ |
| 343 | 'min' => 0, |
| 344 | 'max' => 100, |
| 345 | 'step' => 1, |
| 346 | ], |
| 347 | ], |
| 348 | 'default' => [ |
| 349 | 'unit' => 'px', |
| 350 | 'size' => 30, |
| 351 | ], |
| 352 | 'selectors' => [ |
| 353 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body' => 'grid-row-gap: {{SIZE}}{{UNIT}};', |
| 354 | ], |
| 355 | ] |
| 356 | ); |
| 357 | |
| 358 | |
| 359 | $this->end_controls_section(); // end ./ Style Tab - Cart Table Body |
| 360 | |
| 361 | /* |
| 362 | =============================== |
| 363 | Style Tab - produt image |
| 364 | =============================== |
| 365 | */ |
| 366 | |
| 367 | $this->start_controls_section( |
| 368 | 'shopengine_ct_product_image', |
| 369 | [ |
| 370 | 'label' => esc_html__('Product Image', 'shopengine'), |
| 371 | 'tab' => Controls_Manager::TAB_STYLE, |
| 372 | ] |
| 373 | ); |
| 374 | |
| 375 | $this->add_control( |
| 376 | 'shopengine_ct_product_image_border_clr', |
| 377 | [ |
| 378 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 379 | 'type' => Controls_Manager::COLOR, |
| 380 | 'default' => '#F2F2F2', |
| 381 | 'alpha' => false, |
| 382 | 'selectors' => [ |
| 383 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .product-thumbnail img' => 'border-color: {{VALUE}};', |
| 384 | ], |
| 385 | ] |
| 386 | ); |
| 387 | |
| 388 | $this->add_control( |
| 389 | 'shopengine_ct_product_image_width', |
| 390 | [ |
| 391 | 'label' => esc_html__('Width', 'shopengine'), |
| 392 | 'type' => Controls_Manager::SLIDER, |
| 393 | 'size_units' => ['px'], |
| 394 | |
| 395 | 'range' => [ |
| 396 | 'px' => [ |
| 397 | 'min' => 0, |
| 398 | 'max' => 200, |
| 399 | 'step' => 1, |
| 400 | ], |
| 401 | ], |
| 402 | 'default' => [ |
| 403 | 'unit' => 'px', |
| 404 | 'size' => 80, |
| 405 | ], |
| 406 | 'selectors' => [ |
| 407 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .product-thumbnail img' => 'width: {{SIZE}}{{UNIT}}; min-width: {{SIZE}}{{UNIT}};', |
| 408 | ], |
| 409 | ] |
| 410 | ); |
| 411 | |
| 412 | $this->end_controls_section(); // end ./ Style Tab - produt image |
| 413 | |
| 414 | /* |
| 415 | =============================== |
| 416 | Style Tab - Quantity |
| 417 | =============================== |
| 418 | */ |
| 419 | |
| 420 | $this->start_controls_section( |
| 421 | 'shopengine_ct_quantity_section', |
| 422 | [ |
| 423 | 'label' => esc_html__('Quantity', 'shopengine'), |
| 424 | 'tab' => Controls_Manager::TAB_STYLE, |
| 425 | ] |
| 426 | ); |
| 427 | |
| 428 | $this->add_control( |
| 429 | 'shopengine_cart_table_qty_btn_text_clr', |
| 430 | [ |
| 431 | 'label' => esc_html__('Text Color', 'shopengine'), |
| 432 | 'type' => Controls_Manager::COLOR, |
| 433 | 'default' => '#101010', |
| 434 | 'alpha' => false, |
| 435 | 'selectors' => [ |
| 436 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .shopengine-cart-quantity :is(.minus-button, .plus-button, .quantity, input)' => 'color: {{VALUE}};' |
| 437 | ], |
| 438 | ] |
| 439 | ); |
| 440 | |
| 441 | $this->add_control( |
| 442 | 'shopengine_cart_table_qty_btn_hover_text_clr', |
| 443 | [ |
| 444 | 'label' => esc_html__('Hover Text Color', 'shopengine'), |
| 445 | 'type' => Controls_Manager::COLOR, |
| 446 | 'default' => '#ACA3A3', |
| 447 | 'alpha' => false, |
| 448 | 'selectors' => [ |
| 449 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .shopengine-cart-quantity :is(.minus-button, .plus-button):hover' => 'color: {{VALUE}};' |
| 450 | ], |
| 451 | ] |
| 452 | ); |
| 453 | |
| 454 | $this->add_control( |
| 455 | 'shopengine_cart_table_qty_btn_border_clr', |
| 456 | [ |
| 457 | 'label' => esc_html__('Border Color', 'shopengine'), |
| 458 | 'type' => Controls_Manager::COLOR, |
| 459 | 'default' => '#F2F2F2', |
| 460 | 'alpha' => false, |
| 461 | 'selectors' => [ |
| 462 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__body .shopengine-cart-quantity :is(.minus-button, .plus-button, .quantity)' => 'border-color: {{VALUE}};' |
| 463 | ], |
| 464 | ] |
| 465 | ); |
| 466 | |
| 467 | $this->end_controls_section(); // end ./ Style Tab - Quantity |
| 468 | |
| 469 | /* |
| 470 | * Style Tab - Cart Table Footer |
| 471 | */ |
| 472 | |
| 473 | $this->start_controls_section( |
| 474 | 'shopengine_cart_table_footer_section', |
| 475 | [ |
| 476 | 'label' => esc_html__('Table Footer', 'shopengine'), |
| 477 | 'tab' => Controls_Manager::TAB_STYLE, |
| 478 | ] |
| 479 | ); |
| 480 | |
| 481 | $this->add_control( |
| 482 | 'shopengine_cart_table_footer_bg', |
| 483 | [ |
| 484 | 'label' => esc_html__('Background', 'shopengine'), |
| 485 | 'type' => Controls_Manager::COLOR, |
| 486 | 'default' => '#ffffff', |
| 487 | 'alpha' => false, |
| 488 | 'selectors' => [ |
| 489 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer' => 'background: {{VALUE}};', |
| 490 | ], |
| 491 | ] |
| 492 | ); |
| 493 | |
| 494 | $this->add_responsive_control( |
| 495 | 'shopengine_cart_table_footer_padding', |
| 496 | [ |
| 497 | 'label' => esc_html__('Padding (px)', 'shopengine'), |
| 498 | 'type' => Controls_Manager::DIMENSIONS, |
| 499 | 'size_units' => ['px'], |
| 500 | 'desktop_default' => [ |
| 501 | 'top' => '30', |
| 502 | 'right' => '0', |
| 503 | 'bottom' => '0', |
| 504 | 'left' => '0', |
| 505 | 'unit' => 'px', |
| 506 | 'isLinked' => false, |
| 507 | ], |
| 508 | 'selectors' => [ |
| 509 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 510 | ], |
| 511 | ] |
| 512 | ); |
| 513 | |
| 514 | $this->add_control( |
| 515 | 'shopengine_cart_table_footer_btn_styles', |
| 516 | [ |
| 517 | 'label' => esc_html__('Button Styles', 'shopengine'), |
| 518 | 'type' => Controls_Manager::HEADING, |
| 519 | 'separator' => 'before', |
| 520 | ] |
| 521 | ); |
| 522 | |
| 523 | $this->add_group_control( |
| 524 | Group_Control_Typography::get_type(), |
| 525 | array( |
| 526 | 'name' => 'shopengine_cart_table_footer_btn_typography', |
| 527 | 'label' => esc_html__('Typography', 'shopengine'), |
| 528 | 'selector' => '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer .shopengine-footer-button', |
| 529 | 'exclude' => ['font_family', 'letter_spacing', 'line_height', 'text_decoration', 'font_style'], |
| 530 | 'fields_options' => [ |
| 531 | 'typography' => [ |
| 532 | 'default' => 'custom', |
| 533 | ], |
| 534 | 'font_weight' => [ |
| 535 | 'default' => '600', |
| 536 | ], |
| 537 | 'font_size' => [ |
| 538 | 'label' => esc_html__('Font Size (px)', 'shopengine'), |
| 539 | 'default' => [ |
| 540 | 'size' => '16', |
| 541 | 'unit' => 'px' |
| 542 | ], |
| 543 | 'size_units' => ['px'] |
| 544 | ], |
| 545 | 'text_transform' => [ |
| 546 | 'default' => 'capitalize', |
| 547 | ], |
| 548 | |
| 549 | ], |
| 550 | ) |
| 551 | ); |
| 552 | |
| 553 | |
| 554 | |
| 555 | $this->start_controls_tabs('shopengine_cart_table_footer_button_style__tabs'); |
| 556 | |
| 557 | $this->start_controls_tab('shopengine_cart_table_footer_button_tab__normal', |
| 558 | [ |
| 559 | 'label' => esc_html__('Normal', 'shopengine'), |
| 560 | ] |
| 561 | ); |
| 562 | |
| 563 | $this->add_control( |
| 564 | 'shopengine_cart_table_footer_btn_normal_color', |
| 565 | [ |
| 566 | 'label' => esc_html__('Color', 'shopengine'), |
| 567 | 'type' => Controls_Manager::COLOR, |
| 568 | 'default' => '#979797', |
| 569 | 'alpha' => false, |
| 570 | 'selectors' => [ |
| 571 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer :is(.shopengine-footer-button, a, i)' => 'color: {{VALUE}} !important;' |
| 572 | ], |
| 573 | ] |
| 574 | ); |
| 575 | |
| 576 | $this->add_control( |
| 577 | 'shopengine_cart_table_footer_btn_normal_bg_color', |
| 578 | [ |
| 579 | 'label' => esc_html__('Background Color', 'shopengine'), |
| 580 | 'type' => Controls_Manager::COLOR, |
| 581 | 'default' => '#f1f1f1', |
| 582 | 'alpha' => false, |
| 583 | 'selectors' => [ |
| 584 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer .shopengine-footer-button' => 'background-color: {{VALUE}} !important;', |
| 585 | ], |
| 586 | ] |
| 587 | ); |
| 588 | |
| 589 | $this->end_controls_tab(); |
| 590 | |
| 591 | $this->start_controls_tab('shopengine_cart_table_footer_button_tab__hover', |
| 592 | [ |
| 593 | 'label' => esc_html__('Hover', 'shopengine'), |
| 594 | ] |
| 595 | ); |
| 596 | |
| 597 | $this->add_control( |
| 598 | 'shopengine_cart_table_footer_btn_hover_color', |
| 599 | [ |
| 600 | 'label' => esc_html__('Color', 'shopengine'), |
| 601 | 'type' => Controls_Manager::COLOR, |
| 602 | 'alpha' => false, |
| 603 | 'default' => '#FFFFFF', |
| 604 | 'alpha' => false, |
| 605 | 'selectors' => [ |
| 606 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer :is(.shopengine-footer-button, a):hover' => 'color: {{VALUE}} !important;', |
| 607 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer .shopengine-footer-button:hover :is(a, i, span)' => 'color: {{VALUE}} !important;' |
| 608 | ] |
| 609 | ] |
| 610 | ); |
| 611 | |
| 612 | $this->add_control( |
| 613 | 'shopengine_cart_table_footer_btn_hover_bg_color', |
| 614 | [ |
| 615 | 'label' => esc_html__('Background Color', 'shopengine'), |
| 616 | 'type' => Controls_Manager::COLOR, |
| 617 | 'default' => '#3A3A3A', |
| 618 | 'alpha' => false, |
| 619 | 'selectors' => [ |
| 620 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer .shopengine-footer-button:hover' => 'background-color: {{VALUE}} !important;', |
| 621 | ], |
| 622 | ] |
| 623 | ); |
| 624 | |
| 625 | $this->add_control( |
| 626 | 'shopengine_cart_table_footer_btn_hover_border_color', |
| 627 | [ |
| 628 | 'label' => esc_html__('Button Padding', 'shopengine'), |
| 629 | 'type' => Controls_Manager::DIMENSIONS, |
| 630 | 'size_units' => ['px'], |
| 631 | 'default' => [ |
| 632 | 'top' => '13', |
| 633 | 'right' => '22', |
| 634 | 'bottom' => '15', |
| 635 | 'left' => '22', |
| 636 | 'unit' => 'px', |
| 637 | 'isLinked' => true, |
| 638 | ], |
| 639 | 'selectors' => [ |
| 640 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer .shopengine-footer-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 641 | ], |
| 642 | ] |
| 643 | ); |
| 644 | |
| 645 | |
| 646 | $this->add_control( |
| 647 | 'shopengine_cart_table_footer_btn_border_radius', |
| 648 | [ |
| 649 | 'label' => esc_html__('Border Radius (px)', 'shopengine'), |
| 650 | 'type' => Controls_Manager::DIMENSIONS, |
| 651 | 'size_units' => ['px'], |
| 652 | 'default' => [ |
| 653 | 'top' => '4', |
| 654 | 'right' => '4', |
| 655 | 'bottom' => '4', |
| 656 | 'left' => '4', |
| 657 | 'unit' => 'px', |
| 658 | 'isLinked' => true, |
| 659 | ], |
| 660 | 'selectors' => [ |
| 661 | '{{WRAPPER}} .shopengine-cart-table .shopengine-table__footer .shopengine-footer-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 662 | ], |
| 663 | 'separator' => 'before' |
| 664 | ] |
| 665 | ); |
| 666 | |
| 667 | $this->add_responsive_control( |
| 668 | 'shopengine_cart_table_footer_btn_padding', |
| 669 | [ |
| 670 | 'label' => esc_html__('Button Padding (px)', 'shopengine'), |
| 671 | 'type' => Controls_Manager::DIMENSIONS, |
| 672 | 'size_units' => ['px'], |
| 673 | 'default' => [ |
| 674 | 'top' => '15', |
| 675 | 'right' => '20', |
| 676 | 'bottom' => '15', |
| 677 | 'left' => '20', |
| 678 | 'unit' => 'px', |
| 679 | 'isLinked' => false, |
| 680 | ], |
| 681 | 'selectors' => [ |
| 682 | '{{WRAPPER}} .shopengine-cart-table table .shopengine-footer-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 683 | ], |
| 684 | 'separator' => 'before' |
| 685 | ] |
| 686 | ); |
| 687 | |
| 688 | $this->end_controls_section(); |
| 689 | |
| 690 | /*--------------------------- |
| 691 | global font family |
| 692 | -----------------------------*/ |
| 693 | $this->start_controls_section( |
| 694 | 'shopengine_cart_table_typography', |
| 695 | array( |
| 696 | 'label' => esc_html__('Global Font', 'shopengine'), |
| 697 | 'tab' => Controls_Manager::TAB_STYLE, |
| 698 | ) |
| 699 | ); |
| 700 | |
| 701 | $this->add_control( |
| 702 | 'shopengine_cart_table_font_family', |
| 703 | [ |
| 704 | 'label' => esc_html__('Font Family', 'shopengine'), |
| 705 | 'description' => esc_html__('This font family is set for this specific widget.', 'shopengine'), |
| 706 | 'type' => Controls_Manager::FONT, |
| 707 | 'default' => '', |
| 708 | 'selectors' => [ |
| 709 | '{{WRAPPER}} .shopengine-cart-table :is(.shopengine-table__body, .shopengine-table__head, .shopengine-table__footer) :is(div, span, a, button, bdi)' => 'font-family: {{VALUE}}', |
| 710 | ], |
| 711 | 'separator' => 'before' |
| 712 | ] |
| 713 | ); |
| 714 | |
| 715 | $this->end_controls_section(); |
| 716 | |
| 717 | /* |
| 718 | * Style Tab - Global Font |
| 719 | */ |
| 720 | $this->start_controls_section( |
| 721 | 'shopengine_cart_table_global_font_section', |
| 722 | [ |
| 723 | 'label' => esc_html__('Global Font', 'shopengine'), |
| 724 | 'tab' => Controls_Manager::TAB_STYLE, |
| 725 | ] |
| 726 | ); |
| 727 | |
| 728 | $this->add_control( |
| 729 | 'shopengine_cart_table_global_font_family', |
| 730 | [ |
| 731 | 'label' => esc_html__('Font Family', 'shopengine'), |
| 732 | 'description' => esc_html__('This font family is set for this specific widget.', 'shopengine'), |
| 733 | 'type' => Controls_Manager::FONT, |
| 734 | 'selectors' => [ |
| 735 | '{{WRAPPER}} .shopengine-cart-table table :is(th, tr, td, button, input)' => 'font-family: {{VALUE}};', |
| 736 | ], |
| 737 | ] |
| 738 | ); |
| 739 | |
| 740 | $this->end_controls_section(); // end ./ global font family |
| 741 | } |
| 742 | |
| 743 | |
| 744 | protected function screen() { |
| 745 | |
| 746 | $settings = $this->get_settings_for_display(); |
| 747 | |
| 748 | $post_type = get_post_type(); |
| 749 | |
| 750 | $tpl = Products::instance()->get_widget_template($this->get_name()); |
| 751 | |
| 752 | include $tpl; |
| 753 | } |
| 754 | } |
| 755 |