-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-product.php
executable file
·305 lines (230 loc) · 8.87 KB
/
single-product.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<?php
/**
* The template for displaying all single posts.
*
* @package Paul Component Engineering
* @version 2.4.7
*/
get_header(); ?>
<script>
jQuery(document).ready(function(){
jQuery(".accordion").hide();
jQuery('.value').each(function() {
var $dropdown = jQuery(this);
jQuery(".accordion-hook", $dropdown).click(function(e) {
e.preventDefault();
$div = jQuery(".accordion", $dropdown);
$div.toggle('blind');
jQuery(".accordion").not($div).hide('blind');
return false;
});
});
jQuery('html').click(function(){
jQuery(".accordion").hide('blind');
});
});
</script>
<?php get_template_part('partials/breadcrumbs'); ?>
<?php do_action( 'woocommerce_before_single_product' ); ?>
<section class="product-container">
<?php while ( have_posts() ) : the_post(); ?>
<section class="product-section product-top">
<script>
jQuery(document).ready(function(){
jQuery('.product-image').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
asNavFor: '.product-thumbs'
});
jQuery('.product-thumbs').slick({
slidesToShow: 3,
slidesToScroll: 1,
arrows: false,
asNavFor: '.product-image',
dots: false,
focusOnSelect: true
});
jQuery('.supporting-video-container').slick({
slidesToShow: 1,
slidesToScroll: 1,
dots: true,
arrows: false,
});
var video_width = jQuery('.supporting-video-container').width();
var iframe_height = ( video_width * ('.' + 75) );
jQuery('.supporting-video-container').css('height', iframe_height);
jQuery('.supporting-video iframe').css('height', iframe_height);
});
</script>
<div class="product-gallery-container">
<div class="product-image">
<?php if( get_field('gallery') ) : ?>
<?php
$images = get_field('gallery');
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<picture class="portal-image">
<!--[if IE 9]><video style="display: none"><![endif]-->
<source
srcset="<?php echo $image['sizes']['portal-mobile']; ?>"
media="(max-width: 500px)" />
<source
srcset="<?php echo $image['sizes']['portal-tablet']; ?>"
media="(max-width: 860px)" />
<source
srcset="<?php echo $image['sizes']['portal-desktop']; ?>"
media="(max-width: 1180px)" />
<source
srcset="<?php echo $image['sizes']['portal-retina']; ?>"
media="(min-width: 1181px)" />
<!--[if IE 9]></video><![endif]-->
<img srcset="<?php echo $image['sizes']['portal-desktop']; ?>">
</picture>
<?php endforeach; ?>
<?php endif; ?>
<?php else: ?>
<?php $mobile_page_banner = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'portal-mobile'); ?>
<?php $tablet_page_banner = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'portal-tablet'); ?>
<?php $desktop_page_banner = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'portal-desktop'); ?>
<?php $retina_page_banner = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'portal-retina'); ?>
<picture>
<!--[if IE 9]><video style="display: none"><![endif]-->
<source
srcset="<?php echo $mobile_page_banner[0]; ?>"
media="(max-width: 500px)" />
<source
srcset="<?php echo $tablet_page_banner[0]; ?>"
media="(max-width: 860px)" />
<source
srcset="<?php echo $desktop_page_banner[0]; ?>"
media="(max-width: 1180px)" />
<source
srcset="<?php echo $retina_page_banner[0]; ?>"
media="(min-width: 1181px)" />
<!--[if IE 9]></video><![endif]-->
<img srcset="<?php echo $image[0]; ?>">
</picture>
<?php endif; ?>
</div>
<div class="product-thumbs">
<?php
$images = get_field('gallery');
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<div class="product-add-to-cart">
<h4><?php the_title(); ?></h4>
<?php $dealer_user = wp_get_current_user();
if ( in_array( 'dealer', (array) $dealer_user->roles ) ) { ?>
<strong>Dealers: Your pricing will appear in the <a href="/cart">cart</a>. We are currently working on showing your pricing on product pages. Thanks for your patience!</strong><br />
<?php } ?>
<?php if( $product->is_type( 'simple' ) ) : ?>
<div class="simple-product">
<?php if ( $price_html = $product->get_price_html() ) : ?>
<h3><span class="price"><?php echo $price_html; ?></span></h3>
<?php endif; ?>
<?php endif; ?>
<?php
/**
* woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
do_action( 'woocommerce_single_product_summary' );
?>
<?php if( $product->is_type( 'simple' ) ) : ?>
</div>
<?php endif; ?>
<div class="lead-in-copy">
<?php the_excerpt(); ?>
</div>
</div>
</section>
<section class="product-section product-middle">
<div class="tech-specs">
<!-- Tech Specifications Content -->
<?php if( have_rows('technical_specification_rows') ) : ?>
<h4>Technical Information</h4>
<ul>
<?php while ( have_rows('technical_specification_rows') ) : ?>
<?php the_row(); ?>
<?php if( get_row_layout() == 'spec' ) : ?>
<li>
<div class="key"><small><?php the_sub_field('key'); ?></small></div>
<div class="value">
<small>
<?php if(get_sub_field('answer') == "Text") : ?>
<?php the_sub_field('value'); ?>
<?php elseif(get_sub_field('answer') == "File Download") : ?>
<a href="<?php the_sub_field('file_download'); ?>">Download</a>
<?php elseif(get_sub_field('answer') == "Inline Answer") : ?>
<span class="accordion-hook"><?php the_sub_field('inline_title'); ?>↓</span>
<div class="accordion">
<?php the_sub_field('inline_answer'); ?>
</div>
<?php endif; ?>
</small>
</div>
</li>
<?php endif; ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</div>
<?php if( have_rows('video_repeater') ) : ?>
<div class="supporting-video-container">
<?php while ( have_rows('video_repeater') ) : ?>
<?php the_row(); ?>
<div class="supporting-video">
<?php the_sub_field('video'); ?>
</div>
<?php endwhile; ?>
</div>
<?php elseif( the_content() ) : ?>
<div class="product-story">
<?php
if($post->content=="")
{ ?>
<?php } else {
?>
<?php } ?>
<h4>Product Story</h4>
<?php the_content(); ?>
</div>
<?php endif; ?>
</section>
<?php if( have_rows('video_repeater') ) : ?>
<section class="product-section product-bottom">
<div class="product-story">
<h4>Product Story</h4>
<?php the_content(); ?>
</div>
</section>
<?php else: ?>
<?php endif; ?>
<section class="product-section related-products">
<!-- <h4>Related Products</h4> -->
<?php
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
do_action( 'woocommerce_after_single_product_summary' );
?>
</section>
<?php endwhile; // end of the loop. ?>
</section>
<?php get_footer(); ?>