PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.3
ShopBuilder – WooCommerce Builder For Elementor v3.2.3
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 2.3.0 All 62 releases
← All changes | app/Controllers/SupportController.php +24 -12 2.1.43.2.3 View file →
@@ -5,9 +5,9 @@
5 5 use RadiusTheme\SB\Helpers\BuilderFns;
6 6 use RadiusTheme\SB\Helpers\ElementorDataMap;
7 7 use RadiusTheme\SB\Helpers\Fns;
8 8 use RadiusTheme\SB\Traits\SingletonTrait;
9 -use RadiusTheme\SB\Controllers\PluginsSupport;
9 +
10 10 // Do not allow directly accessing this file.
11 11 if ( ! defined( 'ABSPATH' ) ) {
12 12 exit( 'This script cannot be accessed directly.' );
13 13 }
@@ -19,8 +19,9 @@
19 19 /**
20 20 * SingletonTrait.
21 21 */
22 22 use SingletonTrait;
23 +
23 24 /**
24 25 * Construct function
25 26 */
26 27 private function __construct() {
@@ -25,10 +26,10 @@
25 26 */
26 27 private function __construct() {
27 28 add_action( 'init', [ $this, 'plugins_support' ], 9 );
28 29 add_action( 'init', [ $this, 'themes_support' ], 9 );
29 - add_filter( 'woocommerce_locate_template', [ $this, 'locate_template' ], 10, 3 );
30 - if( defined( 'RTSB_DEVELOPER_MODE' ) && RTSB_DEVELOPER_MODE ){
30 + add_filter( 'woocommerce_locate_template', [ $this, 'locate_template' ], 10, 2 );
31 + if ( defined( 'RTSB_DEVELOPER_MODE' ) && RTSB_DEVELOPER_MODE ) {
31 32 $this->developer_support();
32 33 }
33 34 }
34 35
@@ -35,9 +36,9 @@
35 36 /**
36 37 * @return void
37 38 */
38 39 public function developer_support() {
39 - add_filter( 'rtsb/builder/args/publicly_queryable', '__return_true', 5 );
40 + add_filter( 'rtsb/builder/preview/access', '__return_false', 5 );
40 41 }
41 42
42 43 /**
43 44 * Theme Support
@@ -47,11 +48,14 @@
47 48 public function plugins_support() {
48 49 // Check for plugin using plugin name.
49 50 $active_plugin = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
50 51 $supports = [
52 + 'woo-address-book/woocommerce-address-book.php' => PluginsSupport\WooAddressBook::class,
51 53 'woo-product-variation-gallery/woo-product-variation-gallery.php' => PluginsSupport\RtwpvgSupport::class,
52 54 'woo-product-variation-swatches-pro/woo-product-variation-swatches-pro.php' => PluginsSupport\RtwpvsSupport::class,
55 + 'products-visibility-by-user-roles/addify_product_visibility.php' => PluginsSupport\AddifyVisibilityByRoles::class,
53 56 ];
57 + $supports = apply_filters( 'rtsb/plugins/support', $supports );
54 58 foreach ( $supports as $active_path => $class ) {
55 59 $is_active = in_array( $active_path, $active_plugin, true );
56 60 if ( $is_active && class_exists( $class ) && method_exists( $class, 'instance' ) ) {
57 61 $class::instance();
@@ -66,9 +70,9 @@
66 70 public function themes_support() {
67 71 $themeClass = ucwords( str_replace( [ '_', '-', ' ' ], '', rtsb()->current_theme ) );
68 72
69 73 $supportClass = apply_filters(
70 - 'RadiusTheme/SB/ThemesSupport/Class',
74 + 'RadiusTheme/SB/ThemesSupport/Class', // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
71 75 [
72 76 'ThemesSupport' => 'RadiusTheme\SB\Controllers\ThemesSupport\\' . $themeClass . '\\ThemeSupport',
73 77 'TheTheme' => '\ThemeSupport',
74 78 ]
@@ -85,16 +89,26 @@
85 89 }
86 90 }
87 91
88 92 /**
89 - * Theme Support
93 + * Filters and overrides the default WooCommerce template paths for specific templates
94 + * based on builder context and available Elementor widgets.
90 95 *
91 - * @return void
96 + * - Replaces the checkout review order template if a custom widget is present.
97 + * - Replaces the single product description tab template if on a product page.
98 + *
99 + * @param string $template The path to the template to include.
100 + * @param string $template_name The name of the template.
101 + *
102 + * @return string Modified or original template path.
92 103 */
93 - public function locate_template( $template, $template_name, $template_path ) {
104 + public function locate_template( $template, $template_name ) {
94 105 if ( 'checkout/review-order.php' === $template_name && BuilderFns::is_checkout() ) {
95 - $id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' );
96 - $elmap = ElementorDataMap::instance();
106 + $id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' );
107 + $elmap = ElementorDataMap::instance();
108 + if ( ! $id ) {
109 + return $template;
110 + }
97 111 $get_widget = $elmap->get_widget_data( 'rtsb-shipping-method', [], $id );
98 112 if ( ! empty( $get_widget ) ) {
99 113 $template = Fns::locate_template( 'elementor/checkout/customized-order-review' );
100 114 }
@@ -103,7 +117,5 @@
103 117 }
104 118
105 119 return $template;
106 120 }
107 -
108 -
109 121 }