WPC Smart Wishlist for WooCommerce - Version 4.5.0

Version Description

  • Fixed: Wishlist overview in website backend
Download this release

Release Info

Developer wpclever
Plugin Icon 128x128 WPC Smart Wishlist for WooCommerce
Version 4.5.0
Comparing to
See all releases

Code changes from version 4.4.5 to 4.5.0

assets/css/backend.css CHANGED
@@ -60,6 +60,35 @@
60
  display: inline-block;
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  .wpc-premium, .wpc-premium a {
64
  color: #c9356e;
65
  }
60
  display: inline-block;
61
  }
62
 
63
+ .woosw-quickview-item .woosw_action.woosw_action_0 {
64
+ pointer-events: none;
65
+ text-decoration: none;
66
+ color: #999999;
67
+ }
68
+
69
+ .woosw-quickview-items a[target="_blank"]:after {
70
+ content: ' \f504';
71
+ font-family: dashicons;
72
+ display: inline-block;
73
+ line-height: 1;
74
+ font-weight: 400;
75
+ font-style: normal;
76
+ speak: never;
77
+ text-decoration: inherit;
78
+ text-transform: none;
79
+ text-rendering: auto;
80
+ -webkit-font-smoothing: antialiased;
81
+ -moz-osx-font-smoothing: grayscale;
82
+ width: 14px;
83
+ height: 14px;
84
+ font-size: 14px;
85
+ vertical-align: text-bottom;
86
+ margin-left: 5px;
87
+ text-align: center;
88
+ transition: color .1s ease-in;
89
+ text-decoration: none;
90
+ }
91
+
92
  .wpc-premium, .wpc-premium a {
93
  color: #c9356e;
94
  }
assets/js/backend.js CHANGED
@@ -9,6 +9,7 @@
9
  });
10
 
11
  $(document).on('click touch', '.woosw_action', function (e) {
 
12
  var pid = $(this).attr('data-pid');
13
  var key = $(this).attr('data-key');
14
 
@@ -33,6 +34,7 @@
33
 
34
  var data = {
35
  action: 'wishlist_quickview',
 
36
  key: key,
37
  };
38
 
@@ -56,6 +58,7 @@
56
 
57
  var data = {
58
  action: 'wishlist_quickview',
 
59
  pid: pid,
60
  };
61
 
@@ -64,6 +67,30 @@
64
  });
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  e.preventDefault();
68
  });
69
 
9
  });
10
 
11
  $(document).on('click touch', '.woosw_action', function (e) {
12
+ var uid = $(this).attr('data-uid');
13
  var pid = $(this).attr('data-pid');
14
  var key = $(this).attr('data-key');
15
 
34
 
35
  var data = {
36
  action: 'wishlist_quickview',
37
+ nonce: woosw_vars.nonce,
38
  key: key,
39
  };
40
 
58
 
59
  var data = {
60
  action: 'wishlist_quickview',
61
+ nonce: woosw_vars.nonce,
62
  pid: pid,
63
  };
64
 
67
  });
68
  }
69
 
70
+ if (uid && uid != '') {
71
+ $('#woosw_popup').dialog({
72
+ minWidth: 460,
73
+ title: 'User ID #' + uid,
74
+ modal: true,
75
+ dialogClass: 'wpc-dialog',
76
+ open: function () {
77
+ $('.ui-widget-overlay').bind('click', function () {
78
+ $('#woosw_popup').dialog('close');
79
+ });
80
+ },
81
+ });
82
+
83
+ var data = {
84
+ action: 'wishlist_quickview',
85
+ nonce: woosw_vars.nonce,
86
+ uid: uid,
87
+ };
88
+
89
+ $.post(ajaxurl, data, function (response) {
90
+ $('#woosw_popup').html(response);
91
+ });
92
+ }
93
+
94
  e.preventDefault();
95
  });
96
 
languages/woo-smart-wishlist.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the WPC Smart Wishlist for WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WPC Smart Wishlist for WooCommerce 4.4.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-smart-wishlist\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-11-10T13:54:40+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: woo-smart-wishlist\n"
@@ -46,7 +46,7 @@ msgstr ""
46
  #: wpc-smart-wishlist.php:429
47
  #: wpc-smart-wishlist.php:448
48
  #: wpc-smart-wishlist.php:1495
49
- #: wpc-smart-wishlist.php:1781
50
  msgid "There are no products on the Wishlist!"
51
  msgstr ""
52
 
@@ -157,7 +157,7 @@ msgid "Settings updated."
157
  msgstr ""
158
 
159
  #: wpc-smart-wishlist.php:785
160
- #: wpc-smart-wishlist.php:1653
161
  msgid "Settings"
162
  msgstr ""
163
 
@@ -167,7 +167,7 @@ msgid "Localization"
167
  msgstr ""
168
 
169
  #: wpc-smart-wishlist.php:794
170
- #: wpc-smart-wishlist.php:1654
171
  msgid "Premium Version"
172
  msgstr ""
173
 
