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