PluginProbe ʕ •ᴥ•ʔ
Essential Addons for Elementor – Popular Elementor Templates & Widgets / 5.8.7
Essential Addons for Elementor – Popular Elementor Templates & Widgets v5.8.7
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 2 years ago
default.php
244 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
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 //if ( true === wc_get_loop_product_visibility( $product->get_id() ) || $product->is_visible() ) {
57
58 if ( $gallery_style_preset == 'eael-product-preset-4' ) { ?>
59 <li class="product">
60 <?php
61 if($show_secondary_image){
62 $image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
63 }
64 ?>
65 <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'] ) ?>" >
66 <?php
67 echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock '.$sale_badge_preset.' '.$sale_badge_align.'">'. Helper::eael_wp_kses($stockout_text) .'</span>' : ($product->is_on_sale() ? '<span class="eael-onsale '.$sale_badge_preset.' '.$sale_badge_align.'">' . Helper::eael_wp_kses($sale_text) . '</span>' : '') );
68
69 if( $should_print_image_clickable ) {
70 echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
71 }?>
72 <?php
73 // echo wp_kses_post( $product->get_image( 'woocommerce_thumbnail', ['loading' => 'eager'] ) );
74 echo wp_kses_post( $product->get_image( $settings['eael_product_gallery_image_size_size'], ['loading' => 'eager'] ) );
75 if ( $should_print_image_clickable ) {
76 echo '</a>';
77 }
78 printf('<%1$s class="woocommerce-loop-product__title">%2$s</%1$s>', $title_tag, Helper::eael_wp_kses($product->get_title()));
79 if ( $should_print_rating ) {
80 echo wp_kses_post( wc_get_rating_html( $product->get_average_rating(), $product->get_rating_count() ) );
81 }
82
83 if ( $should_print_price ) {
84 echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
85 }
86 ?>
87 <?php
88 if ( $should_print_addtocart ) {
89 woocommerce_template_loop_add_to_cart();
90 } ?>
91 </div>
92 </li>
93 <?php
94 } else if (($gallery_style_preset == 'eael-product-preset-3') || ($gallery_style_preset == 'eael-product-preset-2')) {
95 ?>
96 <li <?php post_class( 'product' ); ?>>
97 <?php
98 if( $show_secondary_image ){
99 $image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
100 }
101
102 ?>
103 <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'] ) ?>" >
104 <div class="product-image-wrap">
105 <div class="image-wrap">
106 <?php if( $should_print_image_clickable ) {
107 echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
108 }?>
109 <?php
110 echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock '.$sale_badge_preset.' '.$sale_badge_align.'">'. Helper::eael_wp_kses( $stockout_text ) .'</span>' : ($product->is_on_sale() ? '<span class="eael-onsale '.$sale_badge_preset.' '.$sale_badge_align.'">' . Helper::eael_wp_kses($sale_text) . '</span>' : '') );
111 echo $product->get_image($settings['eael_product_gallery_image_size_size'], ['loading' => 'eager']);
112 ?>
113 <?php if( $should_print_image_clickable ) {
114 echo '</a>';
115 }?>
116 </div>
117 <div class="image-hover-wrap">
118 <?php if ($gallery_style_preset == 'eael-product-preset-2') { ?>
119 <ul class="icons-wrap block-box-style">
120 <?php if( $should_print_addtocart ){?>
121 <li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
122 <?php } ?>
123 <?php if( $should_print_quick_view ){?>
124 <li class="eael-product-quick-view">
125 <a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
126 class="eael-product-gallery-open-popup open-popup-link">
127 <i class="fas fa-eye"></i>
128 </a>
129 </li>
130 <?php } ?>
131 <?php if( $should_print_link ){?>
132 <li class="view-details"><?php echo '<a href="' . $product->get_permalink
133 () . '"><i class="fas fa-link"></i></a>'; ?></li>
134 <?php } ?>
135 </ul>
136 <?php } else { ?>
137 <ul class="icons-wrap box-style">
138 <?php if( $should_print_addtocart ){?>
139 <li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
140 <?php } ?>
141
142 <?php if( $should_print_quick_view ){?>
143 <li class="eael-product-quick-view">
144 <a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
145 class="eael-product-gallery-open-popup open-popup-link">
146 <i class="fas fa-eye"></i>
147 </a>
148 </li>
149 <?php } ?>
150
151 <?php if( $should_print_link ){?>
152 <li class="view-details" title="Details"><?php echo '<a href="' . $product->get_permalink() . '"><i class="fas fa-link"></i></a>'; ?></li>
153 <?php } ?>
154 </ul>
155 <?php }
156 ?>
157 </div>
158 </div>
159 <div class="product-details-wrap">
160 <?php
161 if(($gallery_style_preset == 'eael-product-preset-2') && $should_print_price ){
162 echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
163 }
164
165 if ($should_print_rating) {
166 echo wc_get_rating_html
167 ($product->get_average_rating(), $product->get_rating_count());
168 }
169 ?>
170 <div class="eael-product-title">
171 <?php printf('<%1$s>%2$s</%1$s>', $title_tag, Helper::eael_wp_kses($product->get_title())); ?>
172 </div>
173 <?php if(($gallery_style_preset != 'eael-product-preset-2') && $should_print_price ){
174 echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
175 }?>
176 </div>
177 </div>
178 </li>
179 <?php
180
181 } else if ($gallery_style_preset == 'eael-product-preset-1') {
182 ?>
183 <li <?php post_class( 'product' ); ?>>
184 <?php
185 if( $show_secondary_image ){
186 $image_sources = Helper::eael_get_woo_product_gallery_image_srcs( $product, $settings['eael_product_gallery_image_size_size'] );
187 }
188 ?>
189 <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'] ) ?>" >
190 <div class="product-image-wrap">
191 <div class="image-wrap">
192 <?php if( $should_print_image_clickable ) {
193 echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
194 }?>
195
196 <?php
197 echo ( ! $product->is_in_stock() ? '<span class="eael-onsale outofstock '.$sale_badge_preset.' '.$sale_badge_align.'">'. Helper::eael_wp_kses($stockout_text) .'</span>' : ($product->is_on_sale() ? '<span class="eael-onsale '.$sale_badge_preset.' '.$sale_badge_align.'">' . Helper::eael_wp_kses($sale_text) . '</span>' : '') );
198 echo $product->get_image($settings['eael_product_gallery_image_size_size'], ['loading' => 'eager']);
199 ?>
200 <?php if( $should_print_image_clickable ) {
201 echo '</a>';
202 }?>
203 </div>
204 <div class="image-hover-wrap">
205 <ul class="icons-wrap over-box-style">
206 <?php if( $should_print_addtocart ){?>
207 <li class="add-to-cart"><?php woocommerce_template_loop_add_to_cart(); ?></li>
208 <?php } ?>
209 <?php if( $should_print_quick_view ){?>
210 <li class="eael-product-quick-view">
211 <a id="eael_quick_view_<?php echo uniqid(); ?>" data-quickview-setting="<?php echo htmlspecialchars(json_encode($quick_view_setting),ENT_QUOTES); ?>"
212 class="eael-product-gallery-open-popup open-popup-link">
213 <i class="fas fa-eye"></i>
214 </a>
215 </li>
216 <?php } ?>
217 <?php if( $should_print_link ){?>
218 <li class="view-details"><?php echo '<a href="' . $product->get_permalink
219 () . '"><i class="fas fa-link"></i></a>'; ?></li>
220 <?php } ?>
221 </ul>
222 </div>
223 </div>
224 <div class="product-details-wrap">
225 <?php
226 if ( $should_print_price ) {
227 echo '<div class="eael-product-price">'.$product->get_price_html().'</div>';
228 }
229 ?>
230 <div class="eael-product-title">
231 <?php
232 echo '<a href="' . $product->get_permalink() . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
233 printf('<%1$s>%2$s</%1$s>', $title_tag, Helper::eael_wp_kses($product->get_title()));
234 echo '</a>';
235 ?>
236 </div>
237 </div>
238 </div>
239 </li>
240 <?php
241
242 }
243 //}
244