YITH WooCommerce Wishlist - Version 2.0.3

Version Description

  • Tweak: set correct protocol for admin-ajax requests
  • Tweak: used wc core function to set cookie
  • Tweak: let customization of add_to_wishlist shortcodes
  • Fixed: show add to cart column when stock status disabled
  • Fixed: product existing in wishlist
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Wishlist
Version 2.0.3
Comparing to
See all releases

Code changes from version 2.0.2 to 2.0.3

README.txt CHANGED
@@ -3,8 +3,8 @@
3
Contributors: yithemes
4
Tags: wishlist, woocommerce, products, themes, yit, e-commerce, shop, ecommerce wishlist, yith, woocommerce wishlist, woocommerce 2.3 ready, shop wishlist
5
Requires at least: 3.5.1
6
- Tested up to: 4.1
7
- Stable tag: 2.0.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -86,6 +86,14 @@ This might depend on the fact that your theme overrides plugin templates. Check
86
87
== Changelog ==
88
89
= 2.0.2 =
90
91
* Updated: font-awesome library
@@ -211,7 +219,10 @@ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woo
211
212
== Upgrade notice ==
213
214
- = 2.0.2 =
215
216
- * Updated: font-awesome library
217
- * Fixed: option with old font-awesome classes
3
Contributors: yithemes
4
Tags: wishlist, woocommerce, products, themes, yit, e-commerce, shop, ecommerce wishlist, yith, woocommerce wishlist, woocommerce 2.3 ready, shop wishlist
5
Requires at least: 3.5.1
6
+ Tested up to: 4.1.1
7
+ Stable tag: 2.0.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
86
87
== Changelog ==
88
89
+ = 2.0.3 =
90
+
91
+ * Tweak: set correct protocol for admin-ajax requests
92
+ * Tweak: used wc core function to set cookie
93
+ * Tweak: let customization of add_to_wishlist shortcodes
94
+ * Fixed: show add to cart column when stock status disabled
95
+ * Fixed: product existing in wishlist
96
+
97
= 2.0.2 =
98
99
* Updated: font-awesome library
219
220
== Upgrade notice ==
221
222
+ = 2.0.3 =
223
224
+ * Tweak: set correct protocol for admin-ajax requests
225
+ * Tweak: used wc core function to set cookie
226
+ * Tweak: let customization of add_to_wishlist shortcodes
227
+ * Fixed: show add to cart column when stock status disabled
228
+ * Fixed: product existing in wishlist
includes/class.yith-wcwl-admin-init.php CHANGED
@@ -33,7 +33,7 @@ if ( ! class_exists( 'YITH_WCWL_Admin_Init' ) ) {
33
* @var string
34
* @since 1.0.0
35
*/
36
- public $version = '2.0.2';
37
38
/**
39
* Plugin database version
33
* @var string
34
* @since 1.0.0
35
*/
36
+ public $version = '2.0.3';
37
38
/**
39
* Plugin database version
includes/class.yith-wcwl-init.php CHANGED
@@ -336,7 +336,7 @@ if ( ! class_exists( 'YITH_WCWL_Init' ) ) {
336
wp_enqueue_script( 'jquery-yith-wcwl' );
337
338
$yith_wcwl_l10n = array(
339
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
340
'redirect_to_cart' => get_option( 'yith_wcwl_redirect_cart' ),
341
'multi_wishlist' => get_option( 'yith_wcwl_multi_wishlist_enable' ) == 'yes' ? true : false,
342
'hide_add_button' => apply_filters( 'yith_wcwl_hide_add_button', true ),
336
wp_enqueue_script( 'jquery-yith-wcwl' );
337
338
$yith_wcwl_l10n = array(
339
+ 'ajax_url' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ),
340
'redirect_to_cart' => get_option( 'yith_wcwl_redirect_cart' ),
341
'multi_wishlist' => get_option( 'yith_wcwl_multi_wishlist_enable' ) == 'yes' ? true : false,
342
'hide_add_button' => apply_filters( 'yith_wcwl_hide_add_button', true ),
includes/class.yith-wcwl-shortcode.php CHANGED
@@ -283,8 +283,6 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
283
public static function add_to_wishlist( $atts, $content = null ) {
284
global $product;
285
286
- $atts = shortcode_atts( array(), $atts );
287
-
288
$template_part = 'button';
289
290
$label_option = get_option( 'yith_wcwl_add_to_wishlist_text' );
@@ -298,7 +296,16 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
298
$classes = apply_filters( 'yith_wcwl_add_to_wishlist_button_classes', get_option( 'yith_wcwl_use_button' ) == 'yes' ? 'add_to_wishlist single_add_to_wishlist button alt' : 'add_to_wishlist' );
299
300
$wishlist_url = YITH_WCWL()->get_wishlist_url();
301
- $exists = YITH_WCWL()->is_product_in_wishlist( $product->id );
302
$product_type = $product->product_type;
303
304
$additional_params = array(
@@ -315,9 +322,9 @@ if( ! class_exists( 'YITH_WCWL_Shortcode' ) ) {
315
$additional_params = apply_filters( 'yith_wcwl_add_to_wishlist_params', $additional_params );
316
$additional_params['template_part'] = isset( $additional_params['template_part'] ) ? $additional_params['template_part'] : $template_part;
317
318
- $atts = array_merge(
319
- $atts,
320
- $additional_params
321
);
322
323
// adds attributes list to params to extract in template, so it can be passed through a new get_template()
283
public static function add_to_wishlist( $atts, $content = null ) {
284
global $product;
285
286
$template_part = 'button';
287
288
$label_option = get_option( 'yith_wcwl_add_to_wishlist_text' );
296
$classes = apply_filters( 'yith_wcwl_add_to_wishlist_button_classes', get_option( 'yith_wcwl_use_button' ) == 'yes' ? 'add_to_wishlist single_add_to_wishlist button alt' : 'add_to_wishlist' );
297
298
$wishlist_url = YITH_WCWL()->get_wishlist_url();
299
+ $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists( array( 'is_default' => true ) ) : false;
300
+
301
+ if( ! empty( $default_wishlists ) ){
302
+ $default_wishlist = $default_wishlists[0]['ID'];
303
+ }
304
+ else{
305
+ $default_wishlist = false;
306
+ }
307
+
308
+ $exists = YITH_WCWL()->is_product_in_wishlist( $product->id, $default_wishlist );
309
$product_type = $product->product_type;
310
311
$additional_params = array(
322
$additional_params = apply_filters( 'yith_wcwl_add_to_wishlist_params', $additional_params );
323
$additional_params['template_part'] = isset( $additional_params['template_part'] ) ? $additional_params['template_part'] : $template_part;
324
325
+ $atts = shortcode_atts(
326
+ $additional_params,
327
+ $atts
328
);
329
330
// adds attributes list to params to extract in template, so it can be passed through a new get_template()
includes/functions.yith-wcwl.php CHANGED
@@ -146,7 +146,7 @@ if( !function_exists( 'yith_setcookie' ) ) {
146
$expiration = apply_filters( 'yith_wcwl_cookie_expiration_time', $time ); // Default 30 days
147
148
$_COOKIE[ $name ] = $value;
149
- return setcookie( $name, $value, $expiration, '/' );
150
}
151
}
152
146
$expiration = apply_filters( 'yith_wcwl_cookie_expiration_time', $time ); // Default 30 days
147
148
$_COOKIE[ $name ] = $value;
149
+ wc_setcookie( $name, $value, $expiration, false );
150
}
151
}
152
init.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: YITH WooCommerce Wishlist
4
* Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-wishlist/
5
* Description: YITH WooCommerce Wishlist allows you to add Wishlist functionality to your e-commerce.
6
- * Version: 2.0.2
7
* Author: Yithemes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yit
3
* Plugin Name: YITH WooCommerce Wishlist
4
* Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-wishlist/
5
* Description: YITH WooCommerce Wishlist allows you to add Wishlist functionality to your e-commerce.
6
+ * Version: 2.0.3
7
* Author: Yithemes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yit
plugin-fw/assets/css/yit-plugin-panel.css CHANGED
@@ -143,6 +143,21 @@
143
.chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
144
width: 100%!important;
145
}
146
.select_wrapper span {
147
height: 26px;
148
line-height: 26px;
143
.chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
144
width: 100%!important;
145
}
146
+
147
+ /* === Chosen Customizzation === */
148
+
149
+ .yith-choosen .chosen-choices {
150
+ line-height: 27px;
151
+ min-height: 27px;
152
+ border: 1px solid #ddd;
153
+ }
154
+
155
+ .yith-choosen .chosen-container-active .chosen-choices{
156
+ border: 1px solid #5b9dd9;
157
+ -webkit-box-shadow: 0 0 2px rgba(30,140,190,.8);
158
+ box-shadow: 0 0 2px rgba(30,140,190,.8);
159
+ }
160
+
161
.select_wrapper span {
162
height: 26px;
163
line-height: 26px;
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -63,6 +63,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
63
add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
64
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
65
add_action( 'admin_init', array( $this, 'woocommerce_update_options' ) );
66
67
add_action( 'woocommerce_admin_field_boxinfo', array( $this, 'yit_boxinfo' ), 10, 1 );
68
add_action( 'woocommerce_admin_field_videobox', array( $this, 'yit_videobox' ), 10, 1 );
@@ -157,6 +158,27 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
157
}
158
}
159
160
/**
161
* Returns current active tab slug
162
*
63
add_action( 'admin_bar_menu', array( $this, 'add_admin_bar_menu' ), 100 );
64
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
65
add_action( 'admin_init', array( $this, 'woocommerce_update_options' ) );
66
+ add_filter( 'woocommerce_screen_ids', array( $this, 'add_allowed_screen_id' ) );
67
68
add_action( 'woocommerce_admin_field_boxinfo', array( $this, 'yit_boxinfo' ), 10, 1 );
69
add_action( 'woocommerce_admin_field_videobox', array( $this, 'yit_videobox' ), 10, 1 );
158
}
159
}
160
161
+ /**
162
+ * Add the plugin woocommerce page settings in the screen ids of woocommerce
163
+ *
164
+ * @param $screen_ids
165
+ *
166
+ * @return mixed
167
+ * @since 1.0.0
168
+ * @author Antonino Scarfì <antonino.scarfi@yithemes.com>
169
+ */
170
+ public function add_allowed_screen_id( $screen_ids ) {
171
+ global $admin_page_hooks;
172
+
173
+ if ( ! isset( $admin_page_hooks[ $this->settings['parent_page'] ] ) ) {
174
+ return $screen_ids;
175
+ }
176
+
177
+ $screen_ids[] = $admin_page_hooks[ $this->settings['parent_page'] ] . '_page_' . $this->settings['page'];
178
+
179
+ return $screen_ids;
180
+ }
181
+
182
/**
183
* Returns current active tab slug
184
*
plugin-fw/yit-functions.php CHANGED
@@ -337,6 +337,10 @@ if ( ! function_exists( 'yit_enqueue_style' ) ) {
337
$who = YIT_Asset()->get_stylesheet_handle( get_stylesheet_uri(), 'style' );
338
$where = 'before';
339
340
YIT_Asset()->set( 'style', $handle, compact( 'src', 'deps', 'ver', 'media', 'enqueue' ), $where, $who );
341
}
342
else {
337
$who = YIT_Asset()->get_stylesheet_handle( get_stylesheet_uri(), 'style' );
338
$where = 'before';
339
340
+ if( false == $who ){
341
+ $who = '';
342
+ }
343
+
344
YIT_Asset()->set( 'style', $handle, compact( 'src', 'deps', 'ver', 'media', 'enqueue' ), $where, $who );
345
}
346
else {
templates/wishlist-view.php CHANGED
@@ -90,7 +90,10 @@
90
$product = get_product( $item['prod_id'] );
91
}
92
93
- if( $product !== false && $product->exists() ) : ?>
94
<tr id="yith-wcwl-row-<?php echo $item['prod_id'] ?>" data-row-id="<?php echo $item['prod_id'] ?>">
95
<?php if( $is_user_owner ): ?>
96
<td class="product-remove">
@@ -133,9 +136,6 @@
133
<?php if( $show_stock_status ) : ?>
134
<td class="product-stock-status">
135
<?php
136
- $availability = $product->get_availability();
137
- $stock_status = $availability['class'];
138
-
139
if( $stock_status == 'out-of-stock' ) {
140
$stock_status = "Out";
141
echo '<span class="wishlist-out-of-stock">' . __( 'Out of Stock', 'yit' ) . '</span>';
90
$product = get_product( $item['prod_id'] );
91
}
92
93
+ if( $product !== false && $product->exists() ) :
94
+ $availability = $product->get_availability();
95
+ $stock_status = $availability['class'];
96
+ ?>
97
<tr id="yith-wcwl-row-<?php echo $item['prod_id'] ?>" data-row-id="<?php echo $item['prod_id'] ?>">
98
<?php if( $is_user_owner ): ?>
99
<td class="product-remove">
136
<?php if( $show_stock_status ) : ?>
137
<td class="product-stock-status">
138
<?php
139
if( $stock_status == 'out-of-stock' ) {
140
$stock_status = "Out";
141
echo '<span class="wishlist-out-of-stock">' . __( 'Out of Stock', 'yit' ) . '</span>';