PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.5
ShopBuilder – WooCommerce Builder For Elementor v3.2.5
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 +39 -76 3.4.03.2.5 View file →
@@ -187,24 +187,45 @@
187 187 continue;
188 188 }
189 189
190 190 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 ) ) {
191 + $widget = false;
192 + $import = apply_filters( 'rtsb_import_status', false );
193 + switch ( $element['category'] ) {
194 + case 'product':
195 + if ( BuilderFns::is_product() || $import ) {
196 + $widget = new $element['base_class']();
197 + }
198 + break;
199 + case 'shop':
200 + if ( BuilderFns::is_archive() || BuilderFns::is_shop() || $import ) {
201 + $widget = new $element['base_class']();
202 + }
203 + break;
204 + case 'archive':
205 + if ( BuilderFns::is_archive() || $import ) {
206 + $widget = new $element['base_class']();
207 + }
208 + break;
209 + case 'cart':
210 + if ( BuilderFns::is_cart() || $import ) {
211 + $widget = new $element['base_class']();
212 + }
213 + break;
214 + case 'checkout':
215 + if ( BuilderFns::is_checkout() || $import ) {
216 + $widget = new $element['base_class']();
217 + }
218 + break;
219 + case 'general':
196 220 $widget = new $element['base_class']();
197 - }
221 + break;
222 + default:
223 + }
224 + $widget = apply_filters( 'rtsb/element/list/init/widgets', $widget, $element );
198 225
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;
226 + if ( $widget && is_object( $widget ) ) {
227 + $widgets_manager->register( $widget );
207 228 }
208 229 }
209 230 }
210 231 }
@@ -209,36 +230,8 @@
209 230 }
210 231 }
211 232
212 233 /**
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 234 * Adding custom icons in Elementor
242 235 *
243 236 * @param array $tabs Tabs.
244 237 *
@@ -309,20 +302,12 @@
309 302
310 303 $parent_class = apply_filters( 'rtsb/builder/content/parent_class', [] );
311 304
312 305 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 -
306 + $product_id = Fns::get_prepared_product_id();
322 307 $parent_class = wc_get_product_class( $parent_class, $product_id );
323 -
324 - if ( function_exists( 'rtwpvs' ) && $_product instanceof \WC_Product ) {
308 + if ( function_exists( 'rtwpvs' ) ) {
309 + $_product = Fns::get_product();
325 310 if ( $_product->is_type( 'variable' ) ) {
326 311 $parent_class[] = 'rtwpvs-product';
327 312 $beside_label = function_exists( 'rtwpvsp' ) && rtwpvs()->get_option( 'attribute_on_click_behavior' );
328 313 if ( $beside_label ) {
@@ -351,29 +336,8 @@
351 336 if ( BuilderFns::is_checkout() ) {
352 337 if ( ! apply_filters( 'rtsb/multi/step/checkout/widget', true ) ) {
353 338 return;
354 339 }
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 340 ?>
377 341 <!--
378 342 woocommerce-checkout added for fix issue with payment method ( Revolut Pay )
379 343 -->
@@ -405,9 +369,8 @@
405 369 }
406 370 ?>
407 371 </form>
408 372 <?php
409 - do_action( 'woocommerce_after_checkout_form', WC()->checkout() );
410 373 }
411 374 ?>
412 375 </div>
413 376 <!-- After Content end -->
@@ -445,9 +408,9 @@
445 408 $args = [
446 409 'hide_empty' => false,
447 410 'orderby' => 'name',
448 411 'order' => 'ASC',
449 - 'name__like' => $search,
412 + 'search' => $search,
450 413 'number' => '5',
451 414 ];
452 415
453 416 if ( 'all' !== $post_type ) {