PluginProbe ʕ •ᴥ•ʔ
Essential Addons for Elementor – Popular Elementor Templates & Widgets / 6.0.10
Essential Addons for Elementor – Popular Elementor Templates & Widgets v6.0.10
6.6.9 6.6.8 6.6.7 6.6.6 6.6.5 6.6.4 6.6.3 5.7.3 5.7.4 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.15 5.8.16 5.8.18 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.10 5.9.11 5.9.12 5.9.13 5.9.14 5.9.15 5.9.16 5.9.17 5.9.18 5.9.19 5.9.2 5.9.20 5.9.21 5.9.22 5.9.23 5.9.24 5.9.25 5.9.26 5.9.27 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.14 6.0.15 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.0 6.1.1 6.1.10 6.1.11 trunk 6.1.12 1.0.0 6.1.13 1.0.1 6.1.14 1.1.0 6.1.15 2.0 6.1.17 2.1 6.1.18 2.10.0 6.1.19 2.10.1 6.1.2 2.10.2 6.1.20 2.10.3 6.1.3 2.10.4 6.1.4 2.10.5 6.1.5 2.2.0 6.1.6 2.2.1 6.1.7 2.2.2 6.1.8 2.2.3 6.1.9 2.2.4 6.2.0 2.2.5 6.2.1 2.3.0 6.2.2 2.3.1 6.2.3 2.4.0 6.2.4 2.4.1 6.3.0 2.4.2 6.3.1 2.4.3 6.3.2 2.5.0 6.3.3 2.6.0 6.4.0 2.7.0 6.5.0 2.7.1 6.5.1 2.7.10 6.5.10 2.7.11 6.5.11 2.7.2 6.5.12 2.7.3 6.5.13 2.7.4 6.5.2 2.7.5 6.5.3 2.7.6 6.5.4 2.7.7 6.5.5 2.7.8 6.5.6 2.7.9 6.5.7 2.8.0 6.5.8 2.8.1 6.5.9 2.8.2 6.6.0 2.8.3 6.6.1 2.8.4 6.6.2 2.8.5 2.8.6 2.8.7 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.4.1 3.1.5 3.2.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1 3.7.2 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.9.0 4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 5.0.0 5.0.1 5.0.10 5.0.11 5.0.12 5.0.13 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.4.6 5.5.5 5.6.5 5.7.2
essential-addons-for-elementor-lite / includes / Template / Woo-Product-Gallery / default.php
essential-addons-for-elementor-lite / includes / Template / Woo-Product-Gallery Last commit date
default.php 1 year ago
default.php
298 lines
1 <?php
2
3 /**
4 * Template Name: Default
5 */
6
7 use \Essential_Addons_Elementor\Classes\Helper;
8 use Essential_Addons_Elementor\Elements\Woo_Product_Gallery;
9 use \Elementor\Group_Control_Image_Size;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 } // Exit if accessed directly
14
15 $product = wc_get_product( get_the_ID() );
16 if ( ! $product ) {
17 error_log( '$product not found in ' . __FILE__ );
18 return;
19 }
20
21 if ( has_post_thumbnail() ) {
22 $settings[ 'eael_image_size_customize' ] = [
23 'id' => get_post_thumbnail_id(),
24 ];
25 $settings['eael_image_size_customize_size'] = $settings['eael_product_gallery_image_size_size'];
26 $thumbnail_html = Group_Control_Image_Size::get_attachment_image_html( $settings,'eael_image_size_customize' );
27 }
28 $product_wrapper_classes = implode( " ", apply_filters( 'eael_product_wrapper_class', [], $product->get_id(), 'woo-product-gallery' ) );
29 $title_tag = isset( $settings['eael_product_gallery_title_html_tag'] ) ? Helper::eael_validate_html_tag($settings['eael_product_gallery_title_html_tag']) : 'h2';
30
31 // Improvement
32 $gallery_style_preset = isset($settings['eael_product_gallery_style_preset']) ? $settings['eael_product_gallery_style_preset'] : '';
33 $sale_badge_align = isset( $settings['eael_product_sale_badge_alignment'] ) ? $settings['eael_product_sale_badge_alignment'] : '';
34 $sale_badge_preset = isset($settings['eael_product_sale_badge_preset']) ? $settings['eael_product_sale_badge_preset'] : '';
35 // should print vars
36 $sale_text = !empty($settings['eael_product_gallery_sale_text']) ? $settings['eael_product_gallery_sale_text'] : 'Sale!';
37 $stockout_text = !empty($settings['eael_product_gallery_stockout_text']) ? $settings['eael_product_gallery_stockout_text'] : 'Stock <br/> Out';
38 $should_print_rating = isset( $settings['eael_product_gallery_rating'] ) && 'yes' === $settings['eael_product_gallery_rating'];
39 $should_print_quick_view = isset( $settings['eael_product_gallery_quick_view'] ) && 'yes' === $settings['eael_product_gallery_quick_view'];
40 $should_print_addtocart = isset( $settings['eael_product_gallery_addtocart_show'] ) && 'yes' === $settings['eael_product_gallery_addtocart_show'];
41 $should_print_link = isset( $settings['eael_product_gallery_link_show'] ) && 'yes' === $settings['eael_product_gallery_link_show'];
42 $should_print_image_clickable = isset( $settings['eael_product_gallery_image_clickable'] ) && 'yes' === $settings['eael_product_gallery_image_clickable'];
43 $should_print_price = isset( $settings['eael_product_gallery_price'] ) && 'yes' === $settings['eael_product_gallery_price'];
44 $widget_id = isset($settings['eael_widget_id']) ? $settings['eael_widget_id'] : null;
45 $quick_view_setting = [
46 'widget_id' => $widget_id,
47 'product_id' => $product->get_id(),
48 'page_id' => $settings['eael_page_id'],
49 ];
50
51 $show_secondary_image = isset( $settings['eael_product_gallery_show_secondary_image'] ) && 'yes' === $settings['eael_product_gallery_show_secondary_image'];
52 $image_sources = [
53 'src' => '',
54 'src_hover' => ''
55 ];
56 $product_data = [
57 'title' => sprintf( '<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, $product->get_title() ),
58 'price' => $should_print_price ? '<div class="eael-product-price">' . $product->get_price_html() . '</div>' : '',
59 'ratings' => '',
60 ];
61
62 if ( $should_print_rating ) {
63 $avg_rating = $product->get_average_rating();
64 if( $avg_rating > 0 ){
65 $product_data['ratings'] = wc_get_rating_html( $avg_rating, $product->get_rating_count());
66 } else {
67 $product_data['ratings'] = Helper::eael_rating_markup( $avg_rating, $product->get_rating_count() );
68 }
69 }
70
71 if ( $gallery_style_preset == 'eael-product-preset-4' ) { ?>
72 <li class="product">
73 <?php
74 if($show_secondary_image){
75 $image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
76 }
77 ?>
78 <div class="eael-product-wrap" data-src="<?php echo esc_attr( $image_sources['src'] ) ?>" data-src-hover="<?php echo esc_attr( $image_sources['src_hover'] ) ?>" >
79 <?php
80 do_action( 'eael_woocommerce_before_shop_loop_item' );
81 if ( $settings['eael_wc_loop_hooks'] === 'yes' ){
82 do_action( 'woocommerce_before_shop_loop_item' );
83 }
84
85 echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">'. $stockout_text .'</span>' : ($product->is_on_sale() ? '<span class="eael-onsale '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">' . $sale_text . '</span>' : '') );
86
87 if( $should_print_image_clickable ) {
88 echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
89 }?>
90 <?php
91 echo $product->get_image( $settings['eael_product_gallery_image_size_size'], ['loading' => 'eager', 'alt' => esc_attr( $product->get_title() ) ] );
92 if ( $should_print_image_clickable ) {
93 echo '</a>';
94 }
95
96 $product_data = apply_filters( 'eael/product-gallery/content/reordering', $product_data, $settings, $product );
97 if ( ! empty( $product_data ) ) {
98 foreach ( $product_data as $content ) {
99 if ( ! empty( $content ) ) {
100 echo wp_kses( $content, Helper::eael_allowed_tags(), Helper::eael_allowed_protocols() );
101 }
102 }
103 }
104 ?>
105 <?php
106 if ( $should_print_addtocart ) {
107 woocommerce_template_loop_add_to_cart();
108 }
109 if ( $settings['eael_wc_loop_hooks'] === 'yes' ){
110 do_action( 'woocommerce_after_shop_loop_item' );
111 }
112 do_action( 'eael_woocommerce_after_shop_loop_item' );
113 ?> </div>
114 </li>
115 <?php
116 }
117 else if (($gallery_style_preset == 'eael-product-preset-3') || ($gallery_style_preset == 'eael-product-preset-2')) {
118 ?>
119 <li <?php post_class( "product {$product_wrapper_classes}" ); ?>>
120 <?php
121 if( $show_secondary_image ){
122 $image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
123 }
124
125 ?>
126 <div class="eael-product-wrap" data-src="<?php echo esc_url( $image_sources['src'] ); ?>" data-src-hover="<?php echo esc_url( $image_sources['src_hover'] ); ?>" >
127 <?php
128 do_action( 'eael_woocommerce_before_shop_loop_item' );
129 if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
130 do_action( 'woocommerce_before_shop_loop_item' );
131 }
132 ?>
133 <div class="product-image-wrap">
134 <div class="image-wrap">
135 <?php if( $should_print_image_clickable ) {
136 echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
137 }
138
139 echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">'. $stockout_text .'</span>' : ($product->is_on_sale() ? '<span class="eael-onsale '. esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) .'">' . wp_kses( $sale_text, Helper::eael_allowed_tags() ) . '</span>' : '') );
140 echo $product->get_image($settings['eael_product_gallery_image_size_size'], ['loading' => 'eager', 'alt' => esc_attr( $product->get_title() )]);
141
142 if( $should_print_image_clickable ) {
143 echo '</a>';
144 }?>
145 </div>
146 <div class="image-hover-wrap">
147 <?php if ($gallery_style_preset == 'eael-product-preset-2') { ?>
148 <ul class="icons-wrap block-box-style">
149 <?php if( $should_print_addtocart ){?>
150 <li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
151 <?php } ?>
152 <?php if( $should_print_quick_view ){?>
153 <li class="eael-product-quick-view">
154 <a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
155 class="eael-product-gallery-open-popup open-popup-link">
156 <i class="fas fa-eye"></i>
157 </a>
158 </li>
159 <?php } ?>
160 <?php if( $should_print_link ){?>
161 <li class="view-details"><?php echo '<a href="' . $product->get_permalink
162 () . '" aria-label="View Details about ' . esc_attr( $product->get_title() ). '"><i class="fas fa-link"></i></a>'; ?></li>
163 <?php } ?>
164 </ul>
165 <?php } else { ?>
166 <ul class="icons-wrap box-style">
167 <?php if( $should_print_addtocart ){?>
168 <li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
169 <?php } ?>
170
171 <?php if( $should_print_quick_view ){?>
172 <li class="eael-product-quick-view">
173 <a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
174 class="eael-product-gallery-open-popup open-popup-link">
175 <i class="fas fa-eye"></i>
176 </a>
177 </li>
178 <?php } ?>
179
180 <?php if( $should_print_link ){?>
181 <li class="view-details" title="Details" aria-label="View Details about <?php echo esc_attr( $product->get_title() ); ?>"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
182 <?php } ?>
183 </ul>
184 <?php }
185 ?>
186 </div>
187 </div>
188 <div class="product-details-wrap">
189 <?php
190 $_product_data = [];
191 if($gallery_style_preset == 'eael-product-preset-2' ){
192 $_product_data['price'] = $product_data['price'];
193 }
194
195 $_product_data['ratings'] = $product_data['ratings'];
196 $_product_data['title'] = $product_data['title'];
197
198 if( $gallery_style_preset != 'eael-product-preset-2' ){
199 $_product_data['price'] = $product_data['price'];
200 }
201
202 $product_data = apply_filters( 'eael/product-gallery/content/reordering', $_product_data, $settings, $product );
203 if ( ! empty( $product_data ) ) {
204 foreach ( $product_data as $content ) {
205 if ( ! empty( $content ) ) {
206 echo wp_kses( $content, Helper::eael_allowed_tags(), Helper::eael_allowed_protocols() );
207 }
208 }
209 }
210 ?>
211 </div>
212 <?php
213 if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
214 do_action( 'woocommerce_after_shop_loop_item' );
215 }
216 do_action( 'eael_woocommerce_after_shop_loop_item' );
217 ?>
218 </div>
219 </li>
220 <?php
221 }
222 else if ($gallery_style_preset == 'eael-product-preset-1') {
223 ?>
224 <li <?php post_class( "product {$product_wrapper_classes}" ); ?>>
225 <?php
226 if( $show_secondary_image ){
227 $image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
228 }
229 ?>
230 <div class="eael-product-wrap" data-src="<?php echo esc_url( $image_sources['src'] ); ?>" data-src-hover="<?php echo esc_url( $image_sources['src_hover'] ); ?>" >
231 <?php
232 do_action( 'eael_woocommerce_before_shop_loop_item' );
233 if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
234 do_action( 'woocommerce_before_shop_loop_item' );
235 }
236 ?>
237 <div class="product-image-wrap">
238 <div class="image-wrap">
239 <?php if( $should_print_image_clickable ) {
240 echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
241 }
242
243 echo( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . Helper::eael_wp_kses( $stockout_text ) . '</span>' : ( $product->is_on_sale() ? '<span class="eael-onsale ' . esc_attr( $sale_badge_preset . ' ' . $sale_badge_align ) . '">' . wp_kses( $sale_text, Helper::eael_allowed_tags() ) . '</span>' : '' ) );
244 echo $product->get_image( $settings['eael_product_gallery_image_size_size'], ['loading' => 'eager', 'alt' => esc_attr( $product->get_title() )] );
245
246 if( $should_print_image_clickable ) {
247 echo '</a>';
248 } ?>
249 </div>
250 <div class="image-hover-wrap">
251 <ul class="icons-wrap over-box-style">
252 <?php if( $should_print_addtocart ){?>
253 <li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
254 <?php } ?>
255 <?php if( $should_print_quick_view ){?>
256 <li class="eael-product-quick-view">
257 <a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
258 class="eael-product-gallery-open-popup open-popup-link">
259 <i class="fas fa-eye"></i>
260 </a>
261 </li>
262 <?php } ?>
263 <?php if( $should_print_link ){?>
264 <li class="view-details"><?php echo '<a href="' . $product->get_permalink
265 () . '"><i class="fas fa-link"></i></a>'; ?></li>
266 <?php } ?>
267 </ul>
268 </div>
269 </div>
270 <div class="product-details-wrap">
271 <?php
272 $_product_data = [];
273 $_product_data['price'] = $product_data['price'];
274 $_product_data['title'] = '<div class="eael-product-title"><a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">' .
275 $product_data['title'] . '</a></div>';
276
277 $product_data = apply_filters( 'eael/product-gallery/content/reordering', $_product_data, $settings, $product );
278 if ( ! empty( $product_data ) ) {
279 foreach ( $product_data as $content ) {
280 if ( ! empty( $content ) ) {
281 echo wp_kses( $content, Helper::eael_allowed_tags(), Helper::eael_allowed_protocols() );
282 }
283 }
284 }
285 ?>
286 </div>
287 <?php
288 if ( $settings['eael_wc_loop_hooks'] === 'yes' ) {
289 do_action( 'woocommerce_after_shop_loop_item' );
290 }
291 do_action( 'eael_woocommerce_after_shop_loop_item' );
292 ?>
293 </div>
294 </li>
295 <?php
296
297 }
298