@@ -341,7 +341,7 @@ msgstr ""
341
  #: wpc-smart-wishlist.php:1269
342
  #: wpc-smart-wishlist.php:1347
343
  #: wpc-smart-wishlist.php:1352
344
- #: wpc-smart-wishlist.php:1876
345
  msgid "Open wishlist page"
346
  msgstr ""
347
 
@@ -592,18 +592,18 @@ msgstr ""
592
  #: wpc-smart-wishlist.php:1383
593
  #: wpc-smart-wishlist.php:1572
594
  #: wpc-smart-wishlist.php:1622
595
- #: wpc-smart-wishlist.php:1828
596
- #: wpc-smart-wishlist.php:1846
597
- #: wpc-smart-wishlist.php:1917
598
- #: wpc-smart-wishlist.php:2127
599
- #: wpc-smart-wishlist.php:2208
600
- #: wpc-smart-wishlist.php:2215
601
- #: wpc-smart-wishlist.php:2437
602
  msgid "Wishlist"
603
  msgstr ""
604
 
605
  #: wpc-smart-wishlist.php:1325
606
- #: wpc-smart-wishlist.php:1859
607
  msgid "remove all"
608
  msgstr ""
609
 
@@ -617,7 +617,7 @@ msgstr ""
617
 
618
  #: wpc-smart-wishlist.php:1356
619
  #: wpc-smart-wishlist.php:1361
620
- #: wpc-smart-wishlist.php:1881
621
  msgid "Continue shopping"
622
  msgstr ""
623
 
@@ -631,7 +631,7 @@ msgstr ""
631
 
632
  #: wpc-smart-wishlist.php:1387
633
  #: wpc-smart-wishlist.php:1392
634
- #: wpc-smart-wishlist.php:1897
635
  msgid "Manage wishlists"
636
  msgstr ""
637
 
@@ -640,7 +640,7 @@ msgid "Set default"
640
  msgstr ""
641
 
642
  #: wpc-smart-wishlist.php:1401
643
- #: wpc-smart-wishlist.php:1931
644
  msgid "set default"
645
  msgstr ""
646
 
@@ -649,7 +649,7 @@ msgid "Default"
649
  msgstr ""
650
 
651
  #: wpc-smart-wishlist.php:1410
652
- #: wpc-smart-wishlist.php:1929
653
  msgid "default"
654
  msgstr ""
655
 
@@ -658,7 +658,7 @@ msgid "Delete"
658
  msgstr ""
659
 
660
  #: wpc-smart-wishlist.php:1419
661
- #: wpc-smart-wishlist.php:1937
662
  msgid "delete"
663
  msgstr ""
664
 
@@ -667,7 +667,7 @@ msgid "Wishlist name placeholder"
667
  msgstr ""
668
 
669
  #: wpc-smart-wishlist.php:1428
670
- #: wpc-smart-wishlist.php:1948
671
  msgid "New Wishlist"
672
  msgstr ""
673
 
@@ -676,7 +676,7 @@ msgid "Add new wishlist"
676
  msgstr ""
677
 
678
  #: wpc-smart-wishlist.php:1437
679
- #: wpc-smart-wishlist.php:1950
680
  msgid "Add New Wishlist"
681
  msgstr ""
682
 
@@ -740,33 +740,49 @@ msgstr ""
740
  msgid "Have an error"
741
  msgstr ""
742
 
743
- #: wpc-smart-wishlist.php:1670
744
  msgid "Community support"
745
  msgstr ""
746
 
747
- #: wpc-smart-wishlist.php:2263
748
- #: wpc-smart-wishlist.php:2266
749
- #: wpc-smart-wishlist.php:2330
750
- #: wpc-smart-wishlist.php:2333
 
 
 
 
 
751
  msgid "%s product"
752
  msgid_plural "%s products"
753
  msgstr[0] ""
754
  msgstr[1] ""
755
 
756
- #: wpc-smart-wishlist.php:2265
757
- #: wpc-smart-wishlist.php:2332
758
  msgid "Guest"
759
  msgstr ""
760
 
761
- #: wpc-smart-wishlist.php:2280
 
762
  #: wpc-smart-wishlist.php:2309
763
- msgid "Edit"
 
764
  msgstr ""
765
 
766
- #: wpc-smart-wishlist.php:2280
767
  msgid "See in wishlist"
768
  msgstr ""
769
 
770
- #: wpc-smart-wishlist.php:2288
771
- msgid "Empty Wishlist"
 
 
 
 
 
 
 
 
 
772
  msgstr ""
2
  # This file is distributed under the same license as the WPC Smart Wishlist for WooCommerce plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WPC Smart Wishlist for WooCommerce 4.5.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-smart-wishlist\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-11-21T17:18:43+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: woo-smart-wishlist\n"
46
  #: wpc-smart-wishlist.php:429
47
  #: wpc-smart-wishlist.php:448
48
  #: wpc-smart-wishlist.php:1495
49
+ #: wpc-smart-wishlist.php:1785
50
  msgid "There are no products on the Wishlist!"
