| @@ -85,9 +85,10 @@ | ||
| 85 | 85 | public function container( $content, $settings, $class = '', $template = '', $fullwidth = false, $ajax = true ) { |
| 86 | 86 | $rand = wp_rand(); |
| 87 | 87 | $layout_id = 'rtsb-container-' . $rand; |
| 88 | 88 | $metas = RenderHelpers::meta_dataset( $settings, $template ); |
| 89 | - $layout = $metas['layout']; | |
| 89 | + $raw_layout = esc_html( $metas['layout'] ); | |
| 90 | + $layout = RenderHelpers::filter_layout( $raw_layout, $template ); | |
| 90 | 91 | $style_attr = '--rtsb-default-columns: ' . esc_attr( RenderHelpers::default_columns( $layout ) ); |
| 91 | 92 | $view_mode = $settings['view_mode'] ?? 'grid'; |
| 92 | 93 | $view_mode = isset( $_GET['displayview'] ) ? sanitize_text_field( wp_unslash( $_GET['displayview'] ) ) : $view_mode; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 93 | 94 | $tooltip_attr = 'list' == $view_mode && ! empty( $metas['tooltip_position_list'] ) ? esc_attr( $metas['tooltip_position_list'] ) : $metas['tooltip_position']; |
| @@ -163,13 +164,15 @@ | ||
| 163 | 164 | * |
| 164 | 165 | * @return string |
| 165 | 166 | */ |
| 166 | 167 | public function row( $content, $settings, $hook_html = '', $raw_settings = [] ) { |
| 167 | - $layout = $settings['layout']; | |
| 168 | + $raw_layout = esc_html( $settings['layout'] ); | |
| 169 | + $layout = RenderHelpers::filter_layout( $raw_layout ); | |
| 170 | + | |
| 168 | 171 | $rand = wp_rand(); |
| 169 | - $is_carousel = preg_match( '/slider/', $layout ); | |
| 172 | + $is_carousel = preg_match( '/slider/', $raw_layout ); | |
| 170 | 173 | |
| 171 | - if ( preg_match( '/category/', $layout ) && ( ! empty( $settings['active_cat_slider'] ) ) ) { | |
| 174 | + if ( preg_match( '/category/', $raw_layout ) && ( ! empty( $settings['active_cat_slider'] ) ) ) { | |
| 172 | 175 | $is_carousel = true; |
| 173 | 176 | } |
| 174 | 177 | |
| 175 | 178 | // Row classes. |
| @@ -240,8 +243,9 @@ | ||
| 240 | 243 | |
| 241 | 244 | foreach ( $products as $product ) { |
| 242 | 245 | $i++; |
| 243 | 246 | $GLOBALS['product'] = $product; |
| 247 | + $layout = RenderHelpers::filter_layout( esc_html( $settings['layout'] ), $template ); | |
| 244 | 248 | |
| 245 | 249 | /** |
| 246 | 250 | * Before product template render hook. |
| 247 | 251 | */ |
| @@ -250,9 +254,9 @@ | ||
| 250 | 254 | // Loop arg. |
| 251 | 255 | $arg = $this->arg_dataset( $settings, $product, $settings['lazy_load'], $i ); |
| 252 | 256 | |
| 253 | 257 | // Get template. |
| 254 | - $html .= Fns::load_template( $template . $settings['layout'], $arg, true ); | |
| 258 | + $html .= Fns::load_template( $template . $layout, $arg, true ); | |
| 255 | 259 | |
| 256 | 260 | /** |
| 257 | 261 | * After product template render hook. |
| 258 | 262 | */ |
| @@ -477,9 +481,9 @@ | ||
| 477 | 481 | // Pagination. |
| 478 | 482 | $this->html .= '<div class="rtsb-archive-pagination-wrap">'; |
| 479 | 483 | |
| 480 | 484 | if ( $pagination ) { |
| 481 | - if ( Fns::product_filters_has_ajax( 'shop' ) || Fns::product_filters_has_ajax( 'archive' ) ) { | |
| 485 | + if ( Fns::product_filters_has_ajax( apply_filters( 'rtsb/builder/set/current/page/type', '' ) ) ) { | |
| 482 | 486 | if ( $wp_query->max_num_pages > 1 ) { |
| 483 | 487 | $this->add_attribute( |
| 484 | 488 | 'rtsb_load_more_btn_attr_' . $rand, |
| 485 | 489 | [ |
| @@ -489,9 +493,9 @@ | ||
| 489 | 493 | ); |
| 490 | 494 | |
| 491 | 495 | $this->html .= |
| 492 | 496 | "<div class='rtsb-load-more rtsb-pos-r'> |
| 493 | - <button '{$this->get_attribute_string( 'rtsb_load_more_btn_attr_' . $rand )}'> | |
| 497 | + <button {$this->get_attribute_string( 'rtsb_load_more_btn_attr_' . $rand )}> | |
| 494 | 498 | <span>" . esc_html__( 'Load More', 'shopbuilder' ) . "</span> |
| 495 | 499 | </button> |
| 496 | 500 | <div class='rtsb-loadmore-loading rtsb-ball-clip-rotate'><div></div></div> |
| 497 | 501 | </div>"; |
| @@ -919,13 +923,14 @@ | ||
| 919 | 923 | |
| 920 | 924 | $arg['class'] .= ' animated rtFadeIn'; |
| 921 | 925 | |
| 922 | 926 | if ( in_array( 'badges', $meta['visibility'], true ) ) { |
| 923 | - $arg['p_sale'] = Fns::get_promo_badge( | |
| 927 | + $badge_module = ! empty( $meta['enable_badges_module'] ); | |
| 928 | + $arg['p_sale'] = Fns::is_module_active( 'product_badges' ) && $badge_module ? 'rtsb_yes' : Fns::get_promo_badge( | |
| 924 | 929 | $product, |
| 925 | 930 | $meta['sale_badge_type'], |
| 926 | 931 | $meta['sale_badge_text'], |
| 927 | - $meta['out_of_stock_badge_text'] | |
| 932 | + apply_filters( 'rtsb/elementor/render/out_of_stock_badge_text', $meta['out_of_stock_badge_text'] ) | |
| 928 | 933 | ); |
| 929 | 934 | } |
| 930 | 935 | |
| 931 | 936 | $arg['badge_class'] = RenderHelpers::badge_class( $meta['badge_preset'] ); |
| @@ -1280,9 +1285,9 @@ | ||
| 1280 | 1285 | * @return void |
| 1281 | 1286 | */ |
| 1282 | 1287 | public function no_products_msg( $metas ) { |
| 1283 | 1288 | $content = |
| 1284 | - '<div class="woocommerce-no-products-found"> | |
| 1289 | + '<div class="rtsb-notice woocommerce-no-products-found"> | |
| 1285 | 1290 | <div class="woocommerce-info">' . esc_html__( 'No products were found matching your selection.', 'shopbuilder' ) . '</div> |
| 1286 | 1291 | </div>'; |
| 1287 | 1292 | |
| 1288 | 1293 | $this->row( $content, $metas ); |