WooCommerce Wishlist Plugin - Version 1.5.4

Version Description

Release Date - 07 September 2017

  • Added notice for variable products (if no variation applied by default) when adding to cart from Wishlist page.
  • Fixed an issue when products could not be added to cart from shared Wishlist
  • Fixed an issue with redirect to cart page after successful product addition
  • Fixed an issue with "Plain" permalinks structure
Download this release

Release Info

Developer templateinvaders
Plugin Icon 128x128 WooCommerce Wishlist Plugin
Version 1.5.4
Comparing to
See all releases

Code changes from version 1.5.3 to 1.5.4

admin/settings/general.class.php CHANGED
@@ -396,14 +396,14 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
396
  'fields' => array(
397
  array(
398
  'type' => 'checkboxonoff',
399
- 'name' => 'add_to_card',
400
  'text' => __( 'Show "Add to Cart" button', 'ti-woocommerce-wishlist' ),
401
  'std' => true,
402
  'extra' => array( 'tiwl-show' => '.tiwl-table-action-addcart' ),
403
  ),
404
  array(
405
  'type' => 'text',
406
- 'name' => 'text_add_to_card',
407
  'text' => __( '"Add to Cart" Text', 'ti-woocommerce-wishlist' ),
408
  'std' => 'Add to Cart',
409
  'class' => 'tiwl-table-action-addcart',
@@ -455,14 +455,14 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
455
  ),
456
  array(
457
  'type' => 'checkboxonoff',
458
- 'name' => 'add_select_to_card',
459
  'text' => __( 'Show "Add Selected to Cart" button', 'ti-woocommerce-wishlist' ),
460
  'std' => true,
461
  'extra' => array( 'tiwl-show' => '.tiwl-table-addcart-sel' ),
462
  ),
463
  array(
464
  'type' => 'text',
465
- 'name' => 'text_add_select_to_card',
466
  'text' => __( '"Add Selected to Cart" Button Text', 'ti-woocommerce-wishlist' ),
467
  'std' => 'Add Selected to Cart',
468
  'class' => 'tiwl-table-addcart-sel',
@@ -473,14 +473,14 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
473
  ),
474
  array(
475
  'type' => 'checkboxonoff',
476
- 'name' => 'add_all_to_card',
477
  'text' => __( 'Show "Add All to Cart" button', 'ti-woocommerce-wishlist' ),
478
  'std' => true,
479
  'extra' => array( 'tiwl-show' => '.tiwl-table-addcart-all' ),
480
  ),
481
  array(
482
  'type' => 'text',
483
- 'name' => 'text_add_all_to_card',
484
  'text' => __( '"Add All to Cart" Button Text', 'ti-woocommerce-wishlist' ),
485
  'std' => 'Add All to Cart',
486
  'class' => 'tiwl-table-addcart-all',
396
  'fields' => array(
397
  array(
398
  'type' => 'checkboxonoff',
399
+ 'name' => 'add_to_cart',
400
  'text' => __( 'Show "Add to Cart" button', 'ti-woocommerce-wishlist' ),
401
  'std' => true,
402
  'extra' => array( 'tiwl-show' => '.tiwl-table-action-addcart' ),
403
  ),
404
  array(
405
  'type' => 'text',
406
+ 'name' => 'text_add_to_cart',
407
  'text' => __( '"Add to Cart" Text', 'ti-woocommerce-wishlist' ),
408
  'std' => 'Add to Cart',
409
  'class' => 'tiwl-table-action-addcart',
455
  ),
456
  array(
457
  'type' => 'checkboxonoff',
458
+ 'name' => 'add_select_to_cart',
459
  'text' => __( 'Show "Add Selected to Cart" button', 'ti-woocommerce-wishlist' ),
460
  'std' => true,
461
  'extra' => array( 'tiwl-show' => '.tiwl-table-addcart-sel' ),
462
  ),
463
  array(
464
  'type' => 'text',
465
+ 'name' => 'text_add_select_to_cart',
466
  'text' => __( '"Add Selected to Cart" Button Text', 'ti-woocommerce-wishlist' ),
467
  'std' => 'Add Selected to Cart',
468
  'class' => 'tiwl-table-addcart-sel',
473
  ),
474
  array(
475
  'type' => 'checkboxonoff',
476
+ 'name' => 'add_all_to_cart',
477
  'text' => __( 'Show "Add All to Cart" button', 'ti-woocommerce-wishlist' ),
478
  'std' => true,
479
  'extra' => array( 'tiwl-show' => '.tiwl-table-addcart-all' ),
480
  ),
481
  array(
482
  'type' => 'text',
483
+ 'name' => 'text_add_all_to_cart',
484
  'text' => __( '"Add All to Cart" Button Text', 'ti-woocommerce-wishlist' ),
485
  'std' => 'Add All to Cart',
486
  'class' => 'tiwl-table-addcart-all',
includes/product.helper.php CHANGED
@@ -168,7 +168,7 @@ class TInvWL_Product {
168
  $data['variation_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
169
  $data['in_stock'] = $product_data->is_in_stock();
170
  $data['price'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->price : $product_data->get_price() );
171
- $data['formdata'] = $this->prepare_save_meta( $meta );
172
 
173
  global $wpdb;
174
  if ( $wpdb->insert( $this->table, $data ) ) { // @codingStandardsIgnoreLine WordPress.VIP.DirectDatabaseQuery.DirectQuery
@@ -222,11 +222,14 @@ class TInvWL_Product {
222
  return false;
223
  }
224
 
 
 
 
225
  $products = $this->get( array(
226
- 'product_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) ),
227
- 'variation_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) ),
228
  'wishlist_id' => $wishlist_id,
229
- 'formdata' => $this->prepare_save_meta( $meta ),
230
  'count' => 1,
231
  'external' => false,
232
  ) );
@@ -242,6 +245,8 @@ class TInvWL_Product {
242
  * @return array
243
  */
244
  function get( $data = array() ) {
 
 
245
  $default = array(
246
  'count' => 10,
247
  'field' => null,
@@ -274,7 +279,7 @@ class TInvWL_Product {
274
  $where = '1';
275
  if ( ! empty( $data ) && is_array( $data ) ) {
276
  if ( array_key_exists( 'meta', $data ) ) {
277
- $data['formdata'] = $this->prepare_save_meta( $data['meta'] );
278
  unset( $data['meta'] );
279
  }
280
  foreach ( $data as $f => $v ) {
@@ -308,7 +313,6 @@ class TInvWL_Product {
308
 
309
  $sql = str_replace( $replace, $replacer, $default['sql'] );
310
  }
311
- global $wpdb;
312
  $products = $wpdb->get_results( $sql, ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
313
 
314
  if ( empty( $products ) ) {
@@ -329,7 +333,7 @@ class TInvWL_Product {
329
  'price' => FILTER_SANITIZE_NUMBER_FLOAT,
330
  'in_stock' => FILTER_VALIDATE_BOOLEAN,
331
  ) );
332
- if ( ! tinv_get_option( 'product_table', 'colm_quantity' ) ) {
333
  $product['quantity'] = 1;
334
  }
335
  }
@@ -431,7 +435,7 @@ class TInvWL_Product {
431
  'product_id' => $data['product_id'],
432
  'variation_id' => $data['variation_id'],
433
  'wishlist_id' => $data['wishlist_id'],
434
- 'formdata' => $this->prepare_save_meta( $meta ),
435
  ) ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
436
  }
437
 
@@ -464,8 +468,8 @@ class TInvWL_Product {
464
  'wishlist_id' => $wishlist_id,
465
  'product_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) ),
466
  'variation_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) ),
467
- 'formdata' => $this->prepare_save_meta( $meta ),
468
  );
 
469
  $result = false !== $wpdb->delete( $this->table, $data ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
470
  if ( $result ) {
471
  do_action( 'tinvwl_wishlist_product_removed_from_wishlist', $wishlist_id, ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) ), ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) ) );
@@ -516,14 +520,30 @@ class TInvWL_Product {
516
  /**
517
  * Prepare to save meta in database
518
  *
519
- * @param array $meta Meta array.
 
 
520
  * @return string
521
  */
522
- function prepare_save_meta( $meta = array() ) {
523
  if ( ! is_array( $meta ) ) {
524
  $meta = array();
525
  }
526
- $meta = apply_filters( 'tinvwl_product_prepare_meta', $meta );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
  foreach ( array( 'add-to-cart', 'product_id', 'variation_id', 'quantity', 'undefined' ) as $field ) {
528
  if ( array_key_exists( $field, $meta ) ) {
529
  unset( $meta[ $field ] );
168
  $data['variation_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
169
  $data['in_stock'] = $product_data->is_in_stock();
170
  $data['price'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->price : $product_data->get_price() );
171
+ $data['formdata'] = $this->prepare_save_meta( $meta, $data['product_id'], $data['variation_id'] );
172
 
173
  global $wpdb;
174
  if ( $wpdb->insert( $this->table, $data ) ) { // @codingStandardsIgnoreLine WordPress.VIP.DirectDatabaseQuery.DirectQuery
222
  return false;
223
  }
224
 
225
+ $product_id = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) );
226
+ $variation_id = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
227
+
228
  $products = $this->get( array(
229
+ 'product_id' => $product_id,
230
+ 'variation_id' => $variation_id,
231
  'wishlist_id' => $wishlist_id,
232
+ 'formdata' => $this->prepare_save_meta( $meta, $product_id, $variation_id ),
233
  'count' => 1,
234
  'external' => false,
235
  ) );
245
  * @return array
246
  */
247
  function get( $data = array() ) {
248
+ global $wpdb;
249
+
250
  $default = array(
251
  'count' => 10,
252
  'field' => null,
279
  $where = '1';
280
  if ( ! empty( $data ) && is_array( $data ) ) {
281
  if ( array_key_exists( 'meta', $data ) ) {
282
+ $data['formdata'] = trim( $wpdb->prepare( '%s', $this->prepare_save_meta( $data['meta'] ) ), "'" );
283
  unset( $data['meta'] );
284
  }
285
  foreach ( $data as $f => $v ) {
313
 
314
  $sql = str_replace( $replace, $replacer, $default['sql'] );
315
  }
 
316
  $products = $wpdb->get_results( $sql, ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
317
 
318
  if ( empty( $products ) ) {
333
  'price' => FILTER_SANITIZE_NUMBER_FLOAT,
334
  'in_stock' => FILTER_VALIDATE_BOOLEAN,
335
  ) );
336
+ if ( ! tinv_get_option( 'general', 'quantity_func' ) ) {
337
  $product['quantity'] = 1;
338
  }
339
  }
435
  'product_id' => $data['product_id'],
436
  'variation_id' => $data['variation_id'],
437
  'wishlist_id' => $data['wishlist_id'],
438
+ 'formdata' => $this->prepare_save_meta( $meta, $data['product_id'], $data['variation_id'] ),
439
  ) ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
440
  }
441
 
468
  'wishlist_id' => $wishlist_id,
469
  'product_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) ),
470
  'variation_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) ),
 
471
  );
472
+ $data['formdata'] = $this->prepare_save_meta( $meta, $data['product_id'], $data['variation_id'] );
473
  $result = false !== $wpdb->delete( $this->table, $data ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
474
  if ( $result ) {
475
  do_action( 'tinvwl_wishlist_product_removed_from_wishlist', $wishlist_id, ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) ), ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) ) );
520
  /**
521
  * Prepare to save meta in database
522
  *
523
+ * @param array $meta Meta array.
524
+ * @param ineger $product_id Woocommerce product ID.
525
+ * @param ineger $variation_id Woocommerce product variation ID.
526
  * @return string
527
  */
528
+ function prepare_save_meta( $meta = array(), $product_id = 0, $variation_id = 0 ) {
529
  if ( ! is_array( $meta ) ) {
530
  $meta = array();
531
  }
532
+ $meta = apply_filters( 'tinvwl_product_prepare_meta', $meta, $product_id, $variation_id );
533
+ if ( ! empty( $variation_id ) ) {
534
+ if ( 'product_variation' == get_post_type( $product_id ) ) { // WPCS: loose comparison ok.
535
+ $product_id = wp_get_post_parent_id( $product_id );
536
+ }
537
+
538
+ $product_data = wc_get_product( $product_id );
539
+ $attributes = array_keys( (array) $product_data->get_variation_attributes() );
540
+ foreach ( $attributes as $attribute ) {
541
+ $attribute = 'attribute_' . sanitize_title( $attribute );
542
+ if ( array_key_exists( $attribute, $meta ) ) {
543
+ unset( $meta[ $attribute ] );
544
+ }
545
+ }
546
+ }
547
  foreach ( array( 'add-to-cart', 'product_id', 'variation_id', 'quantity', 'undefined' ) as $field ) {
548
  if ( array_key_exists( $field, $meta ) ) {
549
  unset( $meta[ $field ] );
includes/update.helper.php CHANGED
@@ -116,4 +116,16 @@ class TInvWL_Update {
116
  function up_1_1_10_1( $previous_version = 0 ) {
117
  update_option( 'tinvwl_wizard', true );
118
  }
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
116
  function up_1_1_10_1( $previous_version = 0 ) {
117
  update_option( 'tinvwl_wizard', true );
118
  }
119
+
120
+ /**
121
+ * Fix name field
122
+ */
123
+ function up_p_1_5_4() {
124
+ tinv_update_option( 'product_table', 'add_to_cart', tinv_get_option( 'product_table', 'add_to_card' ) );
125
+ tinv_update_option( 'product_table', 'text_add_to_cart', tinv_get_option( 'product_table', 'text_add_to_card' ) );
126
+ tinv_update_option( 'table', 'add_select_to_cart', tinv_get_option( 'table', 'add_select_to_card' ) );
127
+ tinv_update_option( 'table', 'text_add_select_to_cart', tinv_get_option( 'table', 'text_add_select_to_card' ) );
128
+ tinv_update_option( 'table', 'add_all_to_cart', tinv_get_option( 'table', 'add_all_to_card' ) );
129
+ tinv_update_option( 'table', 'text_add_all_to_cart', tinv_get_option( 'table', 'text_add_all_to_card' ) );
130
+ }
131
  }
public/cart.class.php CHANGED
@@ -138,6 +138,9 @@ class TInvWL_Public_Cart {
138
  }
139
  self::set_item_data( $cart_item_key, $wishlist['share_key'], $quantity );
140
  self::unprepare_post();
 
 
 
141
  return array( $product_id => $quantity );
142
  }
143
  }
138
  }
139
  self::set_item_data( $cart_item_key, $wishlist['share_key'], $quantity );
140
  self::unprepare_post();
141
+ if ( get_option( 'woocommerce_cart_redirect_after_add' ) === 'yes' ) {
142
+ wp_safe_redirect( wc_get_cart_url() );
143
+ }
144
  return array( $product_id => $quantity );
145
  }
146
  }
public/tinvwl.class.php CHANGED
@@ -239,8 +239,13 @@ class TInvWL_Public_TInvWL {
239
  if ( 0 < $wishlist['ID'] && 'private' !== $wishlist['status'] ) {
240
  if ( is_user_logged_in() ) {
241
  $user = get_user_by( 'id', $wishlist['author'] );
242
- $user_name = trim( sprintf( '%s %s', $user->user_firstname, $user->user_lastname ) );
243
- $user = @$user->display_name; // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
 
 
 
 
 
244
  } else {
245
  $user_name = '';
246
  $user = '';
239
  if ( 0 < $wishlist['ID'] && 'private' !== $wishlist['status'] ) {
240
  if ( is_user_logged_in() ) {
241
  $user = get_user_by( 'id', $wishlist['author'] );
242
+ if ( $user ) {
243
+ $user_name = trim( sprintf( '%s %s', $user->user_firstname, $user->user_lastname ) );
244
+ $user = @$user->display_name; // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
245
+ } else {
246
+ $user_name = '';
247
+ $user = '';
248
+ }
249
  } else {
250
  $user_name = '';
251
  $user = '';
public/wishlist/buttons.class.php CHANGED
@@ -59,19 +59,19 @@ class TInvWL_Public_Wishlist_Buttons {
59
  add_filter( self::$_n . '_prepare_attr__button_product_apply', array( __CLASS__, 'add_break_class_input' ) );
60
  add_filter( self::$_n . '_prepare_attr__button_product_apply', array( __CLASS__, 'add_break_class_checkbox' ) );
61
  }
62
- if ( tinv_get_option( 'table', 'colm_checkbox' ) && tinv_get_option( 'table', 'add_select_to_card' ) ) {
63
  $buttons[] = array(
64
  'name' => 'product_selected',
65
- 'title' => tinv_get_option( 'table', 'text_add_select_to_card' ),
66
  'method' => array( __CLASS__, 'apply_action_add_selected' ),
67
  'priority' => 25,
68
  );
69
  add_filter( self::$_n . '_prepare_attr__button_product_selected', array( __CLASS__, 'add_break_class_checkbox' ) );
70
  }
71
- if ( tinv_get_option( 'table', 'add_all_to_card' ) ) {
72
  $buttons[] = array(
73
  'name' => 'product_all',
74
- 'title' => tinv_get_option( 'table', 'text_add_all_to_card' ),
75
  'method' => array( __CLASS__, 'add_all' ),
76
  'priority' => 30,
77
  );
@@ -229,7 +229,7 @@ class TInvWL_Public_Wishlist_Buttons {
229
  */
230
  public static function add_all( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
231
  $products = self::get_current_products( $wishlist );
232
- $result = array();
233
  foreach ( $products as $product ) {
234
  $product_data = wc_get_product( $product['variation_id'] ? $product['variation_id'] : $product['product_id'] );
235
 
@@ -238,6 +238,7 @@ class TInvWL_Public_Wishlist_Buttons {
238
  remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
239
 
240
  if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $product_data, $redirect_url, $product ) ) {
 
241
  continue;
242
  }
243
  $product = $product['ID'];
@@ -247,6 +248,14 @@ class TInvWL_Public_Wishlist_Buttons {
247
  $result = tinv_array_merge( $result, $add );
248
  }
249
  }
 
 
 
 
 
 
 
 
250
  if ( ! empty( $result ) ) {
251
  wc_add_to_cart_message( $result, true );
252
  return true;
@@ -262,7 +271,7 @@ class TInvWL_Public_Wishlist_Buttons {
262
  public static function apply_action_before() {
263
  $options = array(
264
  '' => __( 'Actions', 'ti-woocommerce-wishlist' ),
265
- 'add_selected' => tinv_get_option( 'product_table', 'text_add_to_card' ),
266
  );
267
  $wishlist_curent = tinv_wishlist_get();
268
  if ( $wishlist_curent['is_owner'] ) {
@@ -306,7 +315,7 @@ class TInvWL_Public_Wishlist_Buttons {
306
  */
307
  public static function apply_action_add_selected( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
308
  if ( ! empty( $selected ) ) {
309
- $result = array();
310
  foreach ( $selected as $product ) {
311
  $wlp = null;
312
  if ( 0 === $wishlist['ID'] ) {
@@ -322,6 +331,7 @@ class TInvWL_Public_Wishlist_Buttons {
322
  remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
323
 
324
  if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $_product['data'], $redirect_url, $_product ) ) {
 
325
  continue;
326
  }
327
  }
@@ -331,11 +341,19 @@ class TInvWL_Public_Wishlist_Buttons {
331
  $result = tinv_array_merge( $result, $add );
332
  }
333
  }
 
 
 
 
 
 
 
 
334
  if ( ! empty( $result ) ) {
335
  wc_add_to_cart_message( $result, true );
336
  return true;
337
  }
338
- }
339
  return false;
340
  }
341
 
59
  add_filter( self::$_n . '_prepare_attr__button_product_apply', array( __CLASS__, 'add_break_class_input' ) );
60
  add_filter( self::$_n . '_prepare_attr__button_product_apply', array( __CLASS__, 'add_break_class_checkbox' ) );
61
  }
62
+ if ( tinv_get_option( 'table', 'colm_checkbox' ) && tinv_get_option( 'table', 'add_select_to_cart' ) ) {
63
  $buttons[] = array(
64
  'name' => 'product_selected',
65
+ 'title' => tinv_get_option( 'table', 'text_add_select_to_cart' ),
66
  'method' => array( __CLASS__, 'apply_action_add_selected' ),
67
  'priority' => 25,
68
  );
69
  add_filter( self::$_n . '_prepare_attr__button_product_selected', array( __CLASS__, 'add_break_class_checkbox' ) );
70
  }
71
+ if ( tinv_get_option( 'table', 'add_all_to_cart' ) ) {
72
  $buttons[] = array(
73
  'name' => 'product_all',
74
+ 'title' => tinv_get_option( 'table', 'text_add_all_to_cart' ),
75
  'method' => array( __CLASS__, 'add_all' ),
76
  'priority' => 30,
77
  );
229
  */
230
  public static function add_all( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
231
  $products = self::get_current_products( $wishlist );
232
+ $result = $errors = array();
233
  foreach ( $products as $product ) {
234
  $product_data = wc_get_product( $product['variation_id'] ? $product['variation_id'] : $product['product_id'] );
235
 
238
  remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
239
 
240
  if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $product_data, $redirect_url, $product ) ) {
241
+ $errors[] = $product['product_id'];
242
  continue;
243
  }
244
  $product = $product['ID'];
248
  $result = tinv_array_merge( $result, $add );
249
  }
250
  }
251
+ if ( ! empty( $errors ) ) {
252
+ $titles = array();
253
+ foreach ( $errors as $product_id ) {
254
+ $titles[] = ( $qty > 1 ? absint( $qty ) . ' &times; ' : '' ) . sprintf( _x( '&ldquo;%s&rdquo;', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) );
255
+ }
256
+ $titles = array_filter( $titles );
257
+ wc_add_notice( sprintf( _n( 'Product %s could not be added to cart because some options are not specified. Please, select some product options before adding the products to your cart.', 'Products: %s could not be added to cart because some options are not specified. Please, select some product options before adding the products to your cart.', count( $titles ), 'ti-woocommerce-wishlist-premium' ), wc_format_list_of_items( $titles ) ), 'error' );
258
+ }
259
  if ( ! empty( $result ) ) {
260
  wc_add_to_cart_message( $result, true );
261
  return true;
271
  public static function apply_action_before() {
272
  $options = array(
273
  '' => __( 'Actions', 'ti-woocommerce-wishlist' ),
274
+ 'add_selected' => tinv_get_option( 'product_table', 'text_add_to_cart' ),
275
  );
276
  $wishlist_curent = tinv_wishlist_get();
277
  if ( $wishlist_curent['is_owner'] ) {
315
  */
316
  public static function apply_action_add_selected( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
317
  if ( ! empty( $selected ) ) {
318
+ $result = $errors = array();
319
  foreach ( $selected as $product ) {
320
  $wlp = null;
321
  if ( 0 === $wishlist['ID'] ) {
331
  remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
332
 
333
  if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $_product['data'], $redirect_url, $_product ) ) {
334
+ $errors[] = $_product['product_id'];
335
  continue;
336
  }
337
  }
341
  $result = tinv_array_merge( $result, $add );
342
  }
343
  }
344
+ if ( ! empty( $errors ) ) {
345
+ $titles = array();
346
+ foreach ( $errors as $product_id ) {
347
+ $titles[] = ( $qty > 1 ? absint( $qty ) . ' &times; ' : '' ) . sprintf( _x( '&ldquo;%s&rdquo;', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) );
348
+ }
349
+ $titles = array_filter( $titles );
350
+ wc_add_notice( sprintf( _n( 'Product %s could not be added to cart because some options are not specified. Please, select some product options before adding the products to your cart.', 'Products: %s could not be added to cart because some options are not specified. Please, select some product options before adding the products to your cart.', count( $titles ), 'ti-woocommerce-wishlist-premium' ), wc_format_list_of_items( $titles ) ), 'error' );
351
+ }
352
  if ( ! empty( $result ) ) {
353
  wc_add_to_cart_message( $result, true );
354
  return true;
355
  }
356
+ } // End if().
357
  return false;
358
  }
359
 
public/wishlist/view.class.php CHANGED
@@ -76,8 +76,8 @@ class TInvWL_Public_Wishlist_View {
76
 
77
  add_action( 'tinvwl_after_wishlist', array( 'TInvWL_Public_Wishlist_Social', 'init' ) );
78
 
79
- add_action( 'tinvwl_wishlist_item_action_add_to_card', array( $this, 'product_allow_add_to_card' ), 10, 3 );
80
- add_filter( 'tinvwl_wishlist_item_add_to_card', array( $this, 'external_text' ), 10, 3 );
81
  add_action( 'tinvwl_after_wishlist_table', array( $this, 'get_per_page' ) );
82
 
83
  TInvWL_Public_Wishlist_Buttons::init( $this->_n );
@@ -169,7 +169,7 @@ class TInvWL_Public_Wishlist_View {
169
  * @param object $product Product.
170
  * @return boolean
171
  */
172
- function product_allow_add_to_card( $allow, $wlproduct, $product ) {
173
  if ( ! $allow ) {
174
  return false;
175
  }
@@ -229,7 +229,7 @@ class TInvWL_Public_Wishlist_View {
229
  if ( ! empty( $post['tinvwl-add-to-cart'] ) ) {
230
  $product = $post['tinvwl-add-to-cart'];
231
  $quantity = array_key_exists( $product, (array) $post['wishlist_qty'] ) ? $post['wishlist_qty'][ $product ] : 1;
232
- return $this->button_addtocard( $wishlist, $product, $quantity, $owner );
233
  }
234
  if ( ! empty( $post['tinvwl-remove'] ) ) {
235
  if ( ! $wishlist['is_owner'] ) {
@@ -269,7 +269,7 @@ class TInvWL_Public_Wishlist_View {
269
  * @param boolean $owner Is Owner.
270
  * @return boolean
271
  */
272
- function button_addtocard( $wishlist, $id, $quantity = 1, $owner = false ) {
273
  $id = absint( $id );
274
  $quantity = absint( $quantity );
275
  if ( empty( $id ) || empty( $quantity ) ) {
76
 
77
  add_action( 'tinvwl_after_wishlist', array( 'TInvWL_Public_Wishlist_Social', 'init' ) );
78
 
79
+ add_action( 'tinvwl_wishlist_item_action_add_to_cart', array( $this, 'product_allow_add_to_cart' ), 10, 3 );
80
+ add_filter( 'tinvwl_wishlist_item_add_to_cart', array( $this, 'external_text' ), 10, 3 );
81
  add_action( 'tinvwl_after_wishlist_table', array( $this, 'get_per_page' ) );
82
 
83
  TInvWL_Public_Wishlist_Buttons::init( $this->_n );
169
  * @param object $product Product.
170
  * @return boolean
171
  */
172
+ function product_allow_add_to_cart( $allow, $wlproduct, $product ) {
173
  if ( ! $allow ) {
174
  return false;
175
  }
229
  if ( ! empty( $post['tinvwl-add-to-cart'] ) ) {
230
  $product = $post['tinvwl-add-to-cart'];
231
  $quantity = array_key_exists( $product, (array) $post['wishlist_qty'] ) ? $post['wishlist_qty'][ $product ] : 1;
232
+ return $this->button_addtocart( $wishlist, $product, $quantity, $owner );
233
  }
234
  if ( ! empty( $post['tinvwl-remove'] ) ) {
235
  if ( ! $wishlist['is_owner'] ) {
269
  * @param boolean $owner Is Owner.
270
  * @return boolean
271
  */
272
+ function button_addtocart( $wishlist, $id, $quantity = 1, $owner = false ) {
273
  $id = absint( $id );
274
  $quantity = absint( $quantity );
275
  if ( empty( $id ) || empty( $quantity ) ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://templateinvaders.com/?utm_source=wordpressorg&utm_content=d
4
  Tags: wishlist, woocommerce, products, e-commerce, shop, ecommerce wishlist, woocommerce wishlist, woocommerce , shop wishlist, wishlist for Woocommerce
5
  Requires at least: 4.5
6
  Tested up to: 4.8
7
- Stable tag: 1.5.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -129,6 +129,14 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
129
 
130
  == Changelog ==
131
 
 
 
 
 
 
 
 
 
132
  = 1.5.3 =
133
  *Release Date - 30 August 2017*
134
 
4
  Tags: wishlist, woocommerce, products, e-commerce, shop, ecommerce wishlist, woocommerce wishlist, woocommerce , shop wishlist, wishlist for Woocommerce
5
  Requires at least: 4.5
6
  Tested up to: 4.8
7
+ Stable tag: 1.5.4
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.5.4 =
133
+ *Release Date - 07 September 2017*
134
+
135
+ * Added notice for variable products (if no variation applied by default) when adding to cart from Wishlist page.
136
+ * Fixed an issue when products could not be added to cart from shared Wishlist
137
+ * Fixed an issue with redirect to cart page after successful product addition
138
+ * Fixed an issue with "Plain" permalinks structure
139
+
140
  = 1.5.3 =
141
  *Release Date - 30 August 2017*
142
 
templates/ti-wishlist-user.php CHANGED
@@ -1,147 +1,147 @@
1
- <?php
2
- /**
3
- * The Template for displaying user wishlist.
4
- *
5
- * @version 1.0.0
6
- * @package TInvWishlist\Template
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit; // Exit if accessed directly.
11
- }
12
-
13
- ?>
14
- <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
15
- <?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
16
- <?php if ( function_exists( 'wc_print_notices' ) ) { wc_print_notices(); } ?>
17
- <form action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
18
- <?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
19
- <table class="tinvwl-table-manage-list">
20
- <thead>
21
- <tr>
22
- <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
23
- <th class="product-cb"><input type="checkbox" class="global-cb"></th>
24
- <?php } ?>
25
- <th class="product-thumbnail">&nbsp;</th>
26
- <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>
27
- <?php if ( $wishlist_table_row['colm_price'] ) { ?>
28
- <th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
29
- <?php } ?>
30
- <?php if ( $wishlist_table_row['colm_date'] ) { ?>
31
- <th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
32
- <?php } ?>
33
- <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
34
- <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
35
- <?php } ?>
36
- <?php if ( $wishlist_table_row['add_to_card'] ) { ?>
37
- <th class="product-action">&nbsp;</th>
38
- <?php } ?>
39
- </tr>
40
- </thead>
41
- <tbody>
42
- <?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
43
-
44
- <?php
45
- foreach ( $products as $wl_product ) {
46
- $product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
47
- unset( $wl_product['data'] );
48
- if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
49
- $product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
50
- do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
51
- ?>
52
- <tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
53
- <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
54
- <td class="product-cb">
55
- <?php
56
- echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
57
- '<input type="checkbox" name="wishlist_pr[]" value="%d">', esc_attr( $wl_product['ID'] )
58
- ), $wl_product, $product );
59
- ?>
60
- </td>
61
- <?php } ?>
62
- <td class="product-thumbnail">
63
- <?php
64
- $thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
65
-
66
- if ( ! $product->is_visible() ) {
67
- echo $thumbnail; // WPCS: xss ok.
68
- } else {
69
- printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
70
- }
71
- ?>
72
- </td>
73
- <td class="product-name">
74
- <?php
75
- if ( ! $product->is_visible() ) {
76
- echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . '&nbsp;'; // WPCS: xss ok.
77
- } else {
78
- echo apply_filters( 'tinvwl_wishlist_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_url ), $product->get_title() ), $wl_product, $product ); // WPCS: xss ok.
79
- }
80
-
81
- echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
82
- ?>
83
- </td>
84
- <?php if ( $wishlist_table_row['colm_price'] ) { ?>
85
- <td class="product-price">
86
- <?php
87
- echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
88
- ?>
89
- </td>
90
- <?php } ?>
91
- <?php if ( $wishlist_table_row['colm_date'] ) { ?>
92
- <td class="product-date">
93
- <?php
94
- echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
95
- '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
96
- ), $wl_product, $product );
97
- ?>
98
- </td>
99
- <?php } ?>
100
- <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
101
- <td class="product-stock">
102
- <?php
103
- $availability = (array) $product->get_availability();
104
- if ( ! array_key_exists( 'availability', $availability ) ) {
105
- $availability['availability'] = '';
106
- }
107
- if ( ! array_key_exists( 'class', $availability ) ) {
108
- $availability['class'] = '';
109
- }
110
- $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
111
-
112
- echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
113
- ?>
114
- </td>
115
- <?php } ?>
116
- <?php if ( $wishlist_table_row['add_to_card'] ) { ?>
117
- <td class="product-action">
118
- <?php
119
- if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_card', $wishlist_table_row['add_to_card'], $wl_product, $product ) ) {
120
- ?>
121
- <button class="button alt" name="tinvwl-add-to-cart" value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i class="fa fa-shopping-cart"></i><span class="tinvwl-txt"><?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_card', $wishlist_table_row['text_add_to_card'], $wl_product, $product ) ); ?></span></button>
122
- <?php } ?>
123
- </td>
124
- <?php } ?>
125
- </tr>
126
- <?php
127
- do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
128
- } // End if().
129
- } // End foreach().
130
- ?>
131
- <?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
132
- </tbody>
133
- <tfoot>
134
- <tr>
135
- <td colspan="100%">
136
- <?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
137
- <?php wp_nonce_field( 'tinvwl_wishlist_user', 'wishlist_nonce' ); ?>
138
- </td>
139
- </tr>
140
- </tfoot>
141
- </table>
142
- </form>
143
- <?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
144
- <div class="tinv-lists-nav tinv-wishlist-clear">
145
- <?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
146
- </div>
147
- </div>
1
+ <?php
2
+ /**
3
+ * The Template for displaying user wishlist.
4
+ *
5
+ * @version 1.0.0
6
+ * @package TInvWishlist\Template
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit; // Exit if accessed directly.
11
+ }
12
+
13
+ ?>
14
+ <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
15
+ <?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
16
+ <?php if ( function_exists( 'wc_print_notices' ) ) { wc_print_notices(); } ?>
17
+ <form action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
18
+ <?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
19
+ <table class="tinvwl-table-manage-list">
20
+ <thead>
21
+ <tr>
22
+ <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
23
+ <th class="product-cb"><input type="checkbox" class="global-cb"></th>
24
+ <?php } ?>
25
+ <th class="product-thumbnail">&nbsp;</th>
26
+ <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>
27
+ <?php if ( $wishlist_table_row['colm_price'] ) { ?>
28
+ <th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
29
+ <?php } ?>
30
+ <?php if ( $wishlist_table_row['colm_date'] ) { ?>
31
+ <th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
32
+ <?php } ?>
33
+ <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
34
+ <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
35
+ <?php } ?>
36
+ <?php if ( $wishlist_table_row['add_to_cart'] ) { ?>
37
+ <th class="product-action">&nbsp;</th>
38
+ <?php } ?>
39
+ </tr>
40
+ </thead>
41
+ <tbody>
42
+ <?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
43
+
44
+ <?php
45
+ foreach ( $products as $wl_product ) {
46
+ $product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
47
+ unset( $wl_product['data'] );
48
+ if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
49
+ $product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
50
+ do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
51
+ ?>
52
+ <tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
53
+ <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
54
+ <td class="product-cb">
55
+ <?php
56
+ echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
57
+ '<input type="checkbox" name="wishlist_pr[]" value="%d">', esc_attr( $wl_product['ID'] )
58
+ ), $wl_product, $product );
59
+ ?>
60
+ </td>
61
+ <?php } ?>
62
+ <td class="product-thumbnail">
63
+ <?php
64
+ $thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
65
+
66
+ if ( ! $product->is_visible() ) {
67
+ echo $thumbnail; // WPCS: xss ok.
68
+ } else {
69
+ printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
70
+ }
71
+ ?>
72
+ </td>
73
+ <td class="product-name">
74
+ <?php
75
+ if ( ! $product->is_visible() ) {
76
+ echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . '&nbsp;'; // WPCS: xss ok.
77
+ } else {
78
+ echo apply_filters( 'tinvwl_wishlist_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_url ), $product->get_title() ), $wl_product, $product ); // WPCS: xss ok.
79
+ }
80
+
81
+ echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
82
+ ?>
83
+ </td>
84
+ <?php if ( $wishlist_table_row['colm_price'] ) { ?>
85
+ <td class="product-price">
86
+ <?php
87
+ echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
88
+ ?>
89
+ </td>
90
+ <?php } ?>
91
+ <?php if ( $wishlist_table_row['colm_date'] ) { ?>
92
+ <td class="product-date">
93
+ <?php
94
+ echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
95
+ '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
96
+ ), $wl_product, $product );
97
+ ?>
98
+ </td>
99
+ <?php } ?>
100
+ <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
101
+ <td class="product-stock">
102
+ <?php
103
+ $availability = (array) $product->get_availability();
104
+ if ( ! array_key_exists( 'availability', $availability ) ) {
105
+ $availability['availability'] = '';
106
+ }
107
+ if ( ! array_key_exists( 'class', $availability ) ) {
108
+ $availability['class'] = '';
109
+ }
110
+ $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
111
+
112
+ echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
113
+ ?>
114
+ </td>
115
+ <?php } ?>
116
+ <?php if ( $wishlist_table_row['add_to_cart'] ) { ?>
117
+ <td class="product-action">
118
+ <?php
119
+ if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
120
+ ?>
121
+ <button class="button alt" name="tinvwl-add-to-cart" value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i class="fa fa-shopping-cart"></i><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>
122
+ <?php } ?>
123
+ </td>
124
+ <?php } ?>
125
+ </tr>
126
+ <?php
127
+ do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
128
+ } // End if().
129
+ } // End foreach().
130
+ ?>
131
+ <?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
132
+ </tbody>
133
+ <tfoot>
134
+ <tr>
135
+ <td colspan="100%">
136
+ <?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
137
+ <?php wp_nonce_field( 'tinvwl_wishlist_user', 'wishlist_nonce' ); ?>
138
+ </td>
139
+ </tr>
140
+ </tfoot>
141
+ </table>
142
+ </form>
143
+ <?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
144
+ <div class="tinv-lists-nav tinv-wishlist-clear">
145
+ <?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
146
+ </div>
147
+ </div>
templates/ti-wishlist.php CHANGED
@@ -1,151 +1,151 @@
1
- <?php
2
- /**
3
- * The Template for displaying wishlist.
4
- *
5
- * @version 1.0.0
6
- * @package TInvWishlist\Template
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit; // Exit if accessed directly.
11
- }
12
-
13
- ?>
14
- <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
15
- <?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
16
- <?php if ( function_exists( 'wc_print_notices' ) ) { wc_print_notices(); } ?>
17
- <form action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
18
- <?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
19
- <table class="tinvwl-table-manage-list">
20
- <thead>
21
- <tr>
22
- <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
23
- <th class="product-cb"><input type="checkbox" class="global-cb"></th>
24
- <?php } ?>
25
- <th class="product-remove"></th>
26
- <th class="product-thumbnail">&nbsp;</th>
27
- <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>
28
- <?php if ( $wishlist_table_row['colm_price'] ) { ?>
29
- <th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
30
- <?php } ?>
31
- <?php if ( $wishlist_table_row['colm_date'] ) { ?>
32
- <th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
33
- <?php } ?>
34
- <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
35
- <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
36
- <?php } ?>
37
- <?php if ( $wishlist_table_row['add_to_card'] ) { ?>
38
- <th class="product-action">&nbsp;</th>
39
- <?php } ?>
40
- </tr>
41
- </thead>
42
- <tbody>
43
- <?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
44
-
45
- <?php
46
- foreach ( $products as $wl_product ) {
47
- $product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
48
- unset( $wl_product['data'] );
49
- if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
50
- $product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
51
- do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
52
- ?>
53
- <tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
54
- <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
55
- <td class="product-cb">
56
- <?php
57
- echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
58
- '<input type="checkbox" name="wishlist_pr[]" value="%d">', esc_attr( $wl_product['ID'] )
59
- ), $wl_product, $product );
60
- ?>
61
- </td>
62
- <?php } ?>
63
- <td class="product-remove">
64
- <button type="submit" name="tinvwl-remove" value="<?php echo esc_attr( $wl_product['ID'] ); ?>" >X</button>
65
- </td>
66
- <td class="product-thumbnail">
67
- <?php
68
- $thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
69
-
70
- if ( ! $product->is_visible() ) {
71
- echo $thumbnail; // WPCS: xss ok.
72
- } else {
73
- printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
74
- }
75
- ?>
76
- </td>
77
- <td class="product-name">
78
- <?php
79
- if ( ! $product->is_visible() ) {
80
- echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . '&nbsp;'; // WPCS: xss ok.
81
- } else {
82
- echo apply_filters( 'tinvwl_wishlist_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_url ), $product->get_title() ), $wl_product, $product ); // WPCS: xss ok.
83
- }
84
-
85
- echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
86
- ?>
87
- </td>
88
- <?php if ( $wishlist_table_row['colm_price'] ) { ?>
89
- <td class="product-price">
90
- <?php
91
- echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
92
- ?>
93
- </td>
94
- <?php } ?>
95
- <?php if ( $wishlist_table_row['colm_date'] ) { ?>
96
- <td class="product-date">
97
- <?php
98
- echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
99
- '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
100
- ), $wl_product, $product );
101
- ?>
102
- </td>
103
- <?php } ?>
104
- <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
105
- <td class="product-stock">
106
- <?php
107
- $availability = (array) $product->get_availability();
108
- if ( ! array_key_exists( 'availability', $availability ) ) {
109
- $availability['availability'] = '';
110
- }
111
- if ( ! array_key_exists( 'class', $availability ) ) {
112
- $availability['class'] = '';
113
- }
114
- $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
115
-
116
- echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
117
- ?>
118
- </td>
119
- <?php } ?>
120
- <?php if ( $wishlist_table_row['add_to_card'] ) { ?>
121
- <td class="product-action">
122
- <?php
123
- if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_card', $wishlist_table_row['add_to_card'], $wl_product, $product ) ) {
124
- ?>
125
- <button class="button alt" name="tinvwl-add-to-cart" value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i class="fa fa-shopping-cart"></i><span class="tinvwl-txt"><?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_card', $wishlist_table_row['text_add_to_card'], $wl_product, $product ) ); ?></span></button>
126
- <?php } ?>
127
- </td>
128
- <?php } ?>
129
- </tr>
130
- <?php
131
- do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
132
- } // End if().
133
- } // End foreach().
134
- ?>
135
- <?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
136
- </tbody>
137
- <tfoot>
138
- <tr>
139
- <td colspan="100%">
140
- <?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
141
- <?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
142
- </td>
143
- </tr>
144
- </tfoot>
145
- </table>
146
- </form>
147
- <?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
148
- <div class="tinv-lists-nav tinv-wishlist-clear">
149
- <?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
150
- </div>
151
- </div>
1
+ <?php
2
+ /**
3
+ * The Template for displaying wishlist.
4
+ *
5
+ * @version 1.0.0
6
+ * @package TInvWishlist\Template
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit; // Exit if accessed directly.
11
+ }
12
+
13
+ ?>
14
+ <div class="tinv-wishlist woocommerce tinv-wishlist-clear">
15
+ <?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
16
+ <?php if ( function_exists( 'wc_print_notices' ) ) { wc_print_notices(); } ?>
17
+ <form action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
18
+ <?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
19
+ <table class="tinvwl-table-manage-list">
20
+ <thead>
21
+ <tr>
22
+ <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
23
+ <th class="product-cb"><input type="checkbox" class="global-cb"></th>
24
+ <?php } ?>
25
+ <th class="product-remove"></th>
26
+ <th class="product-thumbnail">&nbsp;</th>
27
+ <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>
28
+ <?php if ( $wishlist_table_row['colm_price'] ) { ?>
29
+ <th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
30
+ <?php } ?>
31
+ <?php if ( $wishlist_table_row['colm_date'] ) { ?>
32
+ <th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
33
+ <?php } ?>
34
+ <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
35
+ <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
36
+ <?php } ?>
37
+ <?php if ( $wishlist_table_row['add_to_cart'] ) { ?>
38
+ <th class="product-action">&nbsp;</th>
39
+ <?php } ?>
40
+ </tr>
41
+ </thead>
42
+ <tbody>
43
+ <?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
44
+
45
+ <?php
46
+ foreach ( $products as $wl_product ) {
47
+ $product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
48
+ unset( $wl_product['data'] );
49
+ if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
50
+ $product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
51
+ do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
52
+ ?>
53
+ <tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
54
+ <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
55
+ <td class="product-cb">
56
+ <?php
57
+ echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
58
+ '<input type="checkbox" name="wishlist_pr[]" value="%d">', esc_attr( $wl_product['ID'] )
59
+ ), $wl_product, $product );
60
+ ?>
61
+ </td>
62
+ <?php } ?>
63
+ <td class="product-remove">
64
+ <button type="submit" name="tinvwl-remove" value="<?php echo esc_attr( $wl_product['ID'] ); ?>" >X</button>
65
+ </td>
66
+ <td class="product-thumbnail">
67
+ <?php
68
+ $thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
69
+
70
+ if ( ! $product->is_visible() ) {
71
+ echo $thumbnail; // WPCS: xss ok.
72
+ } else {
73
+ printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
74
+ }
75
+ ?>
76
+ </td>
77
+ <td class="product-name">
78
+ <?php
79
+ if ( ! $product->is_visible() ) {
80
+ echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . '&nbsp;'; // WPCS: xss ok.
81
+ } else {
82
+ echo apply_filters( 'tinvwl_wishlist_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_url ), $product->get_title() ), $wl_product, $product ); // WPCS: xss ok.
83
+ }
84
+
85
+ echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
86
+ ?>
87
+ </td>
88
+ <?php if ( $wishlist_table_row['colm_price'] ) { ?>
89
+ <td class="product-price">
90
+ <?php
91
+ echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
92
+ ?>
93
+ </td>
94
+ <?php } ?>
95
+ <?php if ( $wishlist_table_row['colm_date'] ) { ?>
96
+ <td class="product-date">
97
+ <?php
98
+ echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
99
+ '<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
100
+ ), $wl_product, $product );
101
+ ?>
102
+ </td>
103
+ <?php } ?>
104
+ <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
105
+ <td class="product-stock">
106
+ <?php
107
+ $availability = (array) $product->get_availability();
108
+ if ( ! array_key_exists( 'availability', $availability ) ) {
109
+ $availability['availability'] = '';
110
+ }
111
+ if ( ! array_key_exists( 'class', $availability ) ) {
112
+ $availability['class'] = '';
113
+ }
114
+ $availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist-premium' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="fa fa-check"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
115
+
116
+ echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
117
+ ?>
118
+ </td>
119
+ <?php } ?>
120
+ <?php if ( $wishlist_table_row['add_to_cart'] ) { ?>
121
+ <td class="product-action">
122
+ <?php
123
+ if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
124
+ ?>
125
+ <button class="button alt" name="tinvwl-add-to-cart" value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i class="fa fa-shopping-cart"></i><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>
126
+ <?php } ?>
127
+ </td>
128
+ <?php } ?>
129
+ </tr>
130
+ <?php
131
+ do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
132
+ } // End if().
133
+ } // End foreach().
134
+ ?>
135
+ <?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
136
+ </tbody>
137
+ <tfoot>
138
+ <tr>
139
+ <td colspan="100%">
140
+ <?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
141
+ <?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
142
+ </td>
143
+ </tr>
144
+ </tfoot>
145
+ </table>
146
+ </form>
147
+ <?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
148
+ <div class="tinv-lists-nav tinv-wishlist-clear">
149
+ <?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
150
+ </div>
151
+ </div>
ti-woocommerce-wishlist.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: WooCommerce Wishlist Plugin
5
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
  * Description: Wishlist functionality for your WooCommerce store.
7
- * Version: 1.5.3
8
  * Author: TemplateInvaders
9
  * Author URI: https://templateinvaders.com/
10
  * License: GPL-2.0+
@@ -37,7 +37,7 @@ if ( ! defined( 'TINVWL_DOMAIN' ) ) {
37
  }
38
 
39
  if ( ! defined( 'TINVWL_FVERSION' ) ) {
40
- define( 'TINVWL_FVERSION', '1.5.3' );
41
  }
42
 
43
  if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
4
  * Plugin Name: WooCommerce Wishlist Plugin
5
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
6
  * Description: Wishlist functionality for your WooCommerce store.
7
+ * Version: 1.5.4
8
  * Author: TemplateInvaders
9
  * Author URI: https://templateinvaders.com/
10
  * License: GPL-2.0+
37
  }
38
 
39
  if ( ! defined( 'TINVWL_FVERSION' ) ) {
40
+ define( 'TINVWL_FVERSION', '1.5.4' );
41
  }
42
 
43
  if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
tinv-wishlists-function-integration.php CHANGED
@@ -190,19 +190,19 @@ if ( ! function_exists( 'gf_productaddon_support' ) ) {
190
  /**
191
  * Change text for button add to cart
192
  *
193
- * @param string $text_add_to_card Text "Add to cart".
194
  * @param array $wl_product Wishlist product.
195
  * @param object $product WooCommerce Product.
196
  *
197
  * @return string
198
  */
199
- function gf_productaddon_text_button( $text_add_to_card, $wl_product, $product ) {
200
  $gravity_form_data = get_post_meta( ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product->id : ( $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id() ) ), '_gravity_form_data', true );
201
 
202
- return ( $gravity_form_data ) ? __( 'Select options', 'woocommerce' ) : $text_add_to_card;
203
  }
204
 
205
- add_filter( 'tinvwl_wishlist_item_add_to_card', 'gf_productaddon_text_button', 10, 3 );
206
  }
207
 
208
  if ( ! function_exists( 'gf_productaddon_run_action_button' ) ) {
@@ -720,7 +720,7 @@ if ( ! function_exists( 'tinvwl_row_woocommerce_composite_products' ) ) {
720
  if ( tinv_get_option( 'product_table', 'colm_stock' ) ) {
721
  $row_string .= '<td class="product-stock">%5$s</td>';
722
  }
723
- if ( tinv_get_option( 'product_table', 'add_to_card' ) ) {
724
  $row_string .= '<td class="product-action">&nbsp;</td>';
725
  }
726
  $row_string .= '</tr>';
@@ -823,7 +823,7 @@ if ( ! function_exists( 'tinvwl_row_woocommerce_product_bundles' ) ) {
823
  $row_string .= '<td class="product-stock">%4$s</td>';
824
  }
825
 
826
- if ( tinv_get_option( 'product_table', 'add_to_card' ) ) {
827
  $row_string .= '<td class="product-action">&nbsp;</td>';
828
  }
829
  $row_string .= '</tr>';
@@ -969,7 +969,7 @@ if ( ! function_exists( 'tinvwl_row_woocommerce_mix_and_match_products' ) ) {
969
  if ( tinv_get_option( 'product_table', 'colm_stock' ) ) {
970
  $row_string .= '<td class="product-stock">%4$s</td>';
971
  }
972
- if ( tinv_get_option( 'product_table', 'add_to_card' ) ) {
973
  $row_string .= '<td class="product-action">&nbsp;</td>';
974
  }
975
  $row_string .= '</tr>';
@@ -1182,7 +1182,7 @@ if ( ! function_exists( 'tinvwl_row_yith_woocommerce_product_bundles' ) ) {
1182
  if ( tinv_get_option( 'product_table', 'colm_stock' ) ) {
1183
  $row_string .= '<td class="product-stock">%4$s</td>';
1184
  }
1185
- if ( tinv_get_option( 'product_table', 'add_to_card' ) ) {
1186
  $row_string .= '<td class="product-action">&nbsp;</td>';
1187
  }
1188
  $row_string .= '</tr>';
190
  /**
191
  * Change text for button add to cart
192
  *
193
+ * @param string $text_add_to_cart Text "Add to cart".
194
  * @param array $wl_product Wishlist product.
195
  * @param object $product WooCommerce Product.
196
  *
197
  * @return string
198
  */
199
+ function gf_productaddon_text_button( $text_add_to_cart, $wl_product, $product ) {
200
  $gravity_form_data = get_post_meta( ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product->id : ( $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id() ) ), '_gravity_form_data', true );
201
 
202
+ return ( $gravity_form_data ) ? __( 'Select options', 'woocommerce' ) : $text_add_to_cart;
203
  }
204
 
205
+ add_filter( 'tinvwl_wishlist_item_add_to_cart', 'gf_productaddon_text_button', 10, 3 );
206
  }
207
 
208
  if ( ! function_exists( 'gf_productaddon_run_action_button' ) ) {
720
  if ( tinv_get_option( 'product_table', 'colm_stock' ) ) {
721
  $row_string .= '<td class="product-stock">%5$s</td>';
722
  }
723
+ if ( tinv_get_option( 'product_table', 'add_to_cart' ) ) {
724
  $row_string .= '<td class="product-action">&nbsp;</td>';
725
  }
726
  $row_string .= '</tr>';
823
  $row_string .= '<td class="product-stock">%4$s</td>';
824
  }
825
 
826
+ if ( tinv_get_option( 'product_table', 'add_to_cart' ) ) {
827
  $row_string .= '<td class="product-action">&nbsp;</td>';
828
  }
829
  $row_string .= '</tr>';
969
  if ( tinv_get_option( 'product_table', 'colm_stock' ) ) {
970
  $row_string .= '<td class="product-stock">%4$s</td>';
971
  }
972
+ if ( tinv_get_option( 'product_table', 'add_to_cart' ) ) {
973
  $row_string .= '<td class="product-action">&nbsp;</td>';
974
  }
975
  $row_string .= '</tr>';
1182
  if ( tinv_get_option( 'product_table', 'colm_stock' ) ) {
1183
  $row_string .= '<td class="product-stock">%4$s</td>';
1184
  }
1185
+ if ( tinv_get_option( 'product_table', 'add_to_cart' ) ) {
1186
  $row_string .= '<td class="product-action">&nbsp;</td>';
1187
  }
1188
  $row_string .= '</tr>';
tinv-wishlists-function.php CHANGED
@@ -481,7 +481,7 @@ if ( ! function_exists( 'tinv_url_wishlist_by_key' ) ) {
481
  }
482
  $link .= $share_key . '/' . $suffix;
483
  } else {
484
- $link .= add_query_arg( 'tinvwlID', $share_key, $link );
485
  }
486
 
487
  if ( 1 < $paged ) {
@@ -504,7 +504,7 @@ if ( ! function_exists( 'tinv_url_wishlist' ) ) {
504
  */
505
  function tinv_url_wishlist( $id = '', $paged = 1, $full = true ) {
506
  $share_key = $id;
507
- if ( is_integer( $id ) ) {
508
  $wishlist = tinv_wishlist_get( $id, false );
509
  $share_key = $wishlist['share_key'];
510
  }
@@ -712,7 +712,7 @@ if ( ! function_exists( 'tinvwl_add_to_cart_need_redirect' ) ) {
712
  add_filter( 'tinvwl_product_add_to_cart_need_redirect', 'tinvwl_add_to_cart_need_redirect', 10, 3 );
713
  } // End if().
714
 
715
- if ( ! function_exists( 'tinvwl_meta_validate_card_add' ) ) {
716
 
717
  /**
718
  * Checks the ability to add a product
@@ -724,7 +724,7 @@ if ( ! function_exists( 'tinvwl_meta_validate_card_add' ) ) {
724
  *
725
  * @return boolean
726
  */
727
- function tinvwl_meta_validate_card_add( $redirect, $product, $redirect_url, $wl_product ) {
728
  if ( $redirect && array_key_exists( 'meta', $wl_product ) && ! empty( $wl_product['meta'] ) ) {
729
 
730
  TInvWL_Public_Cart::prepare_post( $wl_product );
@@ -749,7 +749,7 @@ if ( ! function_exists( 'tinvwl_meta_validate_card_add' ) ) {
749
  return $redirect;
750
  }
751
 
752
- add_filter( 'tinvwl_product_add_to_cart_need_redirect', 'tinvwl_meta_validate_card_add', 90, 4 );
753
  } // End if().
754
 
755
  if ( ! function_exists( 'tinv_wishlist_print_meta' ) ) {
481
  }
482
  $link .= $share_key . '/' . $suffix;
483
  } else {
484
+ $link = add_query_arg( 'tinvwlID', $share_key, $link );
485
  }
486
 
487
  if ( 1 < $paged ) {
504
  */
505
  function tinv_url_wishlist( $id = '', $paged = 1, $full = true ) {
506
  $share_key = $id;
507
+ if ( ! ( is_string( $id ) && preg_match( '/^[A-Fa-f0-9]{6}$/', $id ) ) ) {
508
  $wishlist = tinv_wishlist_get( $id, false );
509
  $share_key = $wishlist['share_key'];
510
  }
712
  add_filter( 'tinvwl_product_add_to_cart_need_redirect', 'tinvwl_add_to_cart_need_redirect', 10, 3 );
713
  } // End if().
714
 
715
+ if ( ! function_exists( 'tinvwl_meta_validate_cart_add' ) ) {
716
 
717
  /**
718
  * Checks the ability to add a product
724
  *
725
  * @return boolean
726
  */
727
+ function tinvwl_meta_validate_cart_add( $redirect, $product, $redirect_url, $wl_product ) {
728
  if ( $redirect && array_key_exists( 'meta', $wl_product ) && ! empty( $wl_product['meta'] ) ) {
729
 
730
  TInvWL_Public_Cart::prepare_post( $wl_product );
749
  return $redirect;
750
  }
751
 
752
+ add_filter( 'tinvwl_product_add_to_cart_need_redirect', 'tinvwl_meta_validate_cart_add', 90, 4 );
753
  } // End if().
754
 
755
  if ( ! function_exists( 'tinv_wishlist_print_meta' ) ) {
wpml-config.xml CHANGED
@@ -16,11 +16,11 @@
16
  <key name="text_remove"/>
17
  </key>
18
  <key name="tinvwl-product_table">
19
- <key name="text_add_to_card"/>
20
  </key>
21
  <key name="tinvwl-table">
22
- <key name="text_add_select_to_card"/>
23
- <key name="text_add_all_to_card"/>
24
  </key>
25
  <key name="tinvwl-social">
26
  <key name="share_on"/>
16
  <key name="text_remove"/>
17
  </key>
18
  <key name="tinvwl-product_table">
19
+ <key name="text_add_to_cart"/>
20
  </key>
21
  <key name="tinvwl-table">
22
+ <key name="text_add_select_to_cart"/>
23
+ <key name="text_add_all_to_cart"/>
24
  </key>
25
  <key name="tinvwl-social">
26
  <key name="share_on"/>