PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.9.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.9.2
4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / widgets / cross-sells / screens / default.php
shopengine / widgets / cross-sells / screens Last commit date
default.php 5 days ago
default.php
138 lines
1 <?php defined('ABSPATH') || exit;
2
3 \ShopEngine\Widgets\Widget_Helper::instance()->wc_template_filter();
4
5 \ShopEngine\Widgets\Widget_Helper::instance()->wc_template_part_filter_by_match('woocommerce/content-product.php', 'templates/content-product.php');
6
7 $editor_mode = (\Elementor\Plugin::$instance->editor->is_edit_mode() || is_preview());
8
9 if($editor_mode) {
10
11 $args = array(
12 'type' => ['simple'],
13 'limit' => $shopengine_cross_sells_product_to_show,
14 );
15
16 $parent_product_array = wc_get_products($args);
17
18 $crosssell_products = [];
19 foreach($parent_product_array as $prod) {
20 $crosssell_products[] = $prod->get_id();
21 }
22
23 add_filter('woocommerce_cart_crosssell_ids', function ($cross_sell_ids) use ($crosssell_products) {
24
25 $cross_sell_ids = $crosssell_products;
26
27 return $cross_sell_ids;
28 });
29 }
30
31 $cross_sells = null;
32
33 if ( WC()->cart ) {
34 $cross_sells = array_filter( array_map( 'wc_get_product', WC()->cart->get_cross_sells() ), 'wc_products_array_filter_visible' );
35 }
36
37 if(empty($cross_sells)) {
38 return;
39 }
40
41 if($editor_mode) {
42
43 global $wp_query, $post;;
44 $main_query = clone $wp_query;
45 $main_post = clone $post;
46
47 $wp_query = new \WP_Query([]);
48 }
49
50 // woostify theme compatibility
51 $theme_name = get_template();
52 if ($theme_name == 'woostify') {
53
54 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_wrapper_open', 10 );
55 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_print_out_of_stock_label', 15 );
56 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_image_wrapper_open', 20 );
57 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_change_sale_flash', 23 );
58 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_product_loop_item_action', 25 );
59 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_link_open', 30 );
60 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_hover_image', 40 );
61 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_image', 50 );
62 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_link_close', 60 );
63 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_add_to_cart_on_image', 70 );
64 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_product_loop_item_wishlist_icon_bottom', 80 );
65 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_image_wrapper_close', 90 );
66 remove_action( 'woocommerce_before_shop_loop_item_title', 'woostify_loop_product_content_open', 100 );
67
68 remove_action( 'woocommerce_shop_loop_item_title', 'woostify_add_template_loop_product_category', 5 );
69 remove_action( 'woocommerce_shop_loop_item_title', 'woostify_add_template_loop_product_title', 10 );
70
71 remove_action( 'woocommerce_after_shop_loop_item_title', 'woostify_loop_product_rating', 2 );
72 remove_action( 'woocommerce_after_shop_loop_item_title', 'woostify_loop_product_meta_open', 5 );
73 remove_action( 'woocommerce_after_shop_loop_item_title', 'woostify_loop_product_price', 10 );
74
75 remove_action( 'woocommerce_after_shop_loop_item', 'woostify_loop_product_add_to_cart_button', 10 );
76 remove_action( 'woocommerce_after_shop_loop_item', 'woostify_loop_product_meta_close', 20 );
77 remove_action( 'woocommerce_after_shop_loop_item', 'woostify_loop_product_content_close', 50 );
78 remove_action( 'woocommerce_after_shop_loop_item', 'woostify_loop_product_wrapper_close', 100 );
79 }
80
81 if (is_plugin_active('auxin-shop/auxin-shop.php')) {
82
83 remove_action( 'woocommerce_after_shop_loop_item_title', 'auxshp_loop_product_meta', 12 );
84 remove_action( 'woocommerce_after_shop_loop_item' , 'auxshp_loop_product_tools', 12 );
85 remove_action( 'woocommerce_archive_description' , 'auxshp_archive_page_title_description', 1 );
86 remove_action( 'woocommerce_before_shop_loop_item_title', 'auxshp_get_product_thumbnail', 11 );
87 }
88
89 $is_slider_enable = ($shopengine_cross_sells_product_enable_slider == "yes") ? true : false;
90 $init_slider = ($shopengine_cross_sells_product_to_show > $shopengine_cross_sells_product_slider_perview) && (count($cross_sells) > $shopengine_cross_sells_product_slider_perview) ;
91
92
93 $shopengine_cross_sells_product_column_gap = $this->get_settings_for_display('shopengine_cross_sells_product_column_gap');
94 $shopengine_cross_sells_product_column_gap = isset($shopengine_cross_sells_product_column_gap['size']) ? $shopengine_cross_sells_product_column_gap : ['size' => 10];
95
96 // slider controls for the template file
97 $slider_options = [
98 'slider_enabled' => $is_slider_enable,
99 'slides_to_show' => $shopengine_cross_sells_product_slider_perview,
100 'slider_loop' => ($init_slider && $shopengine_cross_sells_product_slider_loop === "yes") ? true : false,
101 'slider_autoplay' => ($shopengine_cross_sells_product_slider_autoplay === "yes") ? true : false,
102 'slider_autoplay_delay' => $shopengine_cross_sells_product_slider_autoplay_delay,
103 'slider_space_between' => $shopengine_cross_sells_product_column_gap['size'],
104 ];
105
106 $columns = $is_slider_enable ? $shopengine_cross_sells_product_slider_perview : $shopengine_cross_sells_product_column_gap['size'];
107
108 ?>
109
110 <div class="shopengine-cross-sells <?php echo ($is_slider_enable ? 'slider-enabled' : 'slider-disabled'); ?>" data-controls="<?php echo esc_attr(json_encode($slider_options)); ?>">
111 <?php
112 woocommerce_cross_sell_display($shopengine_cross_sells_product_to_show, $columns, $shopengine_cross_sells_product_orderby, $shopengine_cross_sells_product_order);
113
114 if($init_slider && $is_slider_enable && $shopengine_cross_sells_product_slider_show_dots) {
115 echo '<div class="swiper-pagination" style="width: 100%;"></div>';
116 }
117
118 if($init_slider && $is_slider_enable && $shopengine_cross_sells_product_slider_show_arrows) {
119 shopengine_content_render(
120 sprintf(
121 '<div class="swiper-button-prev">%1$s</div><div class="swiper-button-next">%2$s</div>',
122 $this->get_icon_html($shopengine_cross_sells_product_slider_left_arrow_icon),
123 $this->get_icon_html($shopengine_cross_sells_product_slider_right_arrow_icon)
124 ),
125 );
126 }
127 ?>
128 </div>
129
130 <?php
131
132 if($editor_mode) {
133 $wp_query = $main_query;
134 $post = $main_post;
135 wp_reset_query();
136 wp_reset_postdata();
137 }
138