| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimateStoreKit\Modules\PageOrder\Widgets; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Group_Control_Background; |
| 7 |
use Elementor\Group_Control_Border; |
| 8 |
use Elementor\Group_Control_Box_Shadow; |
| 9 |
use Elementor\Group_Control_Typography; |
| 10 |
use UltimateStoreKit\Base\Module_Base; |
| 11 |
|
| 12 |
// phpcs:disable WordPressVIPMinimum.Performance.WPQueryParams -- WordPressVIPMinimum targets the VIP platform, not the plugin directory. These exclusionary parameters come from a widget's own "exclude" control: the list is whatever the site owner picked in Elementor, applied to a bounded result set, not an unbounded catalogue scan. |
| 13 |
|
| 14 |
if ( !defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
// Exit if accessed directly |
| 19 |
|
| 20 |
// class Add_To_Cart extends Widget_Button { |
| 21 |
class Page_Order extends Module_Base { |
| 22 |
|
| 23 |
public function get_show_in_panel_tags() { |
| 24 |
return ['shop_single']; |
| 25 |
} |
| 26 |
|
| 27 |
public function get_name() { |
| 28 |
return 'usk-page-order'; |
| 29 |
} |
| 30 |
|
| 31 |
public function get_title() { |
| 32 |
return BDTUSK . esc_html__( 'Order Page', 'ultimate-store-kit' ); |
| 33 |
} |
| 34 |
|
| 35 |
public function get_icon() { |
| 36 |
return 'usk-widget-icon usk-icon-page-order usk-new'; |
| 37 |
} |
| 38 |
|
| 39 |
public function get_categories() { |
| 40 |
return ['ultimate-store-kit-order-thankyou']; |
| 41 |
} |
| 42 |
|
| 43 |
public function show_in_panel() { |
| 44 |
return get_post_type() !== 'page'; |
| 45 |
} |
| 46 |
|
| 47 |
public function get_keywords() { |
| 48 |
return ['add', 'to', 'cart', 'woocommerce', 'wc', 'additional', 'info']; |
| 49 |
} |
| 50 |
|
| 51 |
public function get_style_depends() { |
| 52 |
|
| 53 |
if ( $this->usk_is_edit_mode() ) { |
| 54 |
return ['usk-all-styles']; |
| 55 |
} else { |
| 56 |
return ['usk-font', 'usk-add-to-cart', 'usk-page-order']; |
| 57 |
} |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
public function has_widget_inner_wrapper(): bool { |
| 62 |
return !\Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 63 |
} |
| 64 |
|
| 65 |
protected function register_controls() { |
| 66 |
$this->start_controls_section( |
| 67 |
'section_layout_thankyou_orders', |
| 68 |
[ |
| 69 |
'label' => __( 'ThankYou Order', 'ultimate-store-kit' ), |
| 70 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 71 |
] |
| 72 |
); |
| 73 |
|
| 74 |
$this->add_responsive_control( |
| 75 |
'thankyou_spacing', |
| 76 |
[ |
| 77 |
'label' => __( 'Spacing', 'ultimate-store-kit' ), |
| 78 |
'type' => Controls_Manager::SLIDER, |
| 79 |
'size_units' => ['px'], |
| 80 |
'range' => [ |
| 81 |
'px' => [ |
| 82 |
'min' => 0, |
| 83 |
'max' => 100, |
| 84 |
'step' => 1, |
| 85 |
], |
| 86 |
], |
| 87 |
'selectors' => [ |
| 88 |
'{{WRAPPER}}' => '--usk-order-page-spacing: {{SIZE}}{{UNIT}};', |
| 89 |
], |
| 90 |
] |
| 91 |
); |
| 92 |
|
| 93 |
$this->add_control( |
| 94 |
'thankyou_show_order_id', |
| 95 |
[ |
| 96 |
'label' => __( 'Show Order ID', 'ultimate-store-kit' ), |
| 97 |
'type' => Controls_Manager::SWITCHER, |
| 98 |
'default' => 'yes', |
| 99 |
'separator' => 'after', |
| 100 |
] |
| 101 |
); |
| 102 |
$this->add_control( |
| 103 |
'thankyou_order_received_text', |
| 104 |
[ |
| 105 |
'label' => __( 'Description', 'ultimate-store-kit' ), |
| 106 |
'type' => Controls_Manager::TEXTAREA, |
| 107 |
'dynamic' => ['active' => true], |
| 108 |
'rows' => 5, |
| 109 |
'default' => __( 'Thank you. Your order has been received.', 'ultimate-store-kit' ), |
| 110 |
'placeholder' => __( 'Thank you. Your order has been received.', 'ultimate-store-kit' ), |
| 111 |
] |
| 112 |
); |
| 113 |
$this->add_control( |
| 114 |
'thankyour_order_alignment', |
| 115 |
[ |
| 116 |
'label' => __( 'Alignment', 'ultimate-store-kit' ), |
| 117 |
'type' => Controls_Manager::CHOOSE, |
| 118 |
'options' => [ |
| 119 |
'left' => [ |
| 120 |
'title' => __( 'Left', 'ultimate-store-kit' ), |
| 121 |
'icon' => 'eicon-h-align-left', |
| 122 |
], |
| 123 |
'center' => [ |
| 124 |
'title' => __( 'Center', 'ultimate-store-kit' ), |
| 125 |
'icon' => 'eicon-h-align-center', |
| 126 |
], |
| 127 |
'right' => [ |
| 128 |
'title' => __( 'Right', 'ultimate-store-kit' ), |
| 129 |
'icon' => 'eicon-h-align-right', |
| 130 |
], |
| 131 |
], |
| 132 |
'default' => 'center', |
| 133 |
'toggle' => false, |
| 134 |
'selectors' => [ |
| 135 |
'{{WRAPPER}} .usk-page-order .usk-page-order-heading' => 'text-align:{{VALUE}}; display:block;', |
| 136 |
], |
| 137 |
] |
| 138 |
); |
| 139 |
|
| 140 |
$this->end_controls_section(); |
| 141 |
$this->start_controls_section( |
| 142 |
'section_style_thankyou_orders_style', |
| 143 |
[ |
| 144 |
'label' => __( 'Order Heading', 'ultimate-store-kit' ), |
| 145 |
'tab' => Controls_Manager::TAB_STYLE, |
| 146 |
] |
| 147 |
); |
| 148 |
|
| 149 |
$this->add_group_control( |
| 150 |
Group_Control_Background::get_type(), |
| 151 |
[ |
| 152 |
'name' => 'thankyou_orders_background', |
| 153 |
'label' => esc_html__( 'Background', 'ultimate-store-kit' ), |
| 154 |
'types' => ['classic', 'gradient'], |
| 155 |
'selector' => '{{WRAPPER}} .usk-page-order .usk-page-order-heading', |
| 156 |
] |
| 157 |
); |
| 158 |
|
| 159 |
$this->add_control( |
| 160 |
'thankyou_orders_border_color', |
| 161 |
[ |
| 162 |
'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ), |
| 163 |
'type' => Controls_Manager::COLOR, |
| 164 |
'selectors' => [ |
| 165 |
'{{WRAPPER}} .usk-page-order .usk-page-order-heading' => 'border-color: {{VALUE}};', |
| 166 |
], |
| 167 |
] |
| 168 |
); |
| 169 |
|
| 170 |
$this->start_controls_tabs( |
| 171 |
'tabs_style_thankyou_order' |
| 172 |
); |
| 173 |
|
| 174 |
$this->start_controls_tab( |
| 175 |
'tab_style_thankyou_order_heading', |
| 176 |
[ |
| 177 |
'label' => __( 'Title', 'ultimate-store-kit' ), |
| 178 |
] |
| 179 |
); |
| 180 |
$this->add_control( |
| 181 |
'heading_color', |
| 182 |
[ |
| 183 |
'label' => __( 'Color', 'ultimate-store-kit' ), |
| 184 |
'type' => Controls_Manager::COLOR, |
| 185 |
'selectors' => [ |
| 186 |
'{{WRAPPER}} .usk-page-order .usk-page-order-heading .thankyou-order-heading' => 'color: {{VALUE}}', |
| 187 |
], |
| 188 |
] |
| 189 |
); |
| 190 |
|
| 191 |
$this->add_group_control( |
| 192 |
Group_Control_Typography::get_type(), |
| 193 |
[ |
| 194 |
'name' => 'heading_typography', |
| 195 |
'label' => __( 'Typography', 'ultimate-store-kit' ), |
| 196 |
'selector' => '{{WRAPPER}} .usk-page-order .thankyou-order-heading', |
| 197 |
] |
| 198 |
); |
| 199 |
$this->end_controls_tab(); |
| 200 |
$this->start_controls_tab( |
| 201 |
'tab_style_thankyou_order_desc', |
| 202 |
[ |
| 203 |
'label' => __( 'Description', 'ultimate-store-kit' ), |
| 204 |
] |
| 205 |
); |
| 206 |
$this->add_control( |
| 207 |
'desc_color', |
| 208 |
[ |
| 209 |
'label' => __( 'Color', 'ultimate-store-kit' ), |
| 210 |
'type' => Controls_Manager::COLOR, |
| 211 |
'selectors' => [ |
| 212 |
'{{WRAPPER}} .usk-page-order .thankyou-order-desc ' => 'color: {{VALUE}}', |
| 213 |
], |
| 214 |
] |
| 215 |
); |
| 216 |
$this->add_group_control( |
| 217 |
Group_Control_Typography::get_type(), |
| 218 |
[ |
| 219 |
'name' => 'desc_typography', |
| 220 |
'label' => __( 'Typography', 'ultimate-store-kit' ), |
| 221 |
'selector' => '{{WRAPPER}} .usk-page-order .thankyou-order-desc', |
| 222 |
] |
| 223 |
); |
| 224 |
$this->end_controls_tab(); |
| 225 |
$this->end_controls_tabs(); |
| 226 |
$this->end_controls_section(); |
| 227 |
|
| 228 |
// Order Details List Style Section |
| 229 |
$this->start_controls_section( |
| 230 |
'section_style_order_details_list', |
| 231 |
[ |
| 232 |
'label' => esc_html__( 'Order Card', 'ultimate-store-kit' ), |
| 233 |
'tab' => Controls_Manager::TAB_STYLE, |
| 234 |
] |
| 235 |
); |
| 236 |
|
| 237 |
// Container Style |
| 238 |
$this->add_control( |
| 239 |
'order_list_container_heading', |
| 240 |
[ |
| 241 |
'label' => esc_html__( 'Container', 'ultimate-store-kit' ), |
| 242 |
'type' => Controls_Manager::HEADING, |
| 243 |
] |
| 244 |
); |
| 245 |
|
| 246 |
$this->add_responsive_control( |
| 247 |
'order_list_columns', |
| 248 |
[ |
| 249 |
'label' => esc_html__( 'Columns', 'ultimate-store-kit' ), |
| 250 |
'type' => Controls_Manager::SLIDER, |
| 251 |
'size_units' => ['px'], |
| 252 |
'range' => [ |
| 253 |
'px' => [ |
| 254 |
'min' => 1, |
| 255 |
'max' => 6, |
| 256 |
'step' => 1, |
| 257 |
], |
| 258 |
], |
| 259 |
'selectors' => [ |
| 260 |
'{{WRAPPER}} .order_details' => 'grid-template-columns: repeat({{SIZE}}, 1fr);', |
| 261 |
], |
| 262 |
] |
| 263 |
); |
| 264 |
|
| 265 |
$this->add_responsive_control( |
| 266 |
'order_list_gap', |
| 267 |
[ |
| 268 |
'label' => esc_html__( 'Gap', 'ultimate-store-kit' ), |
| 269 |
'type' => Controls_Manager::SLIDER, |
| 270 |
'size_units' => ['px'], |
| 271 |
'range' => [ |
| 272 |
'px' => [ |
| 273 |
'min' => 0, |
| 274 |
'max' => 50, |
| 275 |
], |
| 276 |
], |
| 277 |
'default' => [ |
| 278 |
'unit' => 'px', |
| 279 |
'size' => 20, |
| 280 |
], |
| 281 |
'selectors' => [ |
| 282 |
'{{WRAPPER}} .order_details' => 'gap: {{SIZE}}{{UNIT}};', |
| 283 |
], |
| 284 |
] |
| 285 |
); |
| 286 |
|
| 287 |
// Typography Style |
| 288 |
$this->add_control( |
| 289 |
'order_list_typography_heading', |
| 290 |
[ |
| 291 |
'label' => esc_html__( 'Items', 'ultimate-store-kit' ), |
| 292 |
'type' => Controls_Manager::HEADING, |
| 293 |
'separator' => 'before', |
| 294 |
] |
| 295 |
); |
| 296 |
|
| 297 |
$this->start_controls_tabs( 'order_list_typography_tabs' ); |
| 298 |
|
| 299 |
$this->start_controls_tab( |
| 300 |
'order_list_typography_wrapper', |
| 301 |
[ |
| 302 |
'label' => esc_html__( 'Wrapper', 'ultimate-store-kit' ), |
| 303 |
] |
| 304 |
); |
| 305 |
$this->add_group_control( |
| 306 |
Group_Control_Background::get_type(), |
| 307 |
[ |
| 308 |
'name' => 'order_list_item_background', |
| 309 |
'label' => esc_html__( 'Background', 'ultimate-store-kit' ), |
| 310 |
'types' => ['classic', 'gradient'], |
| 311 |
'selector' => '{{WRAPPER}} .order_details li', |
| 312 |
'separator' => 'before', |
| 313 |
] |
| 314 |
); |
| 315 |
|
| 316 |
$this->add_control( |
| 317 |
'order_list_item_border_color', |
| 318 |
[ |
| 319 |
'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ), |
| 320 |
'type' => Controls_Manager::COLOR, |
| 321 |
'selectors' => [ |
| 322 |
'{{WRAPPER}} .order_details li' => 'border-color: {{VALUE}};', |
| 323 |
], |
| 324 |
] |
| 325 |
); |
| 326 |
|
| 327 |
$this->add_control( |
| 328 |
'order_list_icon_color_style-border', |
| 329 |
[ |
| 330 |
'label' => esc_html__( 'Style Border Color', 'ultimate-store-kit' ), |
| 331 |
'type' => Controls_Manager::COLOR, |
| 332 |
'selectors' => [ |
| 333 |
'{{WRAPPER}} .usk-page-order .order_details li, {{WRAPPER}} .usk-page-order .order_details li:last-of-type' => 'border-left-color: {{VALUE}} !important;', |
| 334 |
], |
| 335 |
] |
| 336 |
); |
| 337 |
|
| 338 |
$this->end_controls_tab(); |
| 339 |
// Label Typography Tab |
| 340 |
$this->start_controls_tab( |
| 341 |
'order_list_typography_label', |
| 342 |
[ |
| 343 |
'label' => esc_html__( 'Label', 'ultimate-store-kit' ), |
| 344 |
] |
| 345 |
); |
| 346 |
|
| 347 |
$this->add_control( |
| 348 |
'order_list_label_color', |
| 349 |
[ |
| 350 |
'label' => esc_html__( 'Color', 'ultimate-store-kit' ), |
| 351 |
'type' => Controls_Manager::COLOR, |
| 352 |
'selectors' => [ |
| 353 |
'{{WRAPPER}} .order_details li .usk-label' => 'color: {{VALUE}};', |
| 354 |
], |
| 355 |
] |
| 356 |
); |
| 357 |
|
| 358 |
$this->add_group_control( |
| 359 |
Group_Control_Typography::get_type(), |
| 360 |
[ |
| 361 |
'name' => 'order_list_label_typography', |
| 362 |
'selector' => '{{WRAPPER}} .order_details li .usk-label', |
| 363 |
] |
| 364 |
); |
| 365 |
|
| 366 |
$this->end_controls_tab(); |
| 367 |
|
| 368 |
// Value Typography Tab |
| 369 |
$this->start_controls_tab( |
| 370 |
'order_list_typography_value', |
| 371 |
[ |
| 372 |
'label' => esc_html__( 'Value', 'ultimate-store-kit' ), |
| 373 |
] |
| 374 |
); |
| 375 |
|
| 376 |
$this->add_control( |
| 377 |
'order_list_value_color', |
| 378 |
[ |
| 379 |
'label' => esc_html__( 'Color', 'ultimate-store-kit' ), |
| 380 |
'type' => Controls_Manager::COLOR, |
| 381 |
'selectors' => [ |
| 382 |
'{{WRAPPER}} .order_details li .usk-value' => 'color: {{VALUE}};', |
| 383 |
], |
| 384 |
'default' => '#1e293b', |
| 385 |
] |
| 386 |
); |
| 387 |
|
| 388 |
$this->add_control( |
| 389 |
'order_list_total_value_color', |
| 390 |
[ |
| 391 |
'label' => esc_html__( 'Total Value Color', 'ultimate-store-kit' ), |
| 392 |
'type' => Controls_Manager::COLOR, |
| 393 |
'selectors' => [ |
| 394 |
'{{WRAPPER}} .order_details li.total .usk-value' => 'color: {{VALUE}};', |
| 395 |
], |
| 396 |
'default' => '#0f766e', |
| 397 |
] |
| 398 |
); |
| 399 |
|
| 400 |
$this->add_group_control( |
| 401 |
Group_Control_Typography::get_type(), |
| 402 |
[ |
| 403 |
'name' => 'order_list_value_typography', |
| 404 |
'selector' => '{{WRAPPER}} .order_details li .usk-value', |
| 405 |
] |
| 406 |
); |
| 407 |
|
| 408 |
$this->end_controls_tab(); |
| 409 |
|
| 410 |
// Icon Typography Tab |
| 411 |
$this->start_controls_tab( |
| 412 |
'order_list_typography_icon', |
| 413 |
[ |
| 414 |
'label' => esc_html__( 'Icon', 'ultimate-store-kit' ), |
| 415 |
] |
| 416 |
); |
| 417 |
|
| 418 |
$this->add_responsive_control( |
| 419 |
'order_list_icon_size', |
| 420 |
[ |
| 421 |
'label' => esc_html__( 'Size', 'ultimate-store-kit' ), |
| 422 |
'type' => Controls_Manager::SLIDER, |
| 423 |
'size_units' => ['px'], |
| 424 |
'range' => [ |
| 425 |
'px' => [ |
| 426 |
'min' => 10, |
| 427 |
'max' => 50, |
| 428 |
], |
| 429 |
], |
| 430 |
'default' => [ |
| 431 |
'unit' => 'px', |
| 432 |
'size' => 24, |
| 433 |
], |
| 434 |
'selectors' => [ |
| 435 |
'{{WRAPPER}} .order_details li .usk-icon' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 436 |
], |
| 437 |
] |
| 438 |
); |
| 439 |
|
| 440 |
$this->add_control( |
| 441 |
'order_list_icon_global_color', |
| 442 |
[ |
| 443 |
'label' => esc_html__( 'Color', 'ultimate-store-kit' ), |
| 444 |
'type' => Controls_Manager::COLOR, |
| 445 |
'selectors' => [ |
| 446 |
'{{WRAPPER}} .usk-page-order .order_details li .usk-icon' => 'stroke: {{VALUE}}', |
| 447 |
], |
| 448 |
] |
| 449 |
); |
| 450 |
|
| 451 |
$this->end_controls_tab(); |
| 452 |
|
| 453 |
$this->end_controls_tabs(); |
| 454 |
|
| 455 |
$this->end_controls_section(); |
| 456 |
|
| 457 |
$this->start_controls_section( |
| 458 |
'style_section_order_details', |
| 459 |
[ |
| 460 |
'label' => esc_html__( 'Order Details', 'ultimate-store-kit' ), |
| 461 |
'tab' => Controls_Manager::TAB_STYLE, |
| 462 |
] |
| 463 |
); |
| 464 |
$this->start_controls_tabs( 'order_details_title_tabs' ); |
| 465 |
|
| 466 |
$this->start_controls_tab( |
| 467 |
'order_details_wrap_tab', |
| 468 |
[ |
| 469 |
'label' => esc_html__( 'Wrapper', 'ultimate-store-kit' ), |
| 470 |
] |
| 471 |
); |
| 472 |
|
| 473 |
$this->add_group_control( |
| 474 |
Group_Control_Background::get_type(), |
| 475 |
[ |
| 476 |
'name' => 'order_details_wrap_background', |
| 477 |
'label' => esc_html__( 'Background', 'ultimate-store-kit' ), |
| 478 |
'types' => ['classic', 'gradient'], |
| 479 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details', |
| 480 |
] |
| 481 |
); |
| 482 |
|
| 483 |
$this->add_control( |
| 484 |
'order_details_wrap_border_color', |
| 485 |
[ |
| 486 |
'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ), |
| 487 |
'type' => Controls_Manager::COLOR, |
| 488 |
'selectors' => [ |
| 489 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details' => 'border-color: {{VALUE}};', |
| 490 |
], |
| 491 |
] |
| 492 |
); |
| 493 |
|
| 494 |
$this->end_controls_tab(); |
| 495 |
|
| 496 |
$this->start_controls_tab( |
| 497 |
'order_details_heading_tab', |
| 498 |
[ |
| 499 |
'label' => esc_html__( 'Title', 'ultimate-store-kit' ), |
| 500 |
] |
| 501 |
); |
| 502 |
|
| 503 |
$this->add_control( |
| 504 |
'order_details_title_color', |
| 505 |
[ |
| 506 |
'label' => esc_html__( 'Color', 'ultimate-store-kit' ), |
| 507 |
'type' => Controls_Manager::COLOR, |
| 508 |
'selectors' => [ |
| 509 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details__title' => 'color: {{VALUE}}', |
| 510 |
], |
| 511 |
] |
| 512 |
); |
| 513 |
|
| 514 |
$this->add_control( |
| 515 |
'order_details_title_border_color', |
| 516 |
[ |
| 517 |
'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ), |
| 518 |
'type' => Controls_Manager::COLOR, |
| 519 |
'selectors' => [ |
| 520 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details__title::after' => 'background: {{VALUE}}', |
| 521 |
], |
| 522 |
] |
| 523 |
); |
| 524 |
|
| 525 |
$this->add_group_control( |
| 526 |
Group_Control_Typography::get_type(), |
| 527 |
[ |
| 528 |
'name' => 'order_details_title_typography', |
| 529 |
'label' => esc_html__( 'Typography', 'ultimate-store-kit' ), |
| 530 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details__title', |
| 531 |
] |
| 532 |
); |
| 533 |
|
| 534 |
$this->end_controls_tab(); |
| 535 |
|
| 536 |
$this->end_controls_tabs(); |
| 537 |
|
| 538 |
$this->add_control( |
| 539 |
'order_details_tabs_heading', |
| 540 |
[ |
| 541 |
'label' => esc_html__( 'Table', 'ultimate-store-kit' ), |
| 542 |
'type' => Controls_Manager::HEADING, |
| 543 |
'separator' => 'before', |
| 544 |
] |
| 545 |
); |
| 546 |
|
| 547 |
$this->start_controls_tabs( 'order_details_tabs_tables' ); |
| 548 |
|
| 549 |
$this->start_controls_tab( |
| 550 |
'order_details_tabs_table_header', |
| 551 |
[ |
| 552 |
'label' => esc_html__( 'Header', 'ultimate-store-kit' ), |
| 553 |
] |
| 554 |
); |
| 555 |
|
| 556 |
$this->add_group_control( |
| 557 |
Group_Control_Background::get_type(), |
| 558 |
[ |
| 559 |
'name' => 'table_header_background', |
| 560 |
'label' => esc_html__( 'Background', 'ultimate-store-kit' ), |
| 561 |
'types' => ['classic', 'gradient'], |
| 562 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table thead , {{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tfoot tr:last-child', |
| 563 |
] |
| 564 |
); |
| 565 |
|
| 566 |
$this->add_control( |
| 567 |
'table_header_color', |
| 568 |
[ |
| 569 |
'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ), |
| 570 |
'type' => Controls_Manager::COLOR, |
| 571 |
'selectors' => [ |
| 572 |
'{{WRAPPER}} .usk-page-order .woocommerce-table thead th, {{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tfoot tr:last-child th' => 'color: {{VALUE}};', |
| 573 |
], |
| 574 |
] |
| 575 |
); |
| 576 |
|
| 577 |
$this->add_group_control( |
| 578 |
Group_Control_Typography::get_type(), |
| 579 |
[ |
| 580 |
'name' => 'table_header_typography', |
| 581 |
'label' => esc_html__( 'Typography', 'ultimate-store-kit' ), |
| 582 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table thead th', |
| 583 |
] |
| 584 |
); |
| 585 |
|
| 586 |
$this->end_controls_tab(); |
| 587 |
|
| 588 |
$this->start_controls_tab( |
| 589 |
'order_details_tabs_table_body', |
| 590 |
[ |
| 591 |
'label' => esc_html__( 'Body', 'ultimate-store-kit' ), |
| 592 |
] |
| 593 |
); |
| 594 |
|
| 595 |
$this->add_control( |
| 596 |
'table_body_odd_row', |
| 597 |
[ |
| 598 |
'label' => esc_html__( 'Odd Row', 'ultimate-store-kit' ), |
| 599 |
'type' => Controls_Manager::HEADING, |
| 600 |
] |
| 601 |
); |
| 602 |
|
| 603 |
$this->add_control( |
| 604 |
'table_body_odd_row_bg_color', |
| 605 |
[ |
| 606 |
'label' => esc_html__( 'Background Color', 'ultimate-store-kit' ), |
| 607 |
'type' => Controls_Manager::COLOR, |
| 608 |
'selectors' => [ |
| 609 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tbody tr:nth-child(odd)' => 'background-color: {{VALUE}};', |
| 610 |
], |
| 611 |
] |
| 612 |
); |
| 613 |
|
| 614 |
$this->add_control( |
| 615 |
'table_body_odd_row_text_color', |
| 616 |
[ |
| 617 |
'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ), |
| 618 |
'type' => Controls_Manager::COLOR, |
| 619 |
'selectors' => [ |
| 620 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(odd) td.product-name a' => 'color: {{VALUE}};', |
| 621 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(odd) td .product-quantity' => 'color: {{VALUE}};', |
| 622 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(odd) td.product-total .amount' => 'color: {{VALUE}};', |
| 623 |
], |
| 624 |
] |
| 625 |
); |
| 626 |
|
| 627 |
$this->add_control( |
| 628 |
'table_body_even_row', |
| 629 |
[ |
| 630 |
'label' => esc_html__( 'Even Row', 'ultimate-store-kit' ), |
| 631 |
'type' => Controls_Manager::HEADING, |
| 632 |
'separator' => 'before', |
| 633 |
] |
| 634 |
); |
| 635 |
|
| 636 |
$this->add_control( |
| 637 |
'table_body_even_row_bg_color', |
| 638 |
[ |
| 639 |
'label' => esc_html__( 'Background Color', 'ultimate-store-kit' ), |
| 640 |
'type' => Controls_Manager::COLOR, |
| 641 |
'selectors' => [ |
| 642 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tbody tr:nth-child(even)' => 'background-color: {{VALUE}};', |
| 643 |
], |
| 644 |
] |
| 645 |
); |
| 646 |
|
| 647 |
$this->add_control( |
| 648 |
'table_body_even_row_text_color', |
| 649 |
[ |
| 650 |
'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ), |
| 651 |
'type' => Controls_Manager::COLOR, |
| 652 |
'selectors' => [ |
| 653 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(even) td.product-name a' => 'color: {{VALUE}};', |
| 654 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(even) td .product-quantity' => 'color: {{VALUE}};', |
| 655 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tbody tr:nth-child(even) td.product-total .amount' => 'color: {{VALUE}};', |
| 656 |
], |
| 657 |
'separator' => 'after', |
| 658 |
] |
| 659 |
); |
| 660 |
|
| 661 |
$this->add_group_control( |
| 662 |
Group_Control_Typography::get_type(), |
| 663 |
[ |
| 664 |
'name' => 'table_body_typography', |
| 665 |
'label' => esc_html__( 'Typography', 'ultimate-store-kit' ), |
| 666 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td', |
| 667 |
] |
| 668 |
); |
| 669 |
|
| 670 |
$this->add_control( |
| 671 |
'table_body_meta_heading', |
| 672 |
[ |
| 673 |
'label' => esc_html__( 'Meta Data', 'ultimate-store-kit' ), |
| 674 |
'type' => Controls_Manager::HEADING, |
| 675 |
'separator' => 'before', |
| 676 |
] |
| 677 |
); |
| 678 |
|
| 679 |
$this->add_control( |
| 680 |
'table_body_meta_color', |
| 681 |
[ |
| 682 |
'label' => esc_html__( 'Color', 'ultimate-store-kit' ), |
| 683 |
'type' => Controls_Manager::COLOR, |
| 684 |
'selectors' => [ |
| 685 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dt' => 'color: {{VALUE}};', |
| 686 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dd' => 'color: {{VALUE}};', |
| 687 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li' => 'color: {{VALUE}};', |
| 688 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li p' => 'color: {{VALUE}};', |
| 689 |
], |
| 690 |
] |
| 691 |
); |
| 692 |
|
| 693 |
$this->add_group_control( |
| 694 |
Group_Control_Typography::get_type(), |
| 695 |
[ |
| 696 |
'name' => 'table_body_meta_typography', |
| 697 |
'label' => esc_html__( 'Typography', 'ultimate-store-kit' ), |
| 698 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dt, {{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name dl dd, {{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li, {{WRAPPER}} .usk-page-order .woocommerce-table tbody td.product-name .wc-item-meta li p', |
| 699 |
] |
| 700 |
); |
| 701 |
|
| 702 |
$this->end_controls_tab(); |
| 703 |
|
| 704 |
$this->start_controls_tab( |
| 705 |
'order_details_tabs_table_footer', |
| 706 |
[ |
| 707 |
'label' => esc_html__( 'Footer', 'ultimate-store-kit' ), |
| 708 |
] |
| 709 |
); |
| 710 |
|
| 711 |
$this->add_group_control( |
| 712 |
Group_Control_Background::get_type(), |
| 713 |
[ |
| 714 |
'name' => 'table_footer_background', |
| 715 |
'label' => esc_html__( 'Background', 'ultimate-store-kit' ), |
| 716 |
'types' => ['classic', 'gradient'], |
| 717 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tfoot', |
| 718 |
] |
| 719 |
); |
| 720 |
|
| 721 |
$this->add_control( |
| 722 |
'table_footer_text_color', |
| 723 |
[ |
| 724 |
'label' => esc_html__( 'Text Color', 'ultimate-store-kit' ), |
| 725 |
'type' => Controls_Manager::COLOR, |
| 726 |
'selectors' => [ |
| 727 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr th' => 'color: {{VALUE}};', |
| 728 |
'{{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr td' => 'color: {{VALUE}};', |
| 729 |
], |
| 730 |
] |
| 731 |
); |
| 732 |
|
| 733 |
$this->add_control( |
| 734 |
'table_footer_total_color', |
| 735 |
[ |
| 736 |
'label' => esc_html__( 'Total Amount Color', 'ultimate-store-kit' ), |
| 737 |
'type' => Controls_Manager::COLOR, |
| 738 |
'selectors' => [ |
| 739 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .woocommerce-table tfoot tr:last-child td .amount' => 'color: {{VALUE}};', |
| 740 |
], |
| 741 |
] |
| 742 |
); |
| 743 |
|
| 744 |
$this->add_group_control( |
| 745 |
Group_Control_Typography::get_type(), |
| 746 |
[ |
| 747 |
'name' => 'table_footer_typography', |
| 748 |
'label' => esc_html__( 'Typography', 'ultimate-store-kit' ), |
| 749 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr th, {{WRAPPER}} .usk-page-order .woocommerce-table tfoot tr td', |
| 750 |
] |
| 751 |
); |
| 752 |
|
| 753 |
$this->end_controls_tab(); |
| 754 |
|
| 755 |
$this->end_controls_tabs(); |
| 756 |
|
| 757 |
$this->add_control( |
| 758 |
'order_again_button_heading', |
| 759 |
[ |
| 760 |
'label' => esc_html__( 'Order Button', 'ultimate-store-kit' ), |
| 761 |
'type' => Controls_Manager::HEADING, |
| 762 |
'separator' => 'before', |
| 763 |
] |
| 764 |
); |
| 765 |
|
| 766 |
$this->start_controls_tabs( 'order_again_button_tabs' ); |
| 767 |
$this->start_controls_tab( |
| 768 |
'tab_order_again_button_normal', |
| 769 |
[ |
| 770 |
'label' => __( 'Normal', 'ultimate-store-kit' ), |
| 771 |
] |
| 772 |
); |
| 773 |
|
| 774 |
$this->add_control( |
| 775 |
'order_again_button_text_color', |
| 776 |
[ |
| 777 |
'label' => __( 'Color', 'ultimate-store-kit' ), |
| 778 |
'type' => Controls_Manager::COLOR, |
| 779 |
'default' => '#fff', |
| 780 |
'selectors' => [ |
| 781 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button' => 'color: {{VALUE}};', |
| 782 |
], |
| 783 |
] |
| 784 |
); |
| 785 |
|
| 786 |
$this->add_group_control( |
| 787 |
Group_Control_Background::get_type(), |
| 788 |
[ |
| 789 |
'name' => 'order_again_button_background', |
| 790 |
'label' => __( 'Background', 'ultimate-store-kit' ), |
| 791 |
'types' => ['classic', 'gradient'], |
| 792 |
'exclude' => ['image'], |
| 793 |
'fields_options' => [ |
| 794 |
'background' => [ |
| 795 |
'default' => 'classic', |
| 796 |
], |
| 797 |
'color' => [ |
| 798 |
'default' => '#1E87F0', |
| 799 |
], |
| 800 |
], |
| 801 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button', |
| 802 |
] |
| 803 |
); |
| 804 |
|
| 805 |
$this->add_group_control( |
| 806 |
Group_Control_Border::get_type(), |
| 807 |
[ |
| 808 |
'name' => 'order_again_button_border', |
| 809 |
'label' => __( 'Border', 'ultimate-store-kit' ), |
| 810 |
'default' => 'n', |
| 811 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button', |
| 812 |
] |
| 813 |
); |
| 814 |
|
| 815 |
$this->add_control( |
| 816 |
'order_again_button_border_radius', |
| 817 |
[ |
| 818 |
'label' => __( 'Border Radius', 'ultimate-store-kit' ), |
| 819 |
'type' => Controls_Manager::DIMENSIONS, |
| 820 |
'size_units' => ['px', 'rem', '%'], |
| 821 |
'selectors' => [ |
| 822 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 823 |
], |
| 824 |
] |
| 825 |
); |
| 826 |
|
| 827 |
$this->add_responsive_control( |
| 828 |
'order_again_button_padding', |
| 829 |
[ |
| 830 |
'label' => __( 'Padding', 'ultimate-store-kit' ), |
| 831 |
'type' => Controls_Manager::DIMENSIONS, |
| 832 |
'size_units' => ['px', 'rem', '%'], |
| 833 |
'selectors' => [ |
| 834 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 835 |
], |
| 836 |
] |
| 837 |
); |
| 838 |
|
| 839 |
$this->add_group_control( |
| 840 |
Group_Control_Typography::get_type(), |
| 841 |
[ |
| 842 |
'name' => 'order_again_button_typography', |
| 843 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button', |
| 844 |
] |
| 845 |
); |
| 846 |
|
| 847 |
$this->add_group_control( |
| 848 |
Group_Control_Box_Shadow::get_type(), |
| 849 |
[ |
| 850 |
'name' => 'order_again_button_box_shadow', |
| 851 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button', |
| 852 |
] |
| 853 |
); |
| 854 |
|
| 855 |
$this->end_controls_tab(); |
| 856 |
$this->start_controls_tab( |
| 857 |
'tab_order_again_button_hover', |
| 858 |
[ |
| 859 |
'label' => __( 'Hover', 'ultimate-store-kit' ), |
| 860 |
] |
| 861 |
); |
| 862 |
|
| 863 |
$this->add_control( |
| 864 |
'order_again_button_hover_color', |
| 865 |
[ |
| 866 |
'label' => __( 'Color', 'ultimate-store-kit' ), |
| 867 |
'type' => Controls_Manager::COLOR, |
| 868 |
'selectors' => [ |
| 869 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button:hover' => 'color: {{VALUE}};', |
| 870 |
], |
| 871 |
] |
| 872 |
); |
| 873 |
|
| 874 |
$this->add_control( |
| 875 |
'order_again_button_hover_border_color', |
| 876 |
[ |
| 877 |
'label' => __( 'Border Color', 'ultimate-store-kit' ), |
| 878 |
'type' => Controls_Manager::COLOR, |
| 879 |
'condition' => [ |
| 880 |
'order_again_button_border_border!' => 'none', |
| 881 |
], |
| 882 |
'selectors' => [ |
| 883 |
'{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button:hover' => 'border-color: {{VALUE}};', |
| 884 |
], |
| 885 |
] |
| 886 |
); |
| 887 |
|
| 888 |
$this->add_group_control( |
| 889 |
Group_Control_Background::get_type(), |
| 890 |
[ |
| 891 |
'name' => 'order_again_button_hover_background', |
| 892 |
'label' => __( 'Background', 'ultimate-store-kit' ), |
| 893 |
'exclude' => ['image'], |
| 894 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-order-details .order-again .button:hover', |
| 895 |
] |
| 896 |
); |
| 897 |
|
| 898 |
$this->end_controls_tab(); |
| 899 |
$this->end_controls_tabs(); |
| 900 |
|
| 901 |
$this->end_controls_section(); |
| 902 |
|
| 903 |
$this->start_controls_section( |
| 904 |
'styles_section_thankyou_address_details', |
| 905 |
[ |
| 906 |
'label' => esc_html__( 'Address Details', 'ultimate-store-kit' ), |
| 907 |
'tab' => Controls_Manager::TAB_STYLE, |
| 908 |
] |
| 909 |
); |
| 910 |
|
| 911 |
$this->start_controls_tabs( 'thankyou_address_details_tabs' ); |
| 912 |
|
| 913 |
$this->start_controls_tab( |
| 914 |
'thankyou_address_details_wrapper', |
| 915 |
[ |
| 916 |
'label' => esc_html__( 'Wrapper', 'ultimate-store-kit' ), |
| 917 |
] |
| 918 |
); |
| 919 |
|
| 920 |
$this->add_group_control( |
| 921 |
Group_Control_Background::get_type(), |
| 922 |
[ |
| 923 |
'name' => 'thankyou_address_details_background', |
| 924 |
'label' => esc_html__( 'Background', 'ultimate-store-kit' ), |
| 925 |
'types' => ['classic', 'gradient'], |
| 926 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column', |
| 927 |
] |
| 928 |
); |
| 929 |
|
| 930 |
$this->add_control( |
| 931 |
'thankyou_address_details_border_color', |
| 932 |
[ |
| 933 |
'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ), |
| 934 |
'type' => Controls_Manager::COLOR, |
| 935 |
'selectors' => [ |
| 936 |
'{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column' => 'border-color: {{VALUE}};', |
| 937 |
], |
| 938 |
] |
| 939 |
); |
| 940 |
|
| 941 |
$this->end_controls_tab(); |
| 942 |
|
| 943 |
$this->start_controls_tab( |
| 944 |
'thankyou_address_details_title_tab', |
| 945 |
[ |
| 946 |
'label' => esc_html__( 'Title', 'ultimate-store-kit' ), |
| 947 |
] |
| 948 |
); |
| 949 |
|
| 950 |
$this->add_control( |
| 951 |
'thankyou_address_details_title_color', |
| 952 |
[ |
| 953 |
'label' => esc_html__( 'Color', 'ultimate-store-kit' ), |
| 954 |
'type' => Controls_Manager::COLOR, |
| 955 |
'selectors' => [ |
| 956 |
'{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column__title' => 'color: {{VALUE}};', |
| 957 |
], |
| 958 |
] |
| 959 |
); |
| 960 |
|
| 961 |
$this->add_control( |
| 962 |
'thankyou_address_details_title_border_color', |
| 963 |
[ |
| 964 |
'label' => esc_html__( 'Border Color', 'ultimate-store-kit' ), |
| 965 |
'type' => Controls_Manager::COLOR, |
| 966 |
'selectors' => [ |
| 967 |
'{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column__title::after' => 'background: {{VALUE}};', |
| 968 |
], |
| 969 |
] |
| 970 |
); |
| 971 |
|
| 972 |
$this->add_group_control( |
| 973 |
Group_Control_Typography::get_type(), |
| 974 |
[ |
| 975 |
'name' => 'thankyou_address_details_title_typography', |
| 976 |
'label' => esc_html__( 'Typography', 'ultimate-store-kit' ), |
| 977 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column__title', |
| 978 |
] |
| 979 |
); |
| 980 |
|
| 981 |
$this->end_controls_tab(); |
| 982 |
|
| 983 |
$this->start_controls_tab( |
| 984 |
'thankyou_address_details_address_tab', |
| 985 |
[ |
| 986 |
'label' => esc_html__( 'Address', 'ultimate-store-kit' ), |
| 987 |
] |
| 988 |
); |
| 989 |
|
| 990 |
$this->add_control( |
| 991 |
'thankyou_address_details_address_color', |
| 992 |
[ |
| 993 |
'label' => esc_html__( 'Color', 'ultimate-store-kit' ), |
| 994 |
'type' => Controls_Manager::COLOR, |
| 995 |
'selectors' => [ |
| 996 |
'{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column address, |
| 997 |
{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column p' => 'color: {{VALUE}};', |
| 998 |
], |
| 999 |
] |
| 1000 |
); |
| 1001 |
|
| 1002 |
$this->add_group_control( |
| 1003 |
Group_Control_Typography::get_type(), |
| 1004 |
[ |
| 1005 |
'name' => 'thankyou_address_details_address_typography', |
| 1006 |
'label' => esc_html__( 'Typography', 'ultimate-store-kit' ), |
| 1007 |
'selector' => '{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column address, |
| 1008 |
{{WRAPPER}} .usk-page-order .woocommerce-customer-details .woocommerce-columns .woocommerce-column p', |
| 1009 |
] |
| 1010 |
); |
| 1011 |
|
| 1012 |
$this->end_controls_tabs(); |
| 1013 |
|
| 1014 |
$this->end_controls_section(); |
| 1015 |
} |
| 1016 |
|
| 1017 |
protected function get_last_order_id() { |
| 1018 |
global $wpdb; |
| 1019 |
|
| 1020 |
$statuses = array_keys( wc_get_order_statuses() ); |
| 1021 |
|
| 1022 |
if ( empty( $statuses ) ) { |
| 1023 |
return 0; |
| 1024 |
} |
| 1025 |
|
| 1026 |
// The status list is variable-length, so the placeholders are generated from |
| 1027 |
// its count; every value itself still goes through prepare(). |
| 1028 |
$placeholders = implode( ', ', array_fill( 0, count( $statuses ), '%s' ) ); |
| 1029 |
|
| 1030 |
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- Editor-preview helper run once per preview render. $placeholders is a generated run of %s, never data; the values are bound by prepare(). |
| 1031 |
$results = $wpdb->get_col( |
| 1032 |
$wpdb->prepare( |
| 1033 |
"SELECT MAX(ID) FROM {$wpdb->posts} WHERE post_type = 'shop_order' AND post_status IN ({$placeholders})", |
| 1034 |
$statuses |
| 1035 |
) |
| 1036 |
); |
| 1037 |
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare |
| 1038 |
|
| 1039 |
return $results ? reset( $results ) : 0; |
| 1040 |
} |
| 1041 |
|
| 1042 |
public function order_thank_you( $order ) { |
| 1043 |
$settings = $this->get_settings_for_display(); |
| 1044 |
$order_received_text = $settings['thankyou_order_received_text']; |
| 1045 |
|
| 1046 |
?> |
| 1047 |
<div class="usk-page-order-heading"> |
| 1048 |
<?php |
| 1049 |
if ( $settings['thankyou_show_order_id'] === 'yes' ): |
| 1050 |
printf( '<h3 class="thankyou-order-heading">%1$s # %2$s</h3>', esc_html__( 'Order', 'ultimate-store-kit' ), esc_html( $order->get_order_number() ) ); |
| 1051 |
endif; ?> |
| 1052 |
<p class="thankyou-order-desc"> |
| 1053 |
<?php |
| 1054 |
if ( $order->has_status( 'failed' ) ): |
| 1055 |
echo esc_html__( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'ultimate-store-kit' ); |
| 1056 |
?> |
| 1057 |
<?php else: |
| 1058 |
echo wp_kses_post( apply_filters( 'woocommerce_thankyou_order_received_text', esc_html( $order_received_text ), $order ) ); |
| 1059 |
endif; ?> |
| 1060 |
</p> |
| 1061 |
</div> |
| 1062 |
<?php |
| 1063 |
} |
| 1064 |
|
| 1065 |
public function thank_your_order_details( $order ) { |
| 1066 |
$order_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) ); |
| 1067 |
$show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', [ 'completed', 'processing' ] ) ); |
| 1068 |
$downloads = $order->get_downloadable_items(); |
| 1069 |
$show_downloads = $order->has_downloadable_item() && $order->is_download_permitted(); |
| 1070 |
?> |
| 1071 |
<?php |
| 1072 |
|
| 1073 |
if ( $show_downloads ) { |
| 1074 |
wc_get_template( |
| 1075 |
'order/order-downloads.php', |
| 1076 |
[ |
| 1077 |
'downloads' => $downloads, |
| 1078 |
'show_title' => true, |
| 1079 |
] |
| 1080 |
); |
| 1081 |
} |
| 1082 |
|
| 1083 |
?> |
| 1084 |
<div class="woocommerce-order-details"> |
| 1085 |
<?php do_action( 'woocommerce_order_details_before_order_table', $order ); ?> |
| 1086 |
|
| 1087 |
<h2 class="woocommerce-order-details__title"><?php esc_html_e( 'Order details', 'ultimate-store-kit' ); ?></h2> |
| 1088 |
|
| 1089 |
<table class="woocommerce-table woocommerce-table--order-details shop_table order_details"> |
| 1090 |
|
| 1091 |
<thead> |
| 1092 |
<tr> |
| 1093 |
<th class="woocommerce-table__product-name product-name"><?php esc_html_e( 'Product', 'ultimate-store-kit' ); ?> |
| 1094 |
</th> |
| 1095 |
<th class="woocommerce-table__product-table product-total"><?php esc_html_e( 'Total', 'ultimate-store-kit' ); ?> |
| 1096 |
</th> |
| 1097 |
</tr> |
| 1098 |
</thead> |
| 1099 |
|
| 1100 |
<tbody> |
| 1101 |
<?php |
| 1102 |
do_action( 'woocommerce_order_details_before_order_table_items', $order ); |
| 1103 |
|
| 1104 |
foreach ( $order_items as $item_id => $item ) { |
| 1105 |
$product = $item->get_product(); |
| 1106 |
|
| 1107 |
wc_get_template( |
| 1108 |
'order/order-details-item.php', |
| 1109 |
[ |
| 1110 |
'order' => $order, |
| 1111 |
'item_id' => $item_id, |
| 1112 |
'item' => $item, |
| 1113 |
'show_purchase_note' => $show_purchase_note, |
| 1114 |
'purchase_note' => $product ? $product->get_purchase_note() : '', |
| 1115 |
'product' => $product, |
| 1116 |
] |
| 1117 |
); |
| 1118 |
} |
| 1119 |
|
| 1120 |
do_action( 'woocommerce_order_details_after_order_table_items', $order ); |
| 1121 |
?> |
| 1122 |
</tbody> |
| 1123 |
|
| 1124 |
<tfoot> |
| 1125 |
<?php |
| 1126 |
|
| 1127 |
foreach ( $order->get_order_item_totals() as $key => $total ) { |
| 1128 |
?> |
| 1129 |
<tr> |
| 1130 |
<th scope="row"><?php echo esc_html( $total['label'] ); ?></th> |
| 1131 |
<td><?php echo( 'payment_method' === $key ) ? esc_html( $total['value'] ) : wp_kses_post( $total['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1132 |
?></td> |
| 1133 |
</tr> |
| 1134 |
<?php |
| 1135 |
} |
| 1136 |
|
| 1137 |
?> |
| 1138 |
<?php |
| 1139 |
if ( $order->get_customer_note() ): ?> |
| 1140 |
<tr> |
| 1141 |
<th><?php esc_html_e( 'Note:', 'ultimate-store-kit' ); ?></th> |
| 1142 |
<td><?php echo wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ); ?></td> |
| 1143 |
</tr> |
| 1144 |
<?php endif; ?> |
| 1145 |
</tfoot> |
| 1146 |
</table> |
| 1147 |
<?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?> |
| 1148 |
</div> |
| 1149 |
|
| 1150 |
<?php |
| 1151 |
/** |
| 1152 |
* Action hook fired after the order details. |
| 1153 |
* |
| 1154 |
* @since 4.4.0 |
| 1155 |
* @param WC_Order $order Order data. |
| 1156 |
*/ |
| 1157 |
do_action( 'woocommerce_after_order_details', $order ); |
| 1158 |
} |
| 1159 |
|
| 1160 |
public function thank_you_order_confirmation( $order ) {?> |
| 1161 |
<ul class="order_details"> |
| 1162 |
<li class="order"> |
| 1163 |
<svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 1164 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" |
| 1165 |
d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" /> |
| 1166 |
</svg> |
| 1167 |
<span class="usk-label"><?php esc_html_e( 'Order number:', 'ultimate-store-kit' ); ?></span> |
| 1168 |
<strong class="usk-value"><?php echo esc_html( $order->get_order_number() ); ?></strong> |
| 1169 |
</li> |
| 1170 |
<li class="date"> |
| 1171 |
<svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 1172 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" |
| 1173 |
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" /> |
| 1174 |
</svg> |
| 1175 |
<span class="usk-label"><?php esc_html_e( 'Order Date:', 'ultimate-store-kit' ); ?></span> |
| 1176 |
<strong class="usk-value"><?php echo esc_html( wc_format_datetime( $order->get_date_created() ) ); ?></strong> |
| 1177 |
</li> |
| 1178 |
<li class="order-status"> |
| 1179 |
<svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 1180 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" |
| 1181 |
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> |
| 1182 |
</svg> |
| 1183 |
<span class="usk-label"><?php echo esc_html__( 'Order status', 'ultimate-store-kit' ); ?></span> |
| 1184 |
<strong class="usk-value"><?php echo wp_kses_post( wc_get_order_status_name( $order->get_status() ) ); ?></strong> |
| 1185 |
</li> |
| 1186 |
<li class="total"> |
| 1187 |
<svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 1188 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" |
| 1189 |
d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /> |
| 1190 |
</svg> |
| 1191 |
<span class="usk-label"><?php esc_html_e( 'Total:', 'ultimate-store-kit' ); ?></span> |
| 1192 |
<strong class="usk-value"><?php echo wp_kses_post( $order->get_formatted_order_total() ); ?></strong> |
| 1193 |
</li> |
| 1194 |
<?php |
| 1195 |
if ( $order->get_payment_method_title() ): ?> |
| 1196 |
<li class="method"> |
| 1197 |
<svg class="usk-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 1198 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" |
| 1199 |
d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" /> |
| 1200 |
</svg> |
| 1201 |
<span class="usk-label"><?php esc_html_e( 'Payment method:', 'ultimate-store-kit' ); ?></span> |
| 1202 |
<strong class="usk-value"><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong> |
| 1203 |
</li> |
| 1204 |
<?php endif; ?> |
| 1205 |
</ul> |
| 1206 |
<?php |
| 1207 |
} |
| 1208 |
|
| 1209 |
public function thank_you_customer_address( $order ) { |
| 1210 |
$show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id(); |
| 1211 |
|
| 1212 |
if ( $show_customer_details ) { |
| 1213 |
$show_shipping = !wc_ship_to_billing_address_only() && $order->needs_shipping_address(); |
| 1214 |
?> |
| 1215 |
<div class="woocommerce-customer-details"> |
| 1216 |
<?php |
| 1217 |
if ( $show_shipping ): ?> |
| 1218 |
|
| 1219 |
<div class="woocommerce-columns woocommerce-columns--2 woocommerce-columns--addresses col2-set addresses"> |
| 1220 |
<div class="woocommerce-column woocommerce-column--1 woocommerce-column--billing-address col-1"> |
| 1221 |
<?php endif; ?> |
| 1222 |
|
| 1223 |
<h2 class="woocommerce-column__title"><?php esc_html_e( 'Billing address', 'ultimate-store-kit' ); ?></h2> |
| 1224 |
|
| 1225 |
<address> |
| 1226 |
<?php echo wp_kses_post( $order->get_formatted_billing_address( esc_html__( 'N/A', 'ultimate-store-kit' ) ) ); ?> |
| 1227 |
|
| 1228 |
<?php |
| 1229 |
if ( $order->get_billing_phone() ): ?> |
| 1230 |
<p class="woocommerce-customer-details--phone"><?php echo esc_html( $order->get_billing_phone() ); ?></p> |
| 1231 |
<?php endif; ?> |
| 1232 |
|
| 1233 |
<?php |
| 1234 |
if ( $order->get_billing_email() ): ?> |
| 1235 |
<p class="woocommerce-customer-details--email"><?php echo esc_html( $order->get_billing_email() ); ?></p> |
| 1236 |
<?php endif; ?> |
| 1237 |
</address> |
| 1238 |
|
| 1239 |
<?php |
| 1240 |
if ( $show_shipping ): ?> |
| 1241 |
|
| 1242 |
</div><!-- /.col-1 --> |
| 1243 |
|
| 1244 |
<div class="woocommerce-column woocommerce-column--2 woocommerce-column--shipping-address col-2"> |
| 1245 |
<h2 class="woocommerce-column__title"><?php esc_html_e( 'Shipping address', 'ultimate-store-kit' ); ?></h2> |
| 1246 |
<address> |
| 1247 |
<?php echo wp_kses_post( $order->get_formatted_shipping_address( esc_html__( 'N/A', 'ultimate-store-kit' ) ) ); ?> |
| 1248 |
<?php |
| 1249 |
if ( $order->get_shipping_phone() ): ?> |
| 1250 |
<p class="woocommerce-customer-details--phone"><?php echo esc_html( $order->get_shipping_phone() ); ?></p> |
| 1251 |
<?php endif; ?> |
| 1252 |
</address> |
| 1253 |
</div><!-- /.col-2 --> |
| 1254 |
</div><!-- /.col2-set --> |
| 1255 |
|
| 1256 |
<?php endif; ?> |
| 1257 |
|
| 1258 |
<?php do_action( 'woocommerce_order_details_after_customer_details', $order ); ?> |
| 1259 |
|
| 1260 |
</div> |
| 1261 |
<?php |
| 1262 |
} |
| 1263 |
|
| 1264 |
} |
| 1265 |
|
| 1266 |
public function render() { |
| 1267 |
|
| 1268 |
// Check if we're in Elementor editor |
| 1269 |
if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { |
| 1270 |
// Get last order for preview |
| 1271 |
$orders = wc_get_orders( [ 'limit' => 1 ] ); |
| 1272 |
|
| 1273 |
if ( !empty( $orders ) ) { |
| 1274 |
$order = $orders[0]; |
| 1275 |
} else { |
| 1276 |
echo esc_html__( 'No orders found. Please create a test order to preview this widget.', 'ultimate-store-kit' ); |
| 1277 |
return; |
| 1278 |
} |
| 1279 |
|
| 1280 |
} else { |
| 1281 |
// Normal frontend rendering |
| 1282 |
global $wp; |
| 1283 |
$order_id = isset( $wp->query_vars['order-received'] ) ? $wp->query_vars['order-received'] : $this->get_last_order_id(); |
| 1284 |
|
| 1285 |
if ( !$order_id ) { |
| 1286 |
return; |
| 1287 |
} |
| 1288 |
|
| 1289 |
$order = wc_get_order( $order_id ); |
| 1290 |
} |
| 1291 |
|
| 1292 |
if ( !$order ) { |
| 1293 |
return; |
| 1294 |
} |
| 1295 |
|
| 1296 |
?> |
| 1297 |
<div class="usk-page-order"> |
| 1298 |
<?php |
| 1299 |
$this->order_thank_you( $order ); |
| 1300 |
$this->thank_you_order_confirmation( $order ); |
| 1301 |
$this->thank_your_order_details( $order ); |
| 1302 |
$this->thank_you_customer_address( $order ); |
| 1303 |
?> |
| 1304 |
</div> |
| 1305 |
<?php |
| 1306 |
} |
| 1307 |
|
| 1308 |
} |
| 1309 |
|