| @@ -112,18 +112,20 @@ | ||
| 112 | 112 | * |
| 113 | 113 | * @return void |
| 114 | 114 | */ |
| 115 | 115 | public function script_init() { |
| 116 | - wp_dequeue_script( 'rtsb-public' ); | |
| 116 | + $handle = Fns::optimized_handle( 'rtsb-public' ); | |
| 117 | + wp_dequeue_script( $handle ); | |
| 117 | 118 | |
| 118 | - wp_enqueue_style( 'swiper' ); | |
| 119 | 119 | wp_enqueue_script( 'swiper' ); |
| 120 | - wp_enqueue_script( 'rtsb-public' ); | |
| 120 | + wp_enqueue_script( $handle ); | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Product loop start function |
| 125 | 125 | * |
| 126 | + * @param string $html html. | |
| 127 | + * | |
| 126 | 128 | * @return string |
| 127 | 129 | */ |
| 128 | 130 | public function product_loop_start( $html = '' ) { |
| 129 | 131 | $str = explode( 'products', $html ); |
| @@ -188,8 +190,10 @@ | ||
| 188 | 190 | } |
| 189 | 191 | /** |
| 190 | 192 | * Product loop start function |
| 191 | 193 | * |
| 194 | + * @param string $html html. | |
| 195 | + * | |
| 192 | 196 | * @return string |
| 193 | 197 | */ |
| 194 | 198 | public function product_loop_end( $html ) { |
| 195 | 199 | $controllers = $this->get_settings_for_display(); |
| @@ -205,8 +209,10 @@ | ||
| 205 | 209 | } |
| 206 | 210 | /** |
| 207 | 211 | * Product loop start function |
| 208 | 212 | * |
| 213 | + * @param string $classes classes. | |
| 214 | + * | |
| 209 | 215 | * @return string |
| 210 | 216 | */ |
| 211 | 217 | public function post_class( $classes ) { |
| 212 | 218 | $classes[] = 'swiper-slide'; |
| @@ -281,18 +287,17 @@ | ||
| 281 | 287 | remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 8 ); |
| 282 | 288 | remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 12 ); |
| 283 | 289 | } |
| 284 | 290 | |
| 285 | - // Remove Action Button | |
| 291 | + // Remove Action Button. | |
| 286 | 292 | add_filter( 'rtsb/module/wishlist/show_button', '__return_false' ); |
| 287 | 293 | add_filter( 'rtsb/module/quick_view/show_button', '__return_false' ); |
| 288 | 294 | add_filter( 'rtsb/module/compare/show_button', '__return_false' ); |
| 289 | 295 | |
| 290 | - //TODO:: Pro Will move if necessary | |
| 291 | - if ( empty( $controllers['show_quick_checkout'] ) ) { | |
| 296 | + if ( empty( $controllers['show_quick_checkout'] ) ) { | |
| 292 | 297 | add_filter( 'rtsb/module/quick_checkout/show_button', '__return_false' ); |
| 293 | 298 | } |
| 294 | - if ( empty( $controllers['show_flash_sale_countdown'] ) ) { | |
| 299 | + if ( empty( $controllers['show_flash_sale_countdown'] ) ) { | |
| 295 | 300 | add_filter( 'rtsb/module/flash_sale_countdown/show_counter', '__return_false' ); |
| 296 | 301 | } |
| 297 | 302 | |
| 298 | 303 | // Default Link remove. |
| @@ -318,19 +323,21 @@ | ||
| 318 | 323 | add_action( 'woocommerce_before_shop_loop_item_title', [ $this, 'product_content_wrapper' ], 13 ); |
| 319 | 324 | // Content Wrapper Close. |
| 320 | 325 | add_action( 'woocommerce_after_shop_loop_item', [ $this, 'div_close' ], 99 ); |
| 321 | 326 | |
| 327 | + if ( $this->is_edit_mode() ) { | |
| 328 | + if ( class_exists( Rtwpvs\Controllers\Hooks::class ) ) { | |
| 329 | + remove_filter( 'woocommerce_ajax_variationX_threshold', [ Rtwpvs\Controllers\Hooks::class, 'ajax_variation_threshold' ], 99 ); | |
| 330 | + } | |
| 331 | + add_filter( | |
| 332 | + 'woocommerce_ajax_variation_threshold', | |
| 333 | + function () { | |
| 334 | + return 1; | |
| 335 | + }, | |
| 336 | + 99 | |
| 337 | + ); | |
| 322 | 338 | |
| 323 | - if ( $this->is_edit_mode() ){ | |
| 324 | - if( class_exists( Rtwpvs\Controllers\Hooks::class ) ){ | |
| 325 | - remove_filter( 'woocommerce_ajax_variationX_threshold', [ Rtwpvs\Controllers\Hooks::class, 'ajax_variation_threshold' ], 99 ); | |
| 326 | - } | |
| 327 | - add_filter( 'woocommerce_ajax_variation_threshold', function (){ | |
| 328 | - return 1; | |
| 329 | - }, 99 ); | |
| 330 | - | |
| 331 | - } | |
| 332 | - | |
| 339 | + } | |
| 333 | 340 | } |
| 334 | 341 | /** |
| 335 | 342 | * Apply hooks function. |
| 336 | 343 | * |
| @@ -366,9 +373,8 @@ | ||
| 366 | 373 | // Remove Action Button. |
| 367 | 374 | remove_filter( 'rtsb/module/wishlist/show_button', '__return_false' ); |
| 368 | 375 | remove_filter( 'rtsb/module/quick_view/show_button', '__return_false' ); |
| 369 | 376 | remove_filter( 'rtsb/module/compare/show_button', '__return_false' ); |
| 370 | - | |
| 371 | 377 | } |
| 372 | 378 | /** |
| 373 | 379 | * Related Product Args function' |
| 374 | 380 | * |
| @@ -403,12 +409,20 @@ | ||
| 403 | 409 | } |
| 404 | 410 | ?> |
| 405 | 411 | <script> |
| 406 | 412 | <?php if ( rtsb()->has_pro() ) { ?> |
| 407 | - setTimeout( function (){ | |
| 408 | - window.rtsbCountdownApply(); | |
| 409 | - }, 1000 ); | |
| 410 | - <?php } ?> | |
| 413 | + if (!'<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>') { | |
| 414 | + setTimeout( function (){ | |
| 415 | + window.rtsbCountdownApply(); | |
| 416 | + }, 1000 ); | |
| 417 | + } else { | |
| 418 | + if (typeof elementorFrontend !== 'undefined') { | |
| 419 | + window.waitForRTSB((RTSB) => { | |
| 420 | + RTSB.modules.get('countdownPro')?.refresh(); | |
| 421 | + }); | |
| 422 | + } | |
| 423 | + } | |
| 424 | + <?php } ?> | |
| 411 | 425 | </script> |
| 412 | 426 | <?php |
| 413 | 427 | } |
| 414 | 428 | |
| @@ -451,8 +465,6 @@ | ||
| 451 | 465 | } |
| 452 | 466 | |
| 453 | 467 | $this->editor_script(); |
| 454 | 468 | $this->editor_cart_icon_script(); |
| 455 | - | |
| 456 | 469 | } |
| 457 | - | |
| 458 | 470 | } |