PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/Controllers/Admin/Ajax/ModalTemplate.php +7 -84 3.4.23.2.6 View file →
@@ -172,18 +172,11 @@
172 172 <?php
173 173 $builder_page_types = [
174 174 'all_products' => esc_html__( 'All Products', 'shopbuilder' ),
175 175 'product_cats' => esc_html__( 'Product Categories', 'shopbuilder' ),
176 - 'product_brands' => esc_html__( 'Product Brands', 'shopbuilder' ),
177 176 'product_tags' => esc_html__( 'Product Tags', 'shopbuilder' ),
178 177 'specific_products' => esc_html__( 'Selected Products', 'shopbuilder' ),
179 178 ];
180 - // Only expose the brand option when the `product_brand` taxonomy is
181 - // registered (WC 9.4+ native, or a brand plugin). Hides gracefully
182 - // on sites without brand support.
183 - if ( ! taxonomy_exists( 'product_brand' ) ) {
184 - unset( $builder_page_types['product_brands'] );
185 - }
186 179 foreach ( $builder_page_types as $key => $value ) {
187 180 ?>
188 181 <option <?php echo esc_attr( $key === $product_page_for ? 'selected="selected"' : '' ); ?> value="<?php echo esc_attr( $key ); ?>"> <?php echo esc_html( $value ); ?> </option>
189 182 <?php } ?>
@@ -288,64 +281,8 @@
288 281 </p>
289 282 </div>
290 283
291 284
292 - <!-- Product Page for Selected Product Brands -->
293 - <?php if ( taxonomy_exists( 'product_brand' ) ) : ?>
294 - <div class="rtsb-product-brands-page-field rtsb-tb-field-wraper <?php echo esc_attr( ! rtsb()->has_pro() ? 'pro-disable' : '' ); ?>" style="display:none;">
295 - <?php
296 - $default_items_link = '';
297 - $default_items = '';
298 - $brands_name = apply_filters( 'rtsb/template/builder/selected/brands', [], $post_id, $template_type );
299 - if ( ! empty( $brands_name ) && is_array( $brands_name ) ) {
300 - foreach ( $brands_name as $b_name ) {
301 - $brand = get_term_by( 'slug', $b_name, 'product_brand' );
302 - if ( empty( $brand ) || is_wp_error( $brand ) ) {
303 - continue;
304 - }
305 - $title_brand = $brand->name;
306 - $link = get_term_link( $brand );
307 - if ( ! is_wp_error( $link ) ) {
308 - $default_items_link .= '<a target="_blank" href="' . esc_url( $link ) . '">' . esc_html( $title_brand ) . '</a>';
309 - }
310 - $default_items .= '<option selected="selected" value="' . esc_attr( $b_name ) . '">' . esc_html( $title_brand ) . '</option>';
311 - }
312 - }
313 - ?>
314 - <label for="rtsb_page_for_the_product_brands">
315 - <?php esc_html_e( 'Select Product Brands', 'shopbuilder' ); ?>
316 - <?php if ( ! rtsb()->has_pro() ) { ?>
317 - <div class="card-label">
318 - <span class="rtsb-btn-import pro-btn">
319 - <?php echo esc_html( 'PRO' ); ?>
320 - </span>
321 - </div>
322 - <?php } ?>
323 - </label>
324 - <select class="rtsb-field" id="rtsb_page_for_the_product_brands" name="rtsb_page_for_the_product_brands" multiple="multiple">
325 - <?php Fns::print_html( $default_items, true ); ?>
326 - </select>
327 - <p style="margin:0;">Select a Product Brand to apply this template. You can select multiple Brands. Keep it blank to apply to all.
328 - <?php
329 - if ( ! empty( $default_items_link ) ) {
330 - ?>
331 - <span style="display: flex; gap: 3px 7px; flex-wrap: wrap; margin-top: 10px;"> <?php Fns::print_html( 'View Brand Archive Pages: ' . $default_items_link ); ?> </span>
332 - <?php
333 - }
334 - ?>
335 - </p>
336 - </div>
337 -
338 - <?php if ( ! rtsb()->has_pro() ) { ?>
339 - <div class="rtsb-product-brands-page-field rtsb-tb-field-wraper" style="display:none;">
340 - <label for="product_page_for"> </label>
341 - <span class="elementor-pro-notice"><a target="_blank" href="<?php echo esc_url( rtsb()->pro_version_link() ); ?>">Upgrade to PRO</a> to unlock Brand Base Product Page.</span>
342 - </div>
343 - <?php } ?>
344 - <?php endif; ?>
345 -
346 - <?php do_action( 'rtsb/builder/modal/extra_fields', $post_id, $template_type, $product_page_for ); ?>
347 -
348 285 <!-- Product Page for Selected Product -->
349 286 <div class="rtsb-page-for-the-products rtsb-tb-field-wraper <?php echo esc_attr( ! rtsb()->has_pro() ? 'pro-disable' : '' ); ?>" style="display:none;">
350 287 <?php
351 288 $default_items_link = '';
@@ -412,16 +349,8 @@
412 349 </div>
413 350 <div class="rtsb-template-setdefaults rtsb-tb-field-wraper">
414 351 <label for="default_template"> <?php esc_html_e( 'Set as Active Template', 'shopbuilder' ); ?></label>
415 352 <?php
416 - $singleton_types = apply_filters(
417 - 'rtsb/builder/singleton_types',
418 - array_keys( BuilderFns::builder_page_types() )
419 - );
420 - $is_pool_type = $template_type && ! in_array( $template_type, $singleton_types, true );
421 - if ( $post_id && $is_pool_type ) {
422 - $template_default = 'on' === get_post_meta( $post_id, '_rtsb_tb_enabled_in_pool', true ) ? $post_id : 0;
423 - }
424 353 if ( $post_id && 'product' === $template_type ) {
425 354 if ( 'specific_products' === $product_page_for ) {
426 355 $set_default = BuilderFns::get_specific_product_as_default( $post_id );
427 356 if ( $set_default ) {
@@ -435,10 +364,8 @@
435 364 if ( 'product_cats' === $product_page_for ) {
436 365 $set_default_option_name = BuilderFns::option_name_product_page_specific_cat_set_default( $post_id );
437 366 } elseif ( 'product_tags' === $product_page_for ) {
438 367 $set_default_option_name = BuilderFns::option_name_product_page_specific_tag_set_default( $post_id );
439 - } elseif ( 'product_brands' === $product_page_for ) {
440 - $set_default_option_name = BuilderFns::option_name_product_page_specific_brand_set_default( $post_id );
441 368 }
442 369 $default_id = ! empty( $set_default_option_name ) && TemplateSettings::instance()->get_option( $set_default_option_name );
443 370 if ( $default_id ) {
444 371 $template_default = $post_id;
@@ -458,9 +385,8 @@
458 385 $template_default = '';
459 386 }
460 387 }
461 388
462 - $template_default = apply_filters( 'rtsb/builder/modal/template_default', $template_default, $post_id, $template_type );
463 389 ?>
464 390 <span class="rtsb-switch-wrapper"
465 391 title="<?php esc_html_e( 'Switch on to set as active template', 'shopbuilder' ); ?>">
466 392 <label class="rtsb-switch">
@@ -656,26 +582,23 @@
656 582 'content' => esc_html__( 'Empty string Not allowed...', 'shopbuilder' ),
657 583 ];
658 584 wp_send_json( $return );
659 585 }
660 - /** @noinspection SqlNoDataSourceInspection */
661 - /** @noinspection SqlResolve */
662 - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
663 586 $query = $wpdb->prepare(
664 - "SELECT ID, post_title
665 - FROM $wpdb->posts
666 - WHERE post_type = 'product'
667 - AND post_status = 'publish'
668 - AND post_title LIKE %s
587 + "SELECT ID, post_title
588 + FROM $wpdb->posts
589 + WHERE post_type = 'product'
590 + AND post_status = 'publish'
591 + AND post_title LIKE %s
669 592 LIMIT %d",
670 593 '%' . $search . '%',
671 594 10
672 595 );
673 596 $cache_key = md5( $query );
674 - $_product = wp_cache_get( $cache_key, Cache::group() );
597 + $_product = wp_cache_get( $cache_key, 'shopbuilder' );
675 598 if ( false === $_product ) {
676 599 $_product = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared
677 - wp_cache_set( $cache_key, $_product, Cache::group(), 12 * HOUR_IN_SECONDS );
600 + wp_cache_set( $cache_key, $_product, 'shopbuilder' );
678 601 Cache::set_data_cache_key( $cache_key );
679 602 }
680 603 $product_list = [];
681 604 foreach ( $_product as $product ) {