51
  msgstr ""
52
 
157
  msgstr ""
158
 
159
  #: wpc-smart-wishlist.php:785
160
+ #: wpc-smart-wishlist.php:1657
161
  msgid "Settings"
162
  msgstr ""
163
 
167
  msgstr ""
168
 
169
  #: wpc-smart-wishlist.php:794
170
+ #: wpc-smart-wishlist.php:1658
171
  msgid "Premium Version"
172
  msgstr ""
173
 
341
  #: wpc-smart-wishlist.php:1269
342
  #: wpc-smart-wishlist.php:1347
343
  #: wpc-smart-wishlist.php:1352
344
+ #: wpc-smart-wishlist.php:1880
345
  msgid "Open wishlist page"
346
  msgstr ""
347
 
592
  #: wpc-smart-wishlist.php:1383
593
  #: wpc-smart-wishlist.php:1572
594
  #: wpc-smart-wishlist.php:1622
595
+ #: wpc-smart-wishlist.php:1832
596
+ #: wpc-smart-wishlist.php:1850
597
+ #: wpc-smart-wishlist.php:1921
598
+ #: wpc-smart-wishlist.php:2131
599
+ #: wpc-smart-wishlist.php:2212
600
+ #: wpc-smart-wishlist.php:2219
601
+ #: wpc-smart-wishlist.php:2469
602
  msgid "Wishlist"
603
  msgstr ""
604
 
605
  #: wpc-smart-wishlist.php:1325
606
+ #: wpc-smart-wishlist.php:1863
607
  msgid "remove all"
608
  msgstr ""
609
 
617
 
618
  #: wpc-smart-wishlist.php:1356
619
  #: wpc-smart-wishlist.php:1361
620
+ #: wpc-smart-wishlist.php:1885
621
  msgid "Continue shopping"
622
  msgstr ""
623
 
631
 
632
  #: wpc-smart-wishlist.php:1387
633
  #: wpc-smart-wishlist.php:1392
634
+ #: wpc-smart-wishlist.php:1901
635
  msgid "Manage wishlists"
636
  msgstr ""
637
 
640
  msgstr ""
641
 
642
  #: wpc-smart-wishlist.php:1401
643
+ #: wpc-smart-wishlist.php:1935
644
  msgid "set default"
645
  msgstr ""
646
 
649
  msgstr ""
650
 
651
  #: wpc-smart-wishlist.php:1410
652
+ #: wpc-smart-wishlist.php:1933
653
  msgid "default"
654
  msgstr ""
655
 
658
  msgstr ""
659
 
660
  #: wpc-smart-wishlist.php:1419
661
+ #: wpc-smart-wishlist.php:1941
662
  msgid "delete"
663
  msgstr ""
664
 
667
  msgstr ""
668
 
669
  #: wpc-smart-wishlist.php:1428
670
+ #: wpc-smart-wishlist.php:1952
671
  msgid "New Wishlist"
672
  msgstr ""
673
 
676
  msgstr ""
677
 
678
  #: wpc-smart-wishlist.php:1437
679
+ #: wpc-smart-wishlist.php:1954
680
  msgid "Add New Wishlist"
681
  msgstr ""
682
 
740
  msgid "Have an error"
741
  msgstr ""
742
 
743
+ #: wpc-smart-wishlist.php:1674
744
  msgid "Community support"
745
  msgstr ""
746
 
747
+ #: wpc-smart-wishlist.php:2238
748
+ msgid "Permissions check failed!"
749
+ msgstr ""
750
+
751
+ #: wpc-smart-wishlist.php:2262
752
+ #: wpc-smart-wishlist.php:2265
753
+ #: wpc-smart-wishlist.php:2337
754
+ #: wpc-smart-wishlist.php:2340
755
+ #: wpc-smart-wishlist.php:2370
756
  msgid "%s product"
757
  msgid_plural "%s products"
758
  msgstr[0] ""
759
  msgstr[1] ""
760
 
761
+ #: wpc-smart-wishlist.php:2264
762
+ #: wpc-smart-wishlist.php:2339
763
  msgid "Guest"
764
  msgstr ""
765
 
766
+ #: wpc-smart-wishlist.php:2277
767
+ #: wpc-smart-wishlist.php:2284
768
  #: wpc-smart-wishlist.php:2309
769
+ #: wpc-smart-wishlist.php:2316
770
+ msgid "Product ID: %s"
771
  msgstr ""
772
 
773
+ #: wpc-smart-wishlist.php:2277
774
  msgid "See in wishlist"
775
  msgstr ""
776
 
777
+ #: wpc-smart-wishlist.php:2285
778
+ #: wpc-smart-wishlist.php:2317
779
+ msgid "This product is not available!"
780
+ msgstr ""
781
+
782
+ #: wpc-smart-wishlist.php:2294
783
+ msgid "Wishlist #%s"
784
+ msgstr ""
785
+
786
+ #: wpc-smart-wishlist.php:2295
787
+ msgid "This wishlist have no product!"
788
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpclever.net
4
  Tags: woocommerce, woo, wpc, smart, wishlist, wish list
