-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathti-wishlist.2.php
More file actions
401 lines (346 loc) · 18.6 KB
/
ti-wishlist.2.php
File metadata and controls
401 lines (346 loc) · 18.6 KB
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<?php
/**
* The Template for displaying wishlist if a current user is owner.
*
* @version 1.9.0
* @package TInvWishlist\Template
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
wp_enqueue_script( 'tinvwl' );
?>
<div class="tinv-wishlist woocommerce tinv-wishlist-clear">
<?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
<?php if ( function_exists( 'wc_print_notices' ) ) {
wc_print_notices();
} ?>
<form class="" action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
<div class="divider-custom-cart"></div>
<?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
<div class="custom-wishlist-container">
<div class="custom-wishlist-head wishlist-form-desktop">
<!-- <div>
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
<div class="product-cb"><input type="checkbox" class="global-cb"
title="<?php _e( 'Select all for bulk action', 'ti-woocommerce-wishlist' ) ?>">
</div>
<?php } ?>
<div class="product-remove"></div>
<div class="product-thumbnail"> </div>
<div class="product-name"><span
class="tinvwl-full"><?php esc_html_e( 'Product Name', 'ti-woocommerce-wishlist' ); ?></span><span
class="tinvwl-mobile"><?php esc_html_e( 'Product', 'ti-woocommerce-wishlist' ); ?></span></div>
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
<div class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></div>
<?php } ?>
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
<div class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></div>
<?php } ?>
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
<div class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></div>
<?php } ?>
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
<div class="product-action"> </div>
<?php } ?>
</div>
</div> -->
<div class="custom-wishlist-container">
<?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
<?php
foreach ( $products as $wl_product ) {
$product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
unset( $wl_product['data'] );
if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
$product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
?>
<div class="custom-wishlist-item-container <?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
<div class="custom-wishlist-item-thumbnail">
<?php
$thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
if ( ! $product->is_visible() ) {
echo $thumbnail; // WPCS: xss ok.
} else {
printf( '<a href="%s">%s', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
?>
<div class="wishlist-detail-wrapper">
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
<div class="custom-wishlist-item-cb product-cb">
<?php
echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
'<input type="checkbox" name="wishlist_pr[]" value="%d" title="%s">', esc_attr( $wl_product['ID'] ), __( 'Select for bulk action', 'ti-woocommerce-wishlist' )
), $wl_product, $product );
?>
</div>
<?php } ?>
<div class="custom-wishlist-item-remove product-remove-wishlist">
<button type="submit" name="tinvwl-remove"
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
title="<?php _e( 'Remove', 'ti-woocommerce-wishlist' ) ?>">
<img src="<?php echo THEME_IMG_PATH; ?>/close-white.png" class="wishlist-close-button" alt="Close"/>
</button>
</div>
<div class="wishlist-name-price">
<div class="name-price-container">
<div class="custom-wishlist-item-name custom-wishlist-item-set product-set-wishlist product-name-wishlist">
<div class="custom-wishlist-item-name content-name-wishlist">Name</div>
<?php
echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . ' '; // WPCS: xss ok.
?>
<?php
if($product->get_attribute( 'Color' ) !== '') { ?>
<?php printf(' - %s', $product->get_attribute( 'Color' )); ?>
<?php }
?>
<?php
if($product->get_attribute( 'Size' ) !== '') { ?>
<?php printf(' , %s', $product->get_attribute( 'Size' )); ?>
<?php }
?>
<!-- // printf('<div class="wishlist-item-attributes-container attributes-color"> - %s</div>', $product->get_attribute( 'Color' )); -->
<!-- // printf('<div class="wishlist-item-attributes-container attributes-color"> , %s</div>', $product->get_attribute( 'Size' )); -->
<!-- // echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok. -->
<!-- ?> -->
</div>
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
<div class="custom-wishlist-item-set product-set-wishlist product-price-wishlist">
<div class="custom-wishlist-item-price content-name-wishlist">Price</div>
<?php
echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
?>
</div>
<?php } ?>
</div>
<div class="wishlist-stock-addbag">
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
<div class="custom-wishlist-item-set product-set-wishlist product-stock-wishlist">
<div class="custom-wishlist-item-stock content-name-wishlist">Stock status</div>
<?php
$availability = (array) $product->get_availability();
if ( ! array_key_exists( 'availability', $availability ) ) {
$availability['availability'] = '';
}
if ( ! array_key_exists( 'class', $availability ) ) {
$availability['class'] = '';
}
$availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-' . ( ( 'out-of-stock' === esc_attr( $availability['class'] ) ? 'times' : 'check' ) ) . '"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
?>
</div>
<?php } ?>
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
<div class="custom-wishlist-item-set product-set-wishlist product-action">
<div class="custom-wishlist-item-action content-name-wishlist">Action</div>
<?php
if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
?>
<button class="custom-add-to-cart-button" name="tinvwl-add-to-cart"
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
title="<?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product ) ); ?>">
<span
class=""><i class="fas fa-shopping-bag"></i></span>
</button>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
<div class="custom-wishlist-item-set product-set-wishlist product-date-wishlist">
<div class="custom-wishlist-item-date content-name-wishlist">Date</div>
<?php
echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
'<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
), $wl_product, $product );
?>
</div>
<?php } ?>
</div>
<?php
printf( '</a>'); // WPCS: xss ok.
}
?>
</div>
</div>
<?php
do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
} // End if().
} // End foreach().
?>
<?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
</div>
<div class="custom-tfoot">
<div>
<div>
<?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
<?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
</div>
</div>
</div>
</div>
</form>
<form class="wishlist-form-mobile" action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
<?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
<table id="wishlist-table-mobile" class="tinvwl-table-manage-list">
<thead>
<tr>
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
<th class="product-cb"><input type="checkbox" class="global-cb" title="<?php _e( 'Select all for bulk action', 'ti-woocommerce-wishlist' ) ?>">
</th>
<?php } ?>
<th class="product-remove"></th>
<th class="product-thumbnail"> </th>
<th class="product-name"><span
class="tinvwl-full"><?php esc_html_e( 'Product Name', 'ti-woocommerce-wishlist' ); ?></span><span
class="tinvwl-mobile"><?php esc_html_e( 'Product', 'ti-woocommerce-wishlist' ); ?></span></th>
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
<th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
<?php } ?>
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
<th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
<?php } ?>
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
<th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
<?php } ?>
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
<th class="product-action"> </th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
<?php
foreach ( $products as $wl_product ) {
$product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
unset( $wl_product['data'] );
if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
$product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
?>
<tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
<td class="product-cb">
<?php
echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
'<input type="checkbox" name="wishlist_pr[]" value="%d" title="%s">', esc_attr( $wl_product['ID'] ), __( 'Select for bulk action', 'ti-woocommerce-wishlist' )
), $wl_product, $product );
?>
</td>
<?php } ?>
<td class="product-remove-wishlist wishlist-remove-td">
<button type="submit" name="tinvwl-remove"
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
title="<?php _e( 'Remove', 'ti-woocommerce-wishlist' ) ?>"><img src="<?php echo THEME_IMG_PATH; ?>/close-white.png" class="wishlist-close-button" alt="Close"/>
</button>
</td>
<td class="product-thumbnail-wishlist">
<?php
$thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
if ( ! $product->is_visible() ) {
echo $thumbnail; // WPCS: xss ok.
} else {
printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
}
?>
</td>
<td class="product-set-wishlist product-name-wishlist">
<div class="content-name-wishlist">Name</div>
<?php
echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . ' '; // WPCS: xss ok.
?>
<?php
if($product->get_attribute( 'Color' ) !== '') { ?>
<?php printf(' - %s', $product->get_attribute( 'Color' )); ?>
<?php }
?>
<?php
if($product->get_attribute( 'Size' ) !== '') { ?>
<?php printf(' , %s', $product->get_attribute( 'Size' )); ?>
<?php }
?>
<!-- // printf('<div class="wishlist-item-attributes-container attributes-color"> - %s</div>', $product->get_attribute( 'Color' )); -->
<!-- // printf('<div class="wishlist-item-attributes-container attributes-color"> , %s</div>', $product->get_attribute( 'Size' )); -->
<!-- // echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok. -->
<!-- ?> -->
<?php
// if ( ! $product->is_visible() ) {
// echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . ' ';
// } else {
// echo apply_filters( 'tinvwl_wishlist_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_url ), $product->get_title() ), $wl_product, $product );
// }
// echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product );
?>
</td>
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
<td class="product-set-wishlist product-price-wishlist">
<div class="content-name-wishlist">Price</div>
<?php
echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
?>
</td>
<?php } ?>
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
<td class="product-set-wishlist product-date-wishlist">
<div class="content-name-wishlist">Date</div>
<?php
echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
'<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
), $wl_product, $product );
?>
</td>
<?php } ?>
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
<td class="product-set-wishlist product-stock-wishlist">
<div class="content-name-wishlist">Stock status</div>
<?php
$availability = (array) $product->get_availability();
if ( ! array_key_exists( 'availability', $availability ) ) {
$availability['availability'] = '';
}
if ( ! array_key_exists( 'class', $availability ) ) {
$availability['class'] = '';
}
$availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-' . ( ( 'out-of-stock' === esc_attr( $availability['class'] ) ? 'times' : 'check' ) ) . '"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
?>
</td>
<?php } ?>
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
<td class="product-set-wishlist product-action">
<div class="content-name-wishlist">Action</div>
<?php
if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
?>
<button class="button alt add_cart_for_wishlist" name="tinvwl-add-to-cart"
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
title="<?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product ) ); ?>">
<img src="<?php echo THEME_IMG_PATH; ?>/bag_main.png" alt="bag"/><span
class="tinvwl-txt"><?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_cart', $wishlist_table_row['text_add_to_cart'], $wl_product, $product ) ); ?></span>
</button>
<?php } ?>
</td>
<?php } ?>
</tr>
<?php
do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
} // End if().
} // End foreach().
?>
<?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
</tbody>
<tfoot>
<tr>
<td colspan="100">
<?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
<?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
</td>
</tr>
</tfoot>
</table>
</form>
<?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
<div class="tinv-lists-nav tinv-wishlist-clear">
<?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
</div>
</div>