| @@ -6,8 +6,9 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace RadiusTheme\SB\Abstracts; |
| 9 | 9 | |
| 10 | +use Elementor\Group_Control_Css_Filter; | |
| 10 | 11 | use Elementor\Plugin; |
| 11 | 12 | use Elementor\Repeater; |
| 12 | 13 | use Elementor\Widget_Base; |
| 13 | 14 | use Elementor\Controls_Manager; |
| @@ -99,9 +100,9 @@ | ||
| 99 | 100 | * @param array $data default data. |
| 100 | 101 | * @param array $args default arg. |
| 101 | 102 | */ |
| 102 | 103 | public function __construct( $data = [], $args = null ) { |
| 103 | - $this->apply_hooks_before_render(); | |
| 104 | + $this->apply_hooks_before_render(); | |
| 104 | 105 | parent::__construct( $data, $args ); |
| 105 | 106 | $this->rtsb_category = 'rtsb-shopbuilder'; |
| 106 | 107 | $this->rtsb_icon = 'rtsb-el-custom rtsb-element icon-' . $this->rtsb_base; |
| 107 | 108 | $this->el_prefix = 'rtsb_el_'; |
| @@ -186,9 +187,9 @@ | ||
| 186 | 187 | * |
| 187 | 188 | * @return array |
| 188 | 189 | */ |
| 189 | 190 | public function promo_content() { |
| 190 | - if ( rtsb()->has_pro() ) { | |
| 191 | + if ( rtsb()->has_pro() || $this->widget_exceptions() ) { | |
| 191 | 192 | return []; |
| 192 | 193 | } |
| 193 | 194 | |
| 194 | 195 | $promo_fields = []; |
| @@ -296,11 +297,17 @@ | ||
| 296 | 297 | } |
| 297 | 298 | if ( isset( $value['mode'] ) && 'responsive' === $value['mode'] ) { |
| 298 | 299 | unset( $value['mode'] ); |
| 299 | 300 | $repeater->add_responsive_control( $rf_id, $value ); |
| 300 | - } else{ | |
| 301 | - $repeater->add_control( $rf_id, $value ); | |
| 302 | - } | |
| 301 | + } elseif ( isset( $value['mode'] ) && 'group' === $value['mode'] ) { | |
| 302 | + $type = $value['type']; | |
| 303 | + $value['name'] = $rf_id; | |
| 304 | + unset( $value['mode'] ); | |
| 305 | + unset( $value['type'] ); | |
| 306 | + $repeater->add_group_control( $type, $value ); | |
| 307 | + } else { | |
| 308 | + $repeater->add_control( $rf_id, $value ); | |
| 309 | + } | |
| 303 | 310 | } |
| 304 | 311 | |
| 305 | 312 | $field['fields'] = $repeater->get_controls(); |
| 306 | 313 | |
| @@ -358,22 +365,22 @@ | ||
| 358 | 365 | ?> |
| 359 | 366 | <script type="text/javascript"> |
| 360 | 367 | // Product Archive Catelog |
| 361 | 368 | (function ($) { |
| 362 | - setTimeout( function (){ | |
| 363 | - var cartWrpper = $('body').find('<?php echo esc_attr( $selector ); ?>'); | |
| 364 | - var cartIcon = cartWrpper.attr('data-cart-icon'); | |
| 365 | - var cartButton = cartWrpper.find( | |
| 366 | - '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button ' | |
| 367 | - ); | |
| 368 | - if (cartIcon) { | |
| 369 | - console.log( cartButton.find('svg') ) | |
| 370 | - cartButton.find('i').remove(); | |
| 371 | - cartButton.find('svg').remove(); | |
| 372 | - cartButton.find('img').remove(); | |
| 373 | - cartButton.prepend(cartIcon); | |
| 374 | - } | |
| 375 | - }, 2000); | |
| 369 | + setTimeout( function (){ | |
| 370 | + var cartWrpper = $('body').find('<?php echo esc_attr( $selector ); ?>'); | |
| 371 | + var cartIcon = cartWrpper.attr('data-cart-icon'); | |
| 372 | + var cartButton = cartWrpper.find( | |
| 373 | + '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button ' | |
| 374 | + ); | |
| 375 | + if (cartIcon) { | |
| 376 | + //console.log( cartButton.find('svg') ) | |
| 377 | + cartButton.find('i').remove(); | |
| 378 | + cartButton.find('svg').remove(); | |
| 379 | + cartButton.find('img').remove(); | |
| 380 | + cartButton.prepend(cartIcon); | |
| 381 | + } | |
| 382 | + }, 2000); | |
| 376 | 383 | })(jQuery); |
| 377 | 384 | </script> |
| 378 | 385 | <?php |
| 379 | 386 | } |
| @@ -388,8 +395,9 @@ | ||
| 388 | 395 | if ( ! $this->is_edit_mode() ) { |
| 389 | 396 | return; |
| 390 | 397 | } |
| 391 | 398 | $ajaxurl = admin_url( 'admin-ajax.php' ); |
| 399 | + | |
| 392 | 400 | if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) { |
| 393 | 401 | $ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE ); |
| 394 | 402 | } |
| 395 | 403 | ?> |
| @@ -405,9 +413,18 @@ | ||
| 405 | 413 | setTimeout(function() { |
| 406 | 414 | rtsbProductPageInit(); |
| 407 | 415 | }, 1000); |
| 408 | 416 | <?php if ( rtsb()->has_pro() ) { ?> |
| 409 | - rtsbFilters(); | |
| 417 | + var isMasonry = jQuery('.rtsb-elementor-container .rtsb-masonry'); | |
| 418 | + | |
| 419 | + if(isMasonry.length > 0) { | |
| 420 | + isMasonry.masonry(); | |
| 421 | + } | |
| 422 | + | |
| 423 | + if (typeof rtsbFilters === 'function') { | |
| 424 | + rtsbFilters(); | |
| 425 | + } | |
| 426 | + | |
| 410 | 427 | setTimeout( function (){ |
| 411 | 428 | window.rtsbCountdownApply(); |
| 412 | 429 | }, 1000 ); |
| 413 | 430 | <?php } ?> |
| @@ -656,13 +673,16 @@ | ||
| 656 | 673 | |
| 657 | 674 | case 'text-stroke': |
| 658 | 675 | $type = Group_Control_Text_Stroke::get_type(); |
| 659 | 676 | break; |
| 677 | + | |
| 678 | + case 'css-filter': | |
| 679 | + $type = Group_Control_Css_Filter::get_type(); | |
| 680 | + break; | |
| 660 | 681 | default: |
| 661 | 682 | $type = constant( 'Elementor\Controls_Manager::' . strtoupper( $type ) ); |
| 662 | 683 | |
| 663 | 684 | } |
| 664 | - | |
| 665 | 685 | return $type; |
| 666 | 686 | } |
| 667 | 687 | |
| 668 | 688 | /** |
| @@ -744,13 +764,39 @@ | ||
| 744 | 764 | |
| 745 | 765 | /** |
| 746 | 766 | * Elementor controls marge all settings |
| 747 | 767 | * |
| 748 | - * @return array | |
| 768 | + * @return void | |
| 749 | 769 | */ |
| 750 | 770 | protected function apply_hooks_before_render() { |
| 751 | - if( $this->is_edit_mode() ){ | |
| 771 | + if ( $this->is_edit_mode() ) { | |
| 752 | 772 | add_filter( 'wp_calculate_image_srcset_meta', '__return_null' ); |
| 753 | 773 | } |
| 754 | - } | |
| 774 | + } | |
| 755 | 775 | |
| 776 | + /** | |
| 777 | + * If checkout registration is disabled and not logged in, | |
| 778 | + * the user cannot check out. | |
| 779 | + * | |
| 780 | + * @return bool | |
| 781 | + */ | |
| 782 | + protected function has_checkout_restriction() { | |
| 783 | + $checkout = WC()->checkout(); | |
| 784 | + | |
| 785 | + return ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in(); | |
| 786 | + } | |
| 787 | + | |
| 788 | + /** | |
| 789 | + * Widget Exceptions. | |
| 790 | + * | |
| 791 | + * @return bool | |
| 792 | + */ | |
| 793 | + private function widget_exceptions() { | |
| 794 | + $exceptions = [ | |
| 795 | + 'rtsb-product-filters', | |
| 796 | + 'rtsb-wishlist', | |
| 797 | + 'rtsb-product-breadcrumbs', | |
| 798 | + ]; | |
| 799 | + | |
| 800 | + return in_array( $this->rtsb_base, $exceptions, true ); | |
| 801 | + } | |
| 756 | 802 | } |