5
  Requires at least: 4.0
6
  Tested up to: 6.1
7
- Stable tag: 4.4.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -106,6 +106,9 @@ Example:
106
 
107
  == Changelog ==
108
 
 
 
 
109
  = 4.4.5 =
110
  * Fixed: Minor JS issue in the backend
111
 
4
  Tags: woocommerce, woo, wpc, smart, wishlist, wish list
5
  Requires at least: 4.0
6
  Tested up to: 6.1
7
+ Stable tag: 4.5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
106
 
107
  == Changelog ==
108
 
109
+ = 4.5.0 =
110
+ * Fixed: Wishlist overview in website backend
111
+
112
  = 4.4.5 =
113
  * Fixed: Minor JS issue in the backend
114
 
wpc-smart-wishlist.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WPC Smart Wishlist for WooCommerce
4
  Plugin URI: https://wpclever.net/
5
  Description: WPC Smart Wishlist is a simple but powerful tool that can help your customer save products for buy later.
6
- Version: 4.4.5
7
  Author: WPClever
8
  Author URI: https://wpclever.net
9
  Text Domain: woo-smart-wishlist
@@ -16,7 +16,7 @@ WC tested up to: 7.1
16
 
17
  defined( 'ABSPATH' ) || exit;
18
 
19
- ! defined( 'WOOSW_VERSION' ) && define( 'WOOSW_VERSION', '4.4.5' );
20
  ! defined( 'WOOSW_FILE' ) && define( 'WOOSW_FILE', __FILE__ );
21
  ! defined( 'WOOSW_URI' ) && define( 'WOOSW_URI', plugin_dir_url( __FILE__ ) );
22
  ! defined( 'WOOSW_DIR' ) && define( 'WOOSW_DIR', plugin_dir_path( __FILE__ ) );
@@ -1640,6 +1640,10 @@ if ( ! function_exists( 'woosw_init' ) ) {
1640
  'wp-color-picker',
1641
  'jquery-ui-dialog'
1642
  ), WOOSW_VERSION, true );
 
 
 
 
1643
  }
1644
 
