| @@ -99,9 +99,9 @@ | ||
| 99 | 99 | * @param array $data default data. |
| 100 | 100 | * @param array $args default arg. |
| 101 | 101 | */ |
| 102 | 102 | public function __construct( $data = [], $args = null ) { |
| 103 | - $this->apply_hooks_before_render(); | |
| 103 | + $this->apply_hooks_before_render(); | |
| 104 | 104 | parent::__construct( $data, $args ); |
| 105 | 105 | $this->rtsb_category = 'rtsb-shopbuilder'; |
| 106 | 106 | $this->rtsb_icon = 'rtsb-el-custom rtsb-element icon-' . $this->rtsb_base; |
| 107 | 107 | $this->el_prefix = 'rtsb_el_'; |
| @@ -186,9 +186,9 @@ | ||
| 186 | 186 | * |
| 187 | 187 | * @return array |
| 188 | 188 | */ |
| 189 | 189 | public function promo_content() { |
| 190 | - if ( rtsb()->has_pro() ) { | |
| 190 | + if ( rtsb()->has_pro() || $this->widget_exceptions() ) { | |
| 191 | 191 | return []; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $promo_fields = []; |
| @@ -296,11 +296,11 @@ | ||
| 296 | 296 | } |
| 297 | 297 | if ( isset( $value['mode'] ) && 'responsive' === $value['mode'] ) { |
| 298 | 298 | unset( $value['mode'] ); |
| 299 | 299 | $repeater->add_responsive_control( $rf_id, $value ); |
| 300 | - } else{ | |
| 301 | - $repeater->add_control( $rf_id, $value ); | |
| 302 | - } | |
| 300 | + } else { | |
| 301 | + $repeater->add_control( $rf_id, $value ); | |
| 302 | + } | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | $field['fields'] = $repeater->get_controls(); |
| 306 | 306 | |
| @@ -358,22 +358,22 @@ | ||
| 358 | 358 | ?> |
| 359 | 359 | <script type="text/javascript"> |
| 360 | 360 | // Product Archive Catelog |
| 361 | 361 | (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); | |
| 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); | |
| 376 | 376 | })(jQuery); |
| 377 | 377 | </script> |
| 378 | 378 | <?php |
| 379 | 379 | } |
| @@ -388,8 +388,9 @@ | ||
| 388 | 388 | if ( ! $this->is_edit_mode() ) { |
| 389 | 389 | return; |
| 390 | 390 | } |
| 391 | 391 | $ajaxurl = admin_url( 'admin-ajax.php' ); |
| 392 | + | |
| 392 | 393 | if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) { |
| 393 | 394 | $ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE ); |
| 394 | 395 | } |
| 395 | 396 | ?> |
| @@ -405,9 +406,18 @@ | ||
| 405 | 406 | setTimeout(function() { |
| 406 | 407 | rtsbProductPageInit(); |
| 407 | 408 | }, 1000); |
| 408 | 409 | <?php if ( rtsb()->has_pro() ) { ?> |
| 409 | - rtsbFilters(); | |
| 410 | + var isMasonry = jQuery('.rtsb-elementor-container .rtsb-masonry'); | |
| 411 | + | |
| 412 | + if(isMasonry.length > 0) { | |
| 413 | + isMasonry.masonry(); | |
| 414 | + } | |
| 415 | + | |
| 416 | + if (typeof rtsbFilters === 'function') { | |
| 417 | + rtsbFilters(); | |
| 418 | + } | |
| 419 | + | |
| 410 | 420 | setTimeout( function (){ |
| 411 | 421 | window.rtsbCountdownApply(); |
| 412 | 422 | }, 1000 ); |
| 413 | 423 | <?php } ?> |
| @@ -744,13 +754,39 @@ | ||
| 744 | 754 | |
| 745 | 755 | /** |
| 746 | 756 | * Elementor controls marge all settings |
| 747 | 757 | * |
| 748 | - * @return array | |
| 758 | + * @return void | |
| 749 | 759 | */ |
| 750 | 760 | protected function apply_hooks_before_render() { |
| 751 | - if( $this->is_edit_mode() ){ | |
| 761 | + if ( $this->is_edit_mode() ) { | |
| 752 | 762 | add_filter( 'wp_calculate_image_srcset_meta', '__return_null' ); |
| 753 | 763 | } |
| 754 | - } | |
| 764 | + } | |
| 755 | 765 | |
| 766 | + /** | |
| 767 | + * If checkout registration is disabled and not logged in, | |
| 768 | + * the user cannot check out. | |
| 769 | + * | |
| 770 | + * @return bool | |
| 771 | + */ | |
| 772 | + protected function has_checkout_restriction() { | |
| 773 | + $checkout = WC()->checkout(); | |
| 774 | + | |
| 775 | + return ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in(); | |
| 776 | + } | |
| 777 | + | |
| 778 | + /** | |
| 779 | + * Widget Exceptions. | |
| 780 | + * | |
| 781 | + * @return bool | |
| 782 | + */ | |
| 783 | + private function widget_exceptions() { | |
| 784 | + $exceptions = [ | |
| 785 | + 'rtsb-product-filters', | |
| 786 | + 'rtsb-wishlist', | |
| 787 | + 'rtsb-product-breadcrumbs', | |
| 788 | + ]; | |
| 789 | + | |
| 790 | + return in_array( $this->rtsb_base, $exceptions, true ); | |
| 791 | + } | |
| 756 | 792 | } |