PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.0
ShopBuilder – WooCommerce Builder For Elementor v3.2.0
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/BuilderController.php +42 -77 3.4.03.2.0 View file →
@@ -8,8 +8,9 @@
8 8 namespace RadiusTheme\SB\Controllers;
9 9
10 10 use RadiusTheme\SB\Helpers\Fns;
11 11 use RadiusTheme\SB\Helpers\BuilderFns;
12 +use RadiusTheme\SB\Models\GeneralList;
12 13 use RadiusTheme\SB\Models\ElementList;
13 14 use RadiusTheme\SB\Traits\SingletonTrait;
14 15 use RadiusTheme\SB\Controllers\Builder\BuilderCpt;
15 16 use RadiusTheme\SB\Controllers\Hooks\BuilderHooks;
@@ -54,8 +55,9 @@
54 55 */
55 56 private function __construct() {
56 57 $this->builder_page_id = BuilderFns::builder_page_id_by_page();
57 58 $this->page_edit_with = Fns::page_edit_with( $this->builder_page_id );
59 +
58 60 if ( ! is_admin() ) {
59 61 BuilderHooks::instance();
60 62 }
61 63
@@ -115,9 +117,9 @@
115 117 $builder_id = get_queried_object_id();
116 118 $id = Fns::wpml_object_id( $builder_id, BuilderFns::$post_type_tb, 'default' );
117 119 $type = BuilderFns::builder_type( $id );
118 120
119 - if ( $type && 'popup-builder' !== $type ) {
121 + if ( $type ) {
120 122 $builder_type = ! empty( BuilderFns::builder_page_types()[ $type ] ) ? BuilderFns::builder_page_types()[ $type ] : '';
121 123 $builder_type = str_replace( [ 'My Account - ', 'Endpoint: ' ], '', $builder_type );
122 124 $categories['rtsb-shopbuilder'] = [
123 125 'title' => esc_html__( 'ShopBuilder', 'shopbuilder' ) . ' - ' . ucfirst( $builder_type ),
@@ -187,24 +189,45 @@
187 189 continue;
188 190 }
189 191
190 192 if ( ! empty( $element['category'] ) ) {
191 - try {
192 - $widget = false;
193 - $import = apply_filters( 'rtsb_import_status', false );
194 -
195 - if ( $this->should_register_widget( $element['category'], $import ) ) {
193 + $widget = false;
194 + $import = apply_filters( 'rtsb_import_status', false );
195 + switch ( $element['category'] ) {
196 + case 'product':
197 + if ( BuilderFns::is_product() || $import ) {
198 + $widget = new $element['base_class']();
199 + }
200 + break;
201 + case 'shop':
202 + if ( BuilderFns::is_archive() || BuilderFns::is_shop() || $import ) {
203 + $widget = new $element['base_class']();
204 + }
205 + break;
206 + case 'archive':
207 + if ( BuilderFns::is_archive() || $import ) {
208 + $widget = new $element['base_class']();
209 + }
210 + break;
211 + case 'cart':
212 + if ( BuilderFns::is_cart() || $import ) {
213 + $widget = new $element['base_class']();
214 + }
215 + break;
216 + case 'checkout':
217 + if ( BuilderFns::is_checkout() || $import ) {
218 + $widget = new $element['base_class']();
219 + }
220 + break;
221 + case 'general':
196 222 $widget = new $element['base_class']();
197 - }
223 + break;
224 + default:
225 + }
226 + $widget = apply_filters( 'rtsb/element/list/init/widgets', $widget, $element );
198 227
199 - $widget = apply_filters( 'rtsb/element/list/init/widgets', $widget, $element );
200 -
201 - if ( $widget && is_object( $widget ) ) {
202 - $widgets_manager->register( $widget );
203 - }
204 - } catch ( \Throwable $e ) {
205 - error_log( 'ShopBuilder widget error (' . $element['base_class'] . '): ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
206 - continue;
228 + if ( $widget && is_object( $widget ) ) {
229 + $widgets_manager->register( $widget );
207 230 }
208 231 }
209 232 }
210 233 }
@@ -209,36 +232,8 @@
209 232 }
210 233 }
211 234
212 235 /**
213 - * Determine whether a widget for the given category should be registered
214 - * in the current request context.
215 - *
216 - * @param string $category Element category.
217 - * @param bool $import Whether an import is in progress.
218 - *
219 - * @return bool
220 - */
221 - protected function should_register_widget( $category, $import ) {
222 - switch ( $category ) {
223 - case 'product':
224 - return BuilderFns::is_product() || $import;
225 - case 'shop':
226 - return BuilderFns::is_archive() || BuilderFns::is_shop() || $import;
227 - case 'archive':
228 - return BuilderFns::is_archive() || $import;
229 - case 'cart':
230 - return BuilderFns::is_cart() || $import;
231 - case 'checkout':
232 - return BuilderFns::is_checkout() || $import;
233 - case 'general':
234 - return true;
235 - default:
236 - return false;
237 - }
238 - }
239 -
240 - /**
241 236 * Adding custom icons in Elementor
242 237 *
243 238 * @param array $tabs Tabs.
244 239 *
@@ -309,20 +304,12 @@
309 304
310 305 $parent_class = apply_filters( 'rtsb/builder/content/parent_class', [] );
311 306
312 307 if ( BuilderFns::is_product() ) {
313 - $product_id = Fns::get_prepared_product_id();
314 -
315 - // Ensure the WordPress global $product is a valid WC_Product before
316 - // wc_get_product_class() fires the `woocommerce_post_class` filter.
317 - // Some themes (e.g. Blocksy) read the global $product directly inside
318 - // that filter and call methods like get_type() on it, which throws a
319 - // fatal error when the global is still an unresolved string.
320 - $_product = Fns::get_product();
321 -
308 + $product_id = Fns::get_prepared_product_id();
322 309 $parent_class = wc_get_product_class( $parent_class, $product_id );
323 -
324 - if ( function_exists( 'rtwpvs' ) && $_product instanceof \WC_Product ) {
310 + if ( function_exists( 'rtwpvs' ) ) {
311 + $_product = Fns::get_product();
325 312 if ( $_product->is_type( 'variable' ) ) {
326 313 $parent_class[] = 'rtwpvs-product';
327 314 $beside_label = function_exists( 'rtwpvsp' ) && rtwpvs()->get_option( 'attribute_on_click_behavior' );
328 315 if ( $beside_label ) {
@@ -351,29 +338,8 @@
351 338 if ( BuilderFns::is_checkout() ) {
352 339 if ( ! apply_filters( 'rtsb/multi/step/checkout/widget', true ) ) {
353 340 return;
354 341 }
355 -
356 - $checkout = WC()->checkout();
357 -
358 - // Temporarily remove callbacks that Elementor checkout
359 - // handles via separate widgets to prevent duplicates.
360 - remove_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_login_form' ], 10 );
361 - remove_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_coupon_form' ], 10 );
362 - remove_action( 'woocommerce_before_checkout_form', [ Fns::class, 'woocommerce_output_all_notices' ], 10 );
363 -
364 - do_action( 'woocommerce_before_checkout_form', $checkout );
365 -
366 - // Restore callbacks for non-Elementor contexts.
367 - add_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_login_form' ], 10 );
368 - add_action( 'woocommerce_before_checkout_form', [ Hooks\ActionHooks::class, 'woocommerce_checkout_coupon_form' ], 10 );
369 - add_action( 'woocommerce_before_checkout_form', [ Fns::class, 'woocommerce_output_all_notices' ], 10 );
370 -
371 - // If checkout registration is disabled and not logged in, the user cannot checkout.
372 - if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) {
373 - echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'shopbuilder' ) ) );
374 - return;
375 - }
376 342 ?>
377 343 <!--
378 344 woocommerce-checkout added for fix issue with payment method ( Revolut Pay )
379 345 -->
@@ -405,9 +371,8 @@
405 371 }
406 372 ?>
407 373 </form>
408 374 <?php
409 - do_action( 'woocommerce_after_checkout_form', WC()->checkout() );
410 375 }
411 376 ?>
412 377 </div>
413 378 <!-- After Content end -->
@@ -445,9 +410,9 @@
445 410 $args = [
446 411 'hide_empty' => false,
447 412 'orderby' => 'name',
448 413 'order' => 'ASC',
449 - 'name__like' => $search,
414 + 'search' => $search,
450 415 'number' => '5',
451 416 ];
452 417
453 418 if ( 'all' !== $post_type ) {