1645
  function action_links( $links, $file ) {
@@ -2219,14 +2223,10 @@ if ( ! function_exists( 'woosw_init' ) ) {
2219
 
2220
  function users_columns_content( $val, $column_name, $user_id ) {
2221
  if ( $column_name === 'woosw' ) {
2222
- $key = get_user_meta( $user_id, 'woosw_key', true );
2223
-
2224
- if ( ! empty( $key ) ) {
2225
- $products = self::get_ids( $key );
2226
 
2227
- if ( $count = count( $products ) ) {
2228
- $val = '<a href="#" class="woosw_action" data-key="' . esc_attr( $key ) . '">' . esc_html( $count ) . '</a>';
2229
- }
2230
  }
2231
  }
2232
 
@@ -2234,32 +2234,31 @@ if ( ! function_exists( 'woosw_init' ) ) {
2234
  }
2235
 
2236
  function wishlist_quickview() {
2237
- check_admin_referer();
 
 
2238
 
2239
  global $wpdb;
2240
- $wishlist_html = '';
 
2241
 
2242
  if ( isset( $_POST['key'] ) && $_POST['key'] != '' ) {
2243
- ob_start();
2244
-
2245
  $key = sanitize_text_field( $_POST['key'] );
2246
  $products = self::get_ids( $key );
2247
  $count = count( $products );
2248
 
2249
  if ( count( $products ) > 0 ) {
2250
- echo '<div class="woosw-quickview-items">';
2251
-
2252
- $user = $wpdb->get_results( $wpdb->prepare( 'SELECT user_id FROM `' . $wpdb->prefix . 'usermeta` WHERE `meta_key` = "woosw_key" AND `meta_value` = "%s" LIMIT 1', $key ) );
2253
 
2254
  echo '<div class="woosw-quickview-item">';
2255
- echo '<div class="woosw-quickview-item-image"><a href="' . esc_url( self::get_url( $key, true ) ) . '" target="_blank">#' . $key . '</a></div>';
2256
  echo '<div class="woosw-quickview-item-info">';
2257
 
2258
  if ( ! empty( $user ) ) {
2259
  $user_id = $user[0]->user_id;
2260
  $user_data = get_userdata( $user_id );
2261
 
2262
- echo '<div class="woosw-quickview-item-title"><a href="' . get_edit_user_link( $user_id ) . '" target="_blank">' . $user_data->user_login . '</a></div>';
2263
  echo '<div class="woosw-quickview-item-data">' . $user_data->user_email . ' | ' . sprintf( _n( '%s product', '%s products', $count, 'woo-smart-wishlist' ), number_format_i18n( $count ) ) . '</div>';
2264
  } else {
2265
  echo '<div class="woosw-quickview-item-title">' . esc_html__( 'Guest', 'woo-smart-wishlist' ) . '</div>';
@@ -2270,43 +2269,52 @@ if ( ! function_exists( 'woosw_init' ) ) {
2270
  echo '</div><!-- /woosw-quickview-item -->';
2271
 
2272
  foreach ( $products as $pid => $data ) {
2273
- $_product = wc_get_product( $pid );
2274
-
2275
- if ( $_product ) {
2276
  echo '<div class="woosw-quickview-item">';
2277
  echo '<div class="woosw-quickview-item-image">' . $_product->get_image() . '</div>';
2278
  echo '<div class="woosw-quickview-item-info">';
2279
- echo '<div class="woosw-quickview-item-title"><a href="' . esc_url( $_product->get_permalink() ) . '" target="_blank">' . $_product->get_name() . '</a></div>';
2280
- echo '<div class="woosw-quickview-item-data">' . date_i18n( get_option( 'date_format' ), $data['time'] ) . ' <span class="woosw-quickview-item-links">| ID: ' . $pid . ' | <a href="' . get_edit_post_link( $pid ) . '" target="_blank">' . esc_html__( 'Edit', 'woo-smart-wishlist' ) . '</a> | <a href="#" class="woosw_action" data-pid="' . esc_attr( $pid ) . '">' . esc_html__( 'See in wishlist', 'woo-smart-wishlist' ) . '</a></span></div>';
 
 
 
 
 
 
 
 
2281
  echo '</div><!-- /woosw-quickview-item-info -->';
2282
  echo '</div><!-- /woosw-quickview-item -->';
2283
  }
2284
  }
2285
-
2286
- echo '</div>';
2287
  } else {
2288
- echo '<div style="text-align: center">' . esc_html__( 'Empty Wishlist', 'woo-smart-wishlist' ) . '<div>';
 
 
 
 
 
 
2289
  }
2290
-
2291
- $wishlist_html = ob_get_clean();
2292
  } elseif ( isset( $_POST['pid'] ) ) {
2293
- ob_start();
 
2294
 
2295
- $pid = (int) sanitize_text_field( $_POST['pid'] );
2296
- $keys = $wpdb->get_results( $wpdb->prepare( 'SELECT option_name FROM `' . $wpdb->prefix . 'options` WHERE `option_name` LIKE "%woosw_list_%" AND `option_value` LIKE "%i:%d;%"', $pid ) );
2297
- $count = count( $keys );
2298
-
2299
- if ( $count > 0 ) {
2300
- echo '<div class="woosw-quickview-items">';
2301
-
2302
- $_product = wc_get_product( $pid );
2303
-
2304
- if ( $_product ) {
2305
  echo '<div class="woosw-quickview-item">';
2306
  echo '<div class="woosw-quickview-item-image">' . $_product->get_image() . '</div>';
2307
  echo '<div class="woosw-quickview-item-info">';
2308
- echo '<div class="woosw-quickview-item-title"><a href="' . esc_url( $_product->get_permalink() ) . '" target="_blank">' . $_product->get_name() . '</a></div>';
2309
- echo '<div class="woosw-quickview-item-data">ID: ' . $pid . ' | ' . sprintf( _n( '%s wishlist', '%s wishlists', $count, 'woosw' ), number_format_i18n( $count ) ) . ' <span class="woosw-quickview-item-links">| <a href="' . get_edit_post_link( $pid ) . '" target="_blank">' . esc_html__( 'Edit', 'woo-smart-wishlist' ) . '</a></span></div>';
 
 
 
 
 
 
 
 
2310
  echo '</div><!-- /woosw-quickview-item-info -->';
2311
  echo '</div><!-- /woosw-quickview-item -->';
2312
  }
@@ -2315,19 +2323,18 @@ if ( ! function_exists( 'woosw_init' ) ) {
2315
  $products = get_option( $item->option_name );
2316
  $count = count( $products );
2317
  $key = str_replace( 'woosw_list_', '', $item->option_name );
2318
- $user = $wpdb->get_results( $wpdb->prepare( 'SELECT user_id FROM `' . $wpdb->prefix . 'usermeta` WHERE `meta_key` = "woosw_key" AND `meta_value` = "%s" LIMIT 1', $key ) );
2319
 
2320
  echo '<div class="woosw-quickview-item">';
2321
- echo '<div class="woosw-quickview-item-image"><a href="' . esc_url( self::get_url( $key, true ) ) . '" target="_blank">#' . esc_html( $key ) . '</a></div>';
2322
  echo '<div class="woosw-quickview-item-info">';
2323
 
2324
  if ( ! empty( $user ) ) {
2325
  $user_id = $user[0]->user_id;
2326
  $user_data = get_userdata( $user_id );
2327
 
2328
-
2329
- echo '<div class="woosw-quickview-item-title"><a href="' . get_edit_user_link( $user_id ) . '" target="_blank">' . $user_data->user_login . '</a></div>';
2330
- echo '<div class="woosw-quickview-item-data">' . $user_data->user_email . ' | <a href="#" class="woosw_action" data-key="' . esc_attr( $key ) . '">' . sprintf( _n( '%s product', '%s products', $count, 'woo-smart-wishlist' ), number_format_i18n( $count ) ) . '</a></div>';
2331
  } else {
2332
  echo '<div class="woosw-quickview-item-title">' . esc_html__( 'Guest', 'woo-smart-wishlist' ) . '</div>';
2333
  echo '<div class="woosw-quickview-item-data"><a href="#" class="woosw_action" data-key="' . esc_attr( $key ) . '">' . sprintf( _n( '%s product', '%s products', $count, 'woo-smart-wishlist' ), number_format_i18n( $count ) ) . '</a></div>';
@@ -2336,14 +2343,39 @@ if ( ! function_exists( 'woosw_init' ) ) {
2336
  echo '</div><!-- /woosw-quickview-item-info -->';
2337
  echo '</div><!-- /woosw-quickview-item -->';
2338
  }
 
 
 
 
2339
 
2340
- echo '</div>';
 
 
 
 
 
 
 
2341
  }
2342
 
2343
- $wishlist_html = ob_get_clean();
 
 
 
 
 
 
 
 
 
 
 
 
 
2344
  }
2345
 
2346
- echo apply_filters( 'woosw_wishlist_quickview', $wishlist_html );
 
2347
  die();
2348
  }
2349
 
3
  Plugin Name: WPC Smart Wishlist for WooCommerce
4
  Plugin URI: https://wpclever.net/
5
  Description: WPC Smart Wishlist is a simple but powerful tool that can help your customer save products for buy later.
6
+ Version: 4.5.0
7
  Author: WPClever
8
  Author URI: https://wpclever.net
9
  Text Domain: woo-smart-wishlist
16
 
17
  defined( 'ABSPATH' ) || exit;
18
 
19
+ ! defined( 'WOOSW_VERSION' ) && define( 'WOOSW_VERSION', '4.5.0' );
20
  ! defined( 'WOOSW_FILE' ) && define( 'WOOSW_FILE', __FILE__ );
21
  ! defined( 'WOOSW_URI' ) && define( 'WOOSW_URI', plugin_dir_url( __FILE__ ) );
22
  ! defined( 'WOOSW_DIR' ) && define( 'WOOSW_DIR', plugin_dir_path( __FILE__ ) );
1640
  'wp-color-picker',
1641
  'jquery-ui-dialog'
1642
  ), WOOSW_VERSION, true );
1643
+ wp_localize_script( 'woosw-backend', 'woosw_vars', array(
1644
+ 'nonce' => wp_create_nonce( 'woosw-nonce' ),
1645
+ )
1646
+ );
1647
  }
1648
 
1649
  function action_links( $links, $file ) {
2223
 
2224
  function users_columns_content( $val, $column_name, $user_id ) {
2225
  if ( $column_name === 'woosw' ) {
2226
+ $keys = get_user_meta( $user_id, 'woosw_keys', true );
 
 
 
2227
 
2228
+ if ( is_array( $keys ) && ! empty( $keys ) ) {
2229
+ $val = '<a href="#" class="woosw_action" data-uid="' . esc_attr( $user_id ) . '">' . count( $keys ) . '</a>';
 
2230
  }
2231
  }
2232
 
2234
  }
2235
 
2236
  function wishlist_quickview() {
2237
+ if ( ! check_ajax_referer( 'woosw-nonce', 'nonce', false ) ) {
2238
+ die( esc_html__( 'Permissions check failed!', 'woo-smart-wishlist' ) );
2239
+ }
2240
 
2241
  global $wpdb;
2242
+ ob_start();
2243
+ echo '<div class="woosw-quickview-items">';
2244
 
2245
  if ( isset( $_POST['key'] ) && $_POST['key'] != '' ) {
 
 
2246
  $key = sanitize_text_field( $_POST['key'] );
2247
  $products = self::get_ids( $key );
2248
  $count = count( $products );
2249
 
2250
  if ( count( $products ) > 0 ) {
2251
+ $user = $wpdb->get_results( $wpdb->prepare( 'SELECT user_id FROM `' . $wpdb->prefix . 'usermeta` WHERE `meta_key` = "woosw_keys" AND `meta_value` LIKE "%s" LIMIT 1', '%"' . $key . '"%' ) );
 
 
2252
 
2253
  echo '<div class="woosw-quickview-item">';
2254
+ echo '<div class="woosw-quickview-item-image"><a href="' . esc_url( self::get_url( $key, true ) ) . '" target="_blank">' . $key . '</a></div>';
2255
  echo '<div class="woosw-quickview-item-info">';
2256
 
2257
  if ( ! empty( $user ) ) {
2258
  $user_id = $user[0]->user_id;
2259
  $user_data = get_userdata( $user_id );
2260
 
2261
+ echo '<div class="woosw-quickview-item-title"><a href="#" class="woosw_action" data-uid="' . esc_attr( $user_id ) . '">' . $user_data->user_login . '</a></div>';
2262
  echo '<div class="woosw-quickview-item-data">' . $user_data->user_email . ' | ' . sprintf( _n( '%s product', '%s products', $count, 'woo-smart-wishlist' ), number_format_i18n( $count ) ) . '</div>';
2263
  } else {
2264
  echo '<div class="woosw-quickview-item-title">' . esc_html__( 'Guest', 'woo-smart-wishlist' ) . '</div>';
2269
  echo '</div><!-- /woosw-quickview-item -->';
2270
 
2271
  foreach ( $products as $pid => $data ) {
2272
+ if ( $_product = wc_get_product( $pid ) ) {
 
 
2273
  echo '<div class="woosw-quickview-item">';
2274
  echo '<div class="woosw-quickview-item-image">' . $_product->get_image() . '</div>';
2275
  echo '<div class="woosw-quickview-item-info">';
2276
+ echo '<div class="woosw-quickview-item-title"><a href="' . get_edit_post_link( $pid ) . '" target="_blank">' . $_product->get_name() . '</a></div>';
2277
+ echo '<div class="woosw-quickview-item-data">' . date_i18n( get_option( 'date_format' ), $data['time'] ) . ' <span class="woosw-quickview-item-links">| ' . sprintf( esc_html__( 'Product ID: %s', 'woo-smart-wishlist' ), $pid ) . ' | <a href="#" class="woosw_action" data-pid="' . esc_attr( $pid ) . '">' . esc_html__( 'See in wishlist', 'woo-smart-wishlist' ) . '</a></span></div>';
2278
+ echo '</div><!-- /woosw-quickview-item-info -->';
2279
+ echo '</div><!-- /woosw-quickview-item -->';
2280
+ } else {
2281
+ echo '<div class="woosw-quickview-item">';
2282
+ echo '<div class="woosw-quickview-item-image">' . wc_placeholder_img() . '</div>';
2283
+ echo '<div class="woosw-quickview-item-info">';
2284
+ echo '<div class="woosw-quickview-item-title">' . sprintf( esc_html__( 'Product ID: %s', 'woo-smart-wishlist' ), $pid ) . '</div>';
2285
+ echo '<div class="woosw-quickview-item-data">' . esc_html__( 'This product is not available!', 'woo-smart-wishlist' ) . '</div>';
2286
  echo '</div><!-- /woosw-quickview-item-info -->';
2287
  echo '</div><!-- /woosw-quickview-item -->';
2288
  }
2289
  }
 
 
2290
  } else {
2291
+ echo '<div class="woosw-quickview-item">';
2292
+ echo '<div class="woosw-quickview-item-image">' . wc_placeholder_img() . '</div>';
2293
+ echo '<div class="woosw-quickview-item-info">';
2294
+ echo '<div class="woosw-quickview-item-title">' . sprintf( esc_html__( 'Wishlist #%s', 'woo-smart-wishlist' ), $key ) . '</div>';
2295
+ echo '<div class="woosw-quickview-item-data">' . esc_html__( 'This wishlist have no product!', 'woo-smart-wishlist' ) . '</div>';
2296
+ echo '</div><!-- /woosw-quickview-item-info -->';
2297
+ echo '</div><!-- /woosw-quickview-item -->';
2298
  }
 
 
2299
  } elseif ( isset( $_POST['pid'] ) ) {
2300
+ $pid = (int) sanitize_text_field( $_POST['pid'] );
2301
+ $keys = $wpdb->get_results( $wpdb->prepare( 'SELECT option_name FROM `' . $wpdb->prefix . 'options` WHERE `option_name` LIKE "%woosw_list_%" AND `option_value` LIKE "%i:%d;%"', $pid ) );
2302
 
2303
+ if ( $count = count( $keys ) ) {
2304
+ if ( $_product = wc_get_product( $pid ) ) {
 
 
 
 
 
 
 
 
2305
  echo '<div class="woosw-quickview-item">';
2306
  echo '<div class="woosw-quickview-item-image">' . $_product->get_image() . '</div>';
2307
  echo '<div class="woosw-quickview-item-info">';
2308
+ echo '<div class="woosw-quickview-item-title"><a href="' . get_edit_post_link( $pid ) . '" target="_blank">' . $_product->get_name() . '</a></div>';
2309
+ echo '<div class="woosw-quickview-item-data">' . sprintf( esc_html__( 'Product ID: %s', 'woo-smart-wishlist' ), $pid ) . ' | ' . sprintf( _n( '%s wishlist', '%s wishlists', $count, 'woosw' ), number_format_i18n( $count ) ) . '</div>';
2310
+ echo '</div><!-- /woosw-quickview-item-info -->';
2311
+ echo '</div><!-- /woosw-quickview-item -->';
2312
+ } else {
2313
+ echo '<div class="woosw-quickview-item">';
2314
+ echo '<div class="woosw-quickview-item-image">' . wc_placeholder_img() . '</div>';
2315
+ echo '<div class="woosw-quickview-item-info">';
2316
+ echo '<div class="woosw-quickview-item-title">' . sprintf( esc_html__( 'Product ID: %s', 'woo-smart-wishlist' ), $pid ) . '</div>';
2317
+ echo '<div class="woosw-quickview-item-data">' . esc_html__( 'This product is not available!', 'woo-smart-wishlist' ) . '</div>';
2318
  echo '</div><!-- /woosw-quickview-item-info -->';
2319
  echo '</div><!-- /woosw-quickview-item -->';
2320
  }
2323
  $products = get_option( $item->option_name );
2324
  $count = count( $products );
2325
  $key = str_replace( 'woosw_list_', '', $item->option_name );
2326
+ $user = $wpdb->get_results( $wpdb->prepare( 'SELECT user_id FROM `' . $wpdb->prefix . 'usermeta` WHERE `meta_key` = "woosw_keys" AND `meta_value` LIKE "%s" LIMIT 1', '%"' . $key . '"%' ) );
2327
 
2328
  echo '<div class="woosw-quickview-item">';
2329
+ echo '<div class="woosw-quickview-item-image"><a href="' . esc_url( self::get_url( $key, true ) ) . '" target="_blank">' . esc_html( $key ) . '</a></div>';
2330
  echo '<div class="woosw-quickview-item-info">';
2331
 
2332
  if ( ! empty( $user ) ) {
2333
  $user_id = $user[0]->user_id;
2334
  $user_data = get_userdata( $user_id );
2335
 
2336
+ echo '<div class="woosw-quickview-item-title"><a href="#" class="woosw_action" data-uid="' . esc_attr( $user_id ) . '">' . $user_data->user_login . '</a></div>';
2337
+ echo '<div class="woosw-quickview-item-data">' . $user_data->user_email . ' | <a href="#" class="woosw_action woosw_action_' . $count . '" data-key="' . esc_attr( $key ) . '">' . sprintf( _n( '%s product', '%s products', $count, 'woo-smart-wishlist' ), number_format_i18n( $count ) ) . '</a></div>';
 
2338
  } else {
2339
  echo '<div class="woosw-quickview-item-title">' . esc_html__( 'Guest', 'woo-smart-wishlist' ) . '</div>';
2340
  echo '<div class="woosw-quickview-item-data"><a href="#" class="woosw_action" data-key="' . esc_attr( $key ) . '">' . sprintf( _n( '%s product', '%s products', $count, 'woo-smart-wishlist' ), number_format_i18n( $count ) ) . '</a></div>';
2343
  echo '</div><!-- /woosw-quickview-item-info -->';
2344
  echo '</div><!-- /woosw-quickview-item -->';
2345
  }
2346
+ }
2347
+ } elseif ( isset( $_POST['uid'] ) ) {
2348
+ $user_id = (int) sanitize_text_field( $_POST['uid'] );
2349
+ $keys = get_user_meta( $user_id, 'woosw_keys', true ) ?: array();
2350
 
2351
+ if ( $user = get_user_by( 'id', $user_id ) ) {
2352
+ echo '<div class="woosw-quickview-item">';
2353
+ echo '<div class="woosw-quickview-item-image"><img src="' . esc_url( get_avatar_url( $user_id ) ) . '" /></div>';
2354
+ echo '<div class="woosw-quickview-item-info">';
2355
+ echo '<div class="woosw-quickview-item-title"><a href="' . get_edit_user_link( $user_id ) . '" target="_blank">' . $user->user_login . '</a></div>';
2356
+ echo '<div class="woosw-quickview-item-data">' . $user->user_email . '</div>';
2357
+ echo '</div><!-- /woosw-quickview-item-info -->';
2358
+ echo '</div><!-- /woosw-quickview-item -->';
2359
  }
2360
 
2361
+ if ( is_array( $keys ) && count( $keys ) ) {
2362
+ foreach ( $keys as $key => $data ) {
2363
+ $products = self::get_ids( $key );
2364
+ $count = count( $products );
2365
+
2366
+ echo '<div class="woosw-quickview-item">';
2367
+ echo '<div class="woosw-quickview-item-image"><a href="' . esc_url( self::get_url( $key, true ) ) . '" target="_blank">' . $key . '</a></div>';
2368
+ echo '<div class="woosw-quickview-item-info">';
2369
+ echo '<div class="woosw-quickview-item-title">' . ( ! empty( $data['name'] ) ? $data['name'] : 'Primary' ) . '</div>';
2370
+ echo '<div class="woosw-quickview-item-data"><a href="#" class="woosw_action woosw_action_' . $count . '" data-key="' . esc_attr( $key ) . '">' . sprintf( _n( '%s product', '%s products', $count, 'woo-smart-wishlist' ), number_format_i18n( $count ) ) . '</a></div>';
2371
+ echo '</div><!-- /woosw-quickview-item-info -->';
2372
+ echo '</div><!-- /woosw-quickview-item -->';
2373
+ }
2374
+ }
2375
  }
2376
 
2377
+ echo '</div><!-- /woosw-quickview-items -->';
2378
+ echo apply_filters( 'woosw_wishlist_quickview', ob_get_clean() );
2379
  die();
2380
  }
2381