-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathti-wishlist-custom.php
More file actions
230 lines (185 loc) · 9.85 KB
/
ti-wishlist-custom.php
File metadata and controls
230 lines (185 loc) · 9.85 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
<?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 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">
<!-- <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="custom-wishlist-item-remove-mobile product-remove-wishlist">
<button type="submit" name="tinvwl-remove"
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"
title="<?php _e( 'Remove', 'ti-woocommerce-wishlist' ) ?>">
<i class="fas fa-times"></i>
</button>
</div>
<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' ) ?>">
<i class="fas fa-times"></i>
</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.
printf(' - %s', $product->get_attribute( 'Color' ));
printf(', %s', $product->get_attribute( 'Size' ));
// 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>
<?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
<div class="tinv-lists-nav tinv-wishlist-clear">
<?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
</div>
</div>