Version Description
Release Date - 13 August 2018
- Fixed "wishlist not found" issue when a guest browsing empty wishlist page
- Fixed "product in wishlist" button state for a variable product type
- Fixed issue with products counter update on product(s) removed from a wishlist
- Fixed fatal errors when 3rd party code using global product object outside a loop
- Fixed fatal error in upgrading method for PHP prior 5.5 versions
Download this release
Release Info
Developer | templateinvaders |
Plugin | WooCommerce Wishlist Plugin |
Version | 1.8.10 |
Comparing to | |
See all releases |
Code changes from version 1.8.9 to 1.8.10
- assets/css/admin-form.min.css +1 -1
- assets/css/admin-setup.min.css +1 -1
- assets/css/admin.min.css +1 -1
- assets/css/public.min.css +1 -1
- assets/css/theme.min.css +1 -1
- assets/js/admin.min.js +1 -1
- assets/js/public.js +0 -15
- assets/js/public.min.js +2 -2
- includes/update.helper.php +6 -2
- languages/ti-woocommerce-wishlist.pot +13 -13
- public/addtowishlist.class.php +1 -1
- public/wishlist/buttons.class.php +41 -17
- public/wishlist/view.class.php +69 -8
- readme.txt +10 -1
- templates/ti-wishlist.php +161 -161
- ti-woocommerce-wishlist.php +2 -2
- tinv-wishlists-function.php +22 -9
assets/css/admin-form.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.10
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/admin-setup.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.10
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/admin.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.10
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/public.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.10
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/theme.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.10
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/js/admin.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.10
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/js/public.js
CHANGED
@@ -506,19 +506,4 @@
|
|
506 |
$(document.body).on('wc_fragments_refreshed wc_fragments_loaded', function () {
|
507 |
$('.wishlist_products_counter').toggleClass('wishlist-counter-with-products', '0' != $('.wishlist_products_counter_number').html());
|
508 |
});
|
509 |
-
|
510 |
-
$(window).on('load', function () {
|
511 |
-
if ($('.tinv-wishlist.woocommerce').length && $('.woocommerce-message').length) {
|
512 |
-
$(document.body).on('wc_fragments_refreshed.wishlist', function () {
|
513 |
-
if (typeof wc_cart_fragments_params === 'undefined') {
|
514 |
-
return false;
|
515 |
-
}
|
516 |
-
cart_hash_key = wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash';
|
517 |
-
localStorage.setItem(cart_hash_key, localStorage.getItem(cart_hash_key) + (new Date()).getTime());
|
518 |
-
sessionStorage.setItem(cart_hash_key, sessionStorage.getItem(cart_hash_key) + (new Date()).getTime());
|
519 |
-
$(document.body).off('wc_fragments_refreshed.wishlist');
|
520 |
-
});
|
521 |
-
$(document.body).trigger('updated_wc_div');
|
522 |
-
}
|
523 |
-
});
|
524 |
})(jQuery);
|
506 |
$(document.body).on('wc_fragments_refreshed wc_fragments_loaded', function () {
|
507 |
$('.wishlist_products_counter').toggleClass('wishlist-counter-with-products', '0' != $('.wishlist_products_counter_number').html());
|
508 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
})(jQuery);
|
assets/js/public.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
5 |
|
6 |
-
!function(r){r.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href,text_create:window.tinvwl_add_to_wishlist.text_create,text_already_in:window.tinvwl_add_to_wishlist.text_already_in,class:{dialogbox:".tinvwl_add_to_select_wishlist",select:".tinvwl_wishlist",newtitle:".tinvwl_new_input",dialogbutton:".tinvwl_button_add"},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){r("body > .tinv-wishlist").length||r("body").append(r("<div>").addClass("tinv-wishlist")),r(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){r(this).append(r("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(){r(this).addClass("tinv-modal-open")},onDialogHide:function(){r(this).removeClass("tinv-modal-open")},onInited:function(){},onClick:function(){if(r(this).is(".disabled-add-wishlist"))return!1;this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):o.onActionProduct.call(this)},onPrepareDataAction:function(){},filterProductAlreadyIn:function(t){t=t||[];var e={};return r("form.cart[method=post], .woocommerce-variation-add-to-cart").find("input, select").each(function(){var t=r(this).attr("name"),i=r(this).attr("type"),n=r(this).val();"checkbox"===i||"radio"===i?r(this).is(":checked")&&(e["form"+t]=n):e["form"+t]=n}),e=e.formvariation_id,t.filter(function(t){if("object"==typeof t.in&&"string"==typeof e){var i=parseInt(e);return 0<=t.in.indexOf(i)}return t.in})},onMultiProductAlreadyIn:function(t){t=t||[];t=o.onPrepareList.call(t)||t,t=o.filterProductAlreadyIn.call(this,t)||t,r(this).parent().parent().find(".already-in").remove();var n="";switch(t.length){case 0:break;default:n=r("<ul>");r.each(t,function(t,i){n.append(r("<li>").html(r("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}n.length&&r(this).closest(".tinv-modal-inner").find("img").after(r("<div>").addClass("already-in").html(o.text_already_in+" ").append(n))},onAction:{redirect:function(t){o.redirectTimer&&clearTimeout(o.redirectTimer),o.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(t){r(this).attr("data-tinv-wl-list",t)},msg:function(t){if(!t)return!1;var i=r(t).eq(0);r("body > .tinv-wishlist").length||r("body").append(r("<div>").addClass("tinv-wishlist")),r("body > .tinv-wishlist").append(i),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),o.redirectTimer&&clearTimeout(o.redirectTimer)})},status:function(t){t&&r(this).addClass("tinvwl-product-in-list")},removed:function(t){t&&r(this).removeClass("tinvwl-product-in-list").removeClass("tinvwl-product-make-remove").attr("data-tinv-wl-action","addto")},make_remove:function(t){r(this).toggleClass("tinvwl-product-make-remove",t).attr("data-tinv-wl-action",t?"remove":"addto")},fragments:function(t){if("undefined"==typeof wc_cart_fragments_params)return r.each(t,function(t,i){r(t).replaceWith(i)}),!1;var i;try{i="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(t){i=!1}if(i)try{var n=r.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),e=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash",o=sessionStorage.getItem(e),a=Cookies.get("woocommerce_cart_hash"),l=sessionStorage.getItem("wc_cart_created");if(null!=o&&""!==o||(o=""),null!=a&&""!==a||(a=""),o&&(null==l||""===l))throw"No cart_created";if(r.each(t,function(t,i){n[t]=i}),localStorage.setItem(e,localStorage.getItem(e)+(new Date).getTime()),sessionStorage.setItem(e,sessionStorage.getItem(e)+(new Date).getTime()),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(n)),!n||!n["div.widget_shopping_cart_content"]||o!==a)throw"No fragment";r.each(n,function(t,i){r(t).replaceWith(i)}),r(document.body).trigger("wc_fragments_loaded")}catch(t){r(document.body).trigger("wc_fragment_refresh")}}},onActionProduct:function(t,i){var s={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:r(this).attr("data-tinv-wl-producttype"),product_id:r(this).attr("data-tinv-wl-product")||0,product_variation:r(this).attr("data-tinv-wl-productvariation")||0,product_action:r(this).attr("data-tinv-wl-action")||"addto"},n=this;r(n).closest("form.cart[method=post], .tinvwl-loop-button-wrapper").find("input, select, textarea").each(function(){var t=r(this).attr("name"),i=r(this).attr("type"),n=r(this).val(),e=10,o=function(t,i){if("object"==typeof i){for(var n in void 0===t&&(t={}),i)if(""===n){var e=-1;for(e in t)e=e;t[e=parseInt(e)+1]=o(t[n],i[n])}else t[n]=o(t[n],i[n]);return t}return i};if("button"!==i&&void 0!==t&&"attribute_"!=t.substr(0,10)){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<e;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=n,n=l}t=a[1],e--}"checkbox"===i||"radio"===i?r(this).is(":checked")&&(n.length||"object"==typeof n||(n=!0),s.form[t]=o(s.form[t],n)):s.form[t]=o(s.form[t],n)}}),s=o.onPrepareDataAction.call(n,s)||s,r.post(o.api_url,s,function(t){if(o.onDialogHide.call(n.tinvwl_dialog),"object"==typeof t)for(var i in t)"function"==typeof o.onAction[i]&&o.onAction[i].call(n,t[i]);else"function"==typeof o.onAction.msg&&o.onAction.msg.call(n,t)})}},o=r.extend(!0,{},i,t);return r(this).each(function(){if(!r(this).attr("data-tinv-wl-list"))return!1;if(o.dialogbox&&o.dialogbox.length&&(this.tinvwl_dialog=o.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=o.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=r(this).nextAll(o.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){o.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=r(this).find(o.class.select).eq(0);r(this).find(o.class.newtitle).hide().val(""),n.html(""),r.each(t,function(t,i){o.onCreateWishList.call(n,i)}),o.text_create&&o.onCreateWishList.call(n,{ID:"",title:o.text_create,in:!1}),o.onMultiProductAlreadyIn.call(n,t),o.onSelectWishList.call(n,t),r(this).find(o.class.newtitle).toggle(""===n.val())}),"function"!=typeof this.tinvwl_dialog.show_list&&(this.tinvwl_dialog.show_list=function(){var t=r.parseJSON(r(this).attr("data-tinv-wl-list"))||[];t.length?(t=o.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),o.onDialogShow.call(this.tinvwl_dialog)):o.onActionProduct.call(this)});var e=this;r(this.tinvwl_dialog).find(o.class.dialogbutton).off("click").on("click",function(){var t,i=r(e.tinvwl_dialog).find(o.class.select),n=r(e.tinvwl_dialog).find(o.class.newtitle);i.val()||n.val()?o.onActionProduct.call(e,i.val(),n.val()):((t=n.is(":visible")?n:i).addClass("empty-name-wishlist"),window.setTimeout(function(){t.removeClass("empty-name-wishlist")},1e3))})}r(this).off("click").on("click",o.onClick),o.onInited.call(this,o)})},r(document).ready(function(){r("body").on("click",".tinvwl_add_to_wishlist_button",function(t){if(r(this).is(".disabled-add-wishlist"))return t.preventDefault(),void window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);r(this).is(".inited-add-wishlist")||r(this).tinvwl_to_wishlist({onInited:function(t){r(this).addClass("inited-add-wishlist"),t.onClick.call(this)}})}),r(".variations_form").each(function(){var t=r(this),s=t.find(".tinvwl_add_to_wishlist_button");s.length&&t.on("hide_variation",function(t){t.preventDefault(),s.addClass("disabled-add-wishlist")}).on("show_variation",function(t,i,n){var e=JSON.parse(s.attr("data-tinv-wl-list")),o=!1,a="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var l in e)e[l].hasOwnProperty("in")&&Array.isArray(e[l].in)&&-1<(e[l].in||[]).indexOf(i.variation_id)&&(o=!0);s.toggleClass("tinvwl-product-in-list",o).toggleClass("tinvwl-product-make-remove",o&&a).attr("data-tinv-wl-action",o&&a?"remove":"addto"),t.preventDefault(),s.removeClass("disabled-add-wishlist")})})})}(jQuery),function(e){e.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return e(this).val()},rule:function(){var t=e(this).parents("form").eq(0).find(n.selector),i=n.invert;return 0===t.length?n.ifempty:(t.each(function(){i&&!n.invert||!i&&n.invert||(i=Boolean(n.validate.call(e(this))))}),i)}},n=e.extend(!0,{},i,t);return e(this).each(function(){e(this).on("click",function(t){n.rule.call(e(this))||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault())})})},e(document).ready(function(){e(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),e(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return e(this).is(":checked")}}),e(".global-cb").on("click",function(){e(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",e(this).is(":checked"))})})}(jQuery),function(n){n(document).ready(function(){n("#tinvwl_manage_actions, #tinvwl_product_actions").addClass("form-control").parent().wrapInner('<div class="tinvwl-input-group tinvwl-no-full">').find("button").wrap('<span class="tinvwl-input-group-btn">'),n(".tinv-lists-nav").each(function(){n.trim(n(this).html()).length||n(this).remove()}),n("body").on("click",".social-buttons .social[title!=email]",function(t){var i=window.open(n(this).attr("href"),n(this).attr("title"),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");i&&(i.focus(),t.preventDefault())}),n("body").on("click",".tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close",function(t){t.preventDefault(),n(this).parents(".tinv-modal:first").removeClass("tinv-modal-open")}),n("body").on("click",".tinv-wishlist .tinvwl-btn-onclick",function(t){n(this).data("url")&&(t.preventDefault(),window.location=n(this).data("url"))});var t=n(".tinv-wishlist .navigation-button");t.length&&t.each(function(){var t=n(this).find("> li");t.length<5&&t.parent().addClass("tinvwl-btns-count-"+t.length)}),n(".tinv-login .showlogin").unbind("click").on("click",function(t){t.preventDefault(),n(this).closest(".tinv-login").find(".login").toggle()}),n(".tinv-wishlist table.tinvwl-table-manage-list tfoot td").each(function(){n(this).toggle(!!n(this).children().not(".look_in").length||!!n(this).children(".look_in").children().length)})}),n(document.body).on("wc_fragments_refreshed wc_fragments_loaded",function(){n(".wishlist_products_counter").toggleClass("wishlist-counter-with-products","0"!=n(".wishlist_products_counter_number").html())}),n(window).on("load",function(){n(".tinv-wishlist.woocommerce").length&&n(".woocommerce-message").length&&(n(document.body).on("wc_fragments_refreshed.wishlist",function(){if("undefined"==typeof wc_cart_fragments_params)return!1;cart_hash_key=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash",localStorage.setItem(cart_hash_key,localStorage.getItem(cart_hash_key)+(new Date).getTime()),sessionStorage.setItem(cart_hash_key,sessionStorage.getItem(cart_hash_key)+(new Date).getTime()),n(document.body).off("wc_fragments_refreshed.wishlist")}),n(document.body).trigger("updated_wc_div"))})}(jQuery);
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.10
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
5 |
|
6 |
+
!function(r){r.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href,text_create:window.tinvwl_add_to_wishlist.text_create,text_already_in:window.tinvwl_add_to_wishlist.text_already_in,class:{dialogbox:".tinvwl_add_to_select_wishlist",select:".tinvwl_wishlist",newtitle:".tinvwl_new_input",dialogbutton:".tinvwl_button_add"},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){r("body > .tinv-wishlist").length||r("body").append(r("<div>").addClass("tinv-wishlist")),r(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){r(this).append(r("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(){r(this).addClass("tinv-modal-open")},onDialogHide:function(){r(this).removeClass("tinv-modal-open")},onInited:function(){},onClick:function(){if(r(this).is(".disabled-add-wishlist"))return!1;this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):o.onActionProduct.call(this)},onPrepareDataAction:function(){},filterProductAlreadyIn:function(t){t=t||[];var e={};return r("form.cart[method=post], .woocommerce-variation-add-to-cart").find("input, select").each(function(){var t=r(this).attr("name"),i=r(this).attr("type"),n=r(this).val();"checkbox"===i||"radio"===i?r(this).is(":checked")&&(e["form"+t]=n):e["form"+t]=n}),e=e.formvariation_id,t.filter(function(t){if("object"==typeof t.in&&"string"==typeof e){var i=parseInt(e);return 0<=t.in.indexOf(i)}return t.in})},onMultiProductAlreadyIn:function(t){t=t||[];t=o.onPrepareList.call(t)||t,t=o.filterProductAlreadyIn.call(this,t)||t,r(this).parent().parent().find(".already-in").remove();var n="";switch(t.length){case 0:break;default:n=r("<ul>");r.each(t,function(t,i){n.append(r("<li>").html(r("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}n.length&&r(this).closest(".tinv-modal-inner").find("img").after(r("<div>").addClass("already-in").html(o.text_already_in+" ").append(n))},onAction:{redirect:function(t){o.redirectTimer&&clearTimeout(o.redirectTimer),o.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(t){r(this).attr("data-tinv-wl-list",t)},msg:function(t){if(!t)return!1;var i=r(t).eq(0);r("body > .tinv-wishlist").length||r("body").append(r("<div>").addClass("tinv-wishlist")),r("body > .tinv-wishlist").append(i),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),o.redirectTimer&&clearTimeout(o.redirectTimer)})},status:function(t){t&&r(this).addClass("tinvwl-product-in-list")},removed:function(t){t&&r(this).removeClass("tinvwl-product-in-list").removeClass("tinvwl-product-make-remove").attr("data-tinv-wl-action","addto")},make_remove:function(t){r(this).toggleClass("tinvwl-product-make-remove",t).attr("data-tinv-wl-action",t?"remove":"addto")},fragments:function(t){if("undefined"==typeof wc_cart_fragments_params)return r.each(t,function(t,i){r(t).replaceWith(i)}),!1;var i;try{i="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("wc","test"),window.sessionStorage.removeItem("wc"),window.localStorage.setItem("wc","test"),window.localStorage.removeItem("wc")}catch(t){i=!1}if(i)try{var n=r.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),e=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash",o=sessionStorage.getItem(e),a=Cookies.get("woocommerce_cart_hash"),l=sessionStorage.getItem("wc_cart_created");if(null!=o&&""!==o||(o=""),null!=a&&""!==a||(a=""),o&&(null==l||""===l))throw"No cart_created";if(r.each(t,function(t,i){n[t]=i}),localStorage.setItem(e,localStorage.getItem(e)+(new Date).getTime()),sessionStorage.setItem(e,sessionStorage.getItem(e)+(new Date).getTime()),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(n)),!n||!n["div.widget_shopping_cart_content"]||o!==a)throw"No fragment";r.each(n,function(t,i){r(t).replaceWith(i)}),r(document.body).trigger("wc_fragments_loaded")}catch(t){r(document.body).trigger("wc_fragment_refresh")}}},onActionProduct:function(t,i){var s={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:r(this).attr("data-tinv-wl-producttype"),product_id:r(this).attr("data-tinv-wl-product")||0,product_variation:r(this).attr("data-tinv-wl-productvariation")||0,product_action:r(this).attr("data-tinv-wl-action")||"addto"},n=this;r(n).closest("form.cart[method=post], .tinvwl-loop-button-wrapper").find("input, select, textarea").each(function(){var t=r(this).attr("name"),i=r(this).attr("type"),n=r(this).val(),e=10,o=function(t,i){if("object"==typeof i){for(var n in void 0===t&&(t={}),i)if(""===n){var e=-1;for(e in t)e=e;t[e=parseInt(e)+1]=o(t[n],i[n])}else t[n]=o(t[n],i[n]);return t}return i};if("button"!==i&&void 0!==t&&"attribute_"!=t.substr(0,10)){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<e;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=n,n=l}t=a[1],e--}"checkbox"===i||"radio"===i?r(this).is(":checked")&&(n.length||"object"==typeof n||(n=!0),s.form[t]=o(s.form[t],n)):s.form[t]=o(s.form[t],n)}}),s=o.onPrepareDataAction.call(n,s)||s,r.post(o.api_url,s,function(t){if(o.onDialogHide.call(n.tinvwl_dialog),"object"==typeof t)for(var i in t)"function"==typeof o.onAction[i]&&o.onAction[i].call(n,t[i]);else"function"==typeof o.onAction.msg&&o.onAction.msg.call(n,t)})}},o=r.extend(!0,{},i,t);return r(this).each(function(){if(!r(this).attr("data-tinv-wl-list"))return!1;if(o.dialogbox&&o.dialogbox.length&&(this.tinvwl_dialog=o.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=o.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=r(this).nextAll(o.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){o.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=r(this).find(o.class.select).eq(0);r(this).find(o.class.newtitle).hide().val(""),n.html(""),r.each(t,function(t,i){o.onCreateWishList.call(n,i)}),o.text_create&&o.onCreateWishList.call(n,{ID:"",title:o.text_create,in:!1}),o.onMultiProductAlreadyIn.call(n,t),o.onSelectWishList.call(n,t),r(this).find(o.class.newtitle).toggle(""===n.val())}),"function"!=typeof this.tinvwl_dialog.show_list&&(this.tinvwl_dialog.show_list=function(){var t=r.parseJSON(r(this).attr("data-tinv-wl-list"))||[];t.length?(t=o.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),o.onDialogShow.call(this.tinvwl_dialog)):o.onActionProduct.call(this)});var e=this;r(this.tinvwl_dialog).find(o.class.dialogbutton).off("click").on("click",function(){var t,i=r(e.tinvwl_dialog).find(o.class.select),n=r(e.tinvwl_dialog).find(o.class.newtitle);i.val()||n.val()?o.onActionProduct.call(e,i.val(),n.val()):((t=n.is(":visible")?n:i).addClass("empty-name-wishlist"),window.setTimeout(function(){t.removeClass("empty-name-wishlist")},1e3))})}r(this).off("click").on("click",o.onClick),o.onInited.call(this,o)})},r(document).ready(function(){r("body").on("click",".tinvwl_add_to_wishlist_button",function(t){if(r(this).is(".disabled-add-wishlist"))return t.preventDefault(),void window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);r(this).is(".inited-add-wishlist")||r(this).tinvwl_to_wishlist({onInited:function(t){r(this).addClass("inited-add-wishlist"),t.onClick.call(this)}})}),r(".variations_form").each(function(){var t=r(this),s=t.find(".tinvwl_add_to_wishlist_button");s.length&&t.on("hide_variation",function(t){t.preventDefault(),s.addClass("disabled-add-wishlist")}).on("show_variation",function(t,i,n){var e=JSON.parse(s.attr("data-tinv-wl-list")),o=!1,a="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var l in e)e[l].hasOwnProperty("in")&&Array.isArray(e[l].in)&&-1<(e[l].in||[]).indexOf(i.variation_id)&&(o=!0);s.toggleClass("tinvwl-product-in-list",o).toggleClass("tinvwl-product-make-remove",o&&a).attr("data-tinv-wl-action",o&&a?"remove":"addto"),t.preventDefault(),s.removeClass("disabled-add-wishlist")})})})}(jQuery),function(e){e.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return e(this).val()},rule:function(){var t=e(this).parents("form").eq(0).find(n.selector),i=n.invert;return 0===t.length?n.ifempty:(t.each(function(){i&&!n.invert||!i&&n.invert||(i=Boolean(n.validate.call(e(this))))}),i)}},n=e.extend(!0,{},i,t);return e(this).each(function(){e(this).on("click",function(t){n.rule.call(e(this))||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault())})})},e(document).ready(function(){e(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),e(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return e(this).is(":checked")}}),e(".global-cb").on("click",function(){e(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",e(this).is(":checked"))})})}(jQuery),function(n){n(document).ready(function(){n("#tinvwl_manage_actions, #tinvwl_product_actions").addClass("form-control").parent().wrapInner('<div class="tinvwl-input-group tinvwl-no-full">').find("button").wrap('<span class="tinvwl-input-group-btn">'),n(".tinv-lists-nav").each(function(){n.trim(n(this).html()).length||n(this).remove()}),n("body").on("click",".social-buttons .social[title!=email]",function(t){var i=window.open(n(this).attr("href"),n(this).attr("title"),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");i&&(i.focus(),t.preventDefault())}),n("body").on("click",".tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close",function(t){t.preventDefault(),n(this).parents(".tinv-modal:first").removeClass("tinv-modal-open")}),n("body").on("click",".tinv-wishlist .tinvwl-btn-onclick",function(t){n(this).data("url")&&(t.preventDefault(),window.location=n(this).data("url"))});var t=n(".tinv-wishlist .navigation-button");t.length&&t.each(function(){var t=n(this).find("> li");t.length<5&&t.parent().addClass("tinvwl-btns-count-"+t.length)}),n(".tinv-login .showlogin").unbind("click").on("click",function(t){t.preventDefault(),n(this).closest(".tinv-login").find(".login").toggle()}),n(".tinv-wishlist table.tinvwl-table-manage-list tfoot td").each(function(){n(this).toggle(!!n(this).children().not(".look_in").length||!!n(this).children(".look_in").children().length)})}),n(document.body).on("wc_fragments_refreshed wc_fragments_loaded",function(){n(".wishlist_products_counter").toggleClass("wishlist-counter-with-products","0"!=n(".wishlist_products_counter_number").html())})}(jQuery);
|
includes/update.helper.php
CHANGED
@@ -170,10 +170,14 @@ class TInvWL_Update {
|
|
170 |
* Clean up empty wishlists.
|
171 |
*/
|
172 |
function up_p_1_8_9() {
|
173 |
-
|
|
|
|
|
174 |
tinv_update_option( 'add_to_wishlist_catalog', 'class', 'button tinvwl-button' );
|
175 |
}
|
176 |
-
|
|
|
|
|
177 |
tinv_update_option( 'add_to_wishlist', 'class', 'button tinvwl-button' );
|
178 |
}
|
179 |
}
|
170 |
* Clean up empty wishlists.
|
171 |
*/
|
172 |
function up_p_1_8_9() {
|
173 |
+
|
174 |
+
$class = tinv_get_option( 'add_to_wishlist_catalog', 'class' );
|
175 |
+
if ( 'button' == tinv_get_option( 'add_to_wishlist_catalog', 'type' ) && empty( $class ) ) {
|
176 |
tinv_update_option( 'add_to_wishlist_catalog', 'class', 'button tinvwl-button' );
|
177 |
}
|
178 |
+
|
179 |
+
$class = tinv_get_option( 'add_to_wishlist', 'class' );
|
180 |
+
if ( 'button' == tinv_get_option( 'add_to_wishlist', 'type' ) && empty( $class ) ) {
|
181 |
tinv_update_option( 'add_to_wishlist', 'class', 'button tinvwl-button' );
|
182 |
}
|
183 |
}
|
languages/ti-woocommerce-wishlist.pot
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Wishlist Plugin 1.8.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/ti-woocommerce-wishlist\n"
|
8 |
-
"POT-Creation-Date: 2018-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -953,7 +953,7 @@ msgstr ""
|
|
953 |
msgid "Action"
|
954 |
msgstr ""
|
955 |
|
956 |
-
#: public/wishlist/buttons.class.php:
|
957 |
msgid ""
|
958 |
"Product %s could not be added to cart because some options are not "
|
959 |
"specified. Please, select some product options before adding the products "
|
@@ -965,41 +965,41 @@ msgid_plural ""
|
|
965 |
msgstr[0] ""
|
966 |
msgstr[1] ""
|
967 |
|
968 |
-
#: public/wishlist/buttons.class.php:
|
969 |
msgid "Actions"
|
970 |
msgstr ""
|
971 |
|
972 |
-
#: public/wishlist/buttons.class.php:
|
973 |
msgid "Remove"
|
974 |
msgstr ""
|
975 |
|
976 |
-
#: public/wishlist/buttons.class.php:
|
977 |
msgid "“%s”"
|
978 |
msgstr ""
|
979 |
|
980 |
-
#: public/wishlist/buttons.class.php:
|
981 |
msgid "%s has been successfully removed from wishlist."
|
982 |
msgid_plural "%s have been successfully removed from wishlist."
|
983 |
msgstr[0] ""
|
984 |
msgstr[1] ""
|
985 |
|
986 |
-
#: public/wishlist/view.class.php:
|
987 |
msgid "%s has been removed from wishlist."
|
988 |
msgstr ""
|
989 |
|
990 |
-
#: public/wishlist/view.class.php:
|
991 |
msgid "%s has not been removed from wishlist."
|
992 |
msgstr ""
|
993 |
|
994 |
-
#: public/wishlist/view.class.php:
|
995 |
msgid "Return to Wishlist"
|
996 |
msgstr ""
|
997 |
|
998 |
-
#: public/wishlist/view.class.php:
|
999 |
msgid "Previous Page"
|
1000 |
msgstr ""
|
1001 |
|
1002 |
-
#: public/wishlist/view.class.php:
|
1003 |
msgid "Next Page"
|
1004 |
msgstr ""
|
1005 |
|
@@ -1329,7 +1329,7 @@ msgstr ""
|
|
1329 |
msgid "https://templateinvaders.com/"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
-
#: public/wishlist/buttons.class.php:
|
1333 |
msgctxt "Item name in quotes"
|
1334 |
msgid "“%s”"
|
1335 |
msgstr ""
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Wishlist Plugin 1.8.10\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/ti-woocommerce-wishlist\n"
|
8 |
+
"POT-Creation-Date: 2018-08-14 07:15:40+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
953 |
msgid "Action"
|
954 |
msgstr ""
|
955 |
|
956 |
+
#: public/wishlist/buttons.class.php:298 public/wishlist/buttons.class.php:413
|
957 |
msgid ""
|
958 |
"Product %s could not be added to cart because some options are not "
|
959 |
"specified. Please, select some product options before adding the products "
|
965 |
msgstr[0] ""
|
966 |
msgstr[1] ""
|
967 |
|
968 |
+
#: public/wishlist/buttons.class.php:316
|
969 |
msgid "Actions"
|
970 |
msgstr ""
|
971 |
|
972 |
+
#: public/wishlist/buttons.class.php:325
|
973 |
msgid "Remove"
|
974 |
msgstr ""
|
975 |
|
976 |
+
#: public/wishlist/buttons.class.php:457 public/wishlist/view.class.php:308
|
977 |
msgid "“%s”"
|
978 |
msgstr ""
|
979 |
|
980 |
+
#: public/wishlist/buttons.class.php:470
|
981 |
msgid "%s has been successfully removed from wishlist."
|
982 |
msgid_plural "%s have been successfully removed from wishlist."
|
983 |
msgstr[0] ""
|
984 |
msgstr[1] ""
|
985 |
|
986 |
+
#: public/wishlist/view.class.php:318
|
987 |
msgid "%s has been removed from wishlist."
|
988 |
msgstr ""
|
989 |
|
990 |
+
#: public/wishlist/view.class.php:320
|
991 |
msgid "%s has not been removed from wishlist."
|
992 |
msgstr ""
|
993 |
|
994 |
+
#: public/wishlist/view.class.php:451
|
995 |
msgid "Return to Wishlist"
|
996 |
msgstr ""
|
997 |
|
998 |
+
#: public/wishlist/view.class.php:546
|
999 |
msgid "Previous Page"
|
1000 |
msgstr ""
|
1001 |
|
1002 |
+
#: public/wishlist/view.class.php:555
|
1003 |
msgid "Next Page"
|
1004 |
msgstr ""
|
1005 |
|
1329 |
msgid "https://templateinvaders.com/"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
+
#: public/wishlist/buttons.class.php:295 public/wishlist/buttons.class.php:410
|
1333 |
msgctxt "Item name in quotes"
|
1334 |
msgid "“%s”"
|
1335 |
msgstr ""
|
public/addtowishlist.class.php
CHANGED
@@ -563,7 +563,7 @@ class TInvWL_Public_AddToWishlist {
|
|
563 |
$icon .= $icon_class;
|
564 |
$variation_id = ( ( $this->is_loop && 'variable' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->product_type : $this->product->get_type() ) ) ? $this->variation_id : ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->variation_id : ( $this->product->is_type( 'variation' ) ? $this->product->get_id() : 0 ) ) );
|
565 |
foreach ( $this->wishlist as $value ) {
|
566 |
-
if ( $value['in'] ) {
|
567 |
$icon .= ' tinvwl-product-in-list';
|
568 |
if ( tinv_get_option( 'general', 'simple_flow' ) ) {
|
569 |
if ( $this->is_loop ) {
|
563 |
$icon .= $icon_class;
|
564 |
$variation_id = ( ( $this->is_loop && 'variable' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->product_type : $this->product->get_type() ) ) ? $this->variation_id : ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->variation_id : ( $this->product->is_type( 'variation' ) ? $this->product->get_id() : 0 ) ) );
|
565 |
foreach ( $this->wishlist as $value ) {
|
566 |
+
if ( $value['in'] && in_array( $variation_id, $value['in'] ) ) {
|
567 |
$icon .= ' tinvwl-product-in-list';
|
568 |
if ( tinv_get_option( 'general', 'simple_flow' ) ) {
|
569 |
if ( $this->is_loop ) {
|
public/wishlist/buttons.class.php
CHANGED
@@ -260,24 +260,33 @@ class TInvWL_Public_Wishlist_Buttons {
|
|
260 |
public static function add_all( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
|
261 |
$products = self::get_current_products( $wishlist );
|
262 |
$result = $errors = array();
|
263 |
-
foreach ( $products as $
|
264 |
-
$product_data = wc_get_product( $
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
|
266 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
267 |
$redirect_url = $product_data->add_to_cart_url();
|
268 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
269 |
|
270 |
-
|
271 |
-
|
|
|
|
|
|
|
272 |
continue;
|
273 |
}
|
274 |
-
$
|
275 |
-
$quantity = array_key_exists( $
|
276 |
-
$add = TInvWL_Public_Cart::add( $wishlist, $
|
277 |
if ( $add ) {
|
278 |
$result = tinv_array_merge( $result, $add );
|
279 |
} else {
|
280 |
-
$errors[] = $
|
281 |
}
|
282 |
}
|
283 |
if ( ! empty( $errors ) ) {
|
@@ -357,31 +366,42 @@ class TInvWL_Public_Wishlist_Buttons {
|
|
357 |
public static function apply_action_add_selected( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
|
358 |
if ( ! empty( $selected ) ) {
|
359 |
$result = $errors = array();
|
360 |
-
foreach ( $selected as $
|
361 |
$wlp = null;
|
362 |
if ( 0 === $wishlist['ID'] ) {
|
363 |
$wlp = TInvWL_Product_Local::instance();
|
364 |
} else {
|
365 |
$wlp = new TInvWL_Product( $wishlist );
|
366 |
}
|
367 |
-
$_product = $wlp->get_wishlist( array( 'ID' => $
|
368 |
$_product = array_shift( $_product );
|
369 |
if ( ! empty( $_product ) && ! empty( $_product['data'] ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
371 |
$redirect_url = $_product['data']->add_to_cart_url();
|
372 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
373 |
|
|
|
|
|
|
|
|
|
374 |
if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $_product['data'], $redirect_url, $_product ) ) {
|
375 |
$errors[] = $_product['product_id'];
|
376 |
continue;
|
377 |
}
|
378 |
}
|
379 |
-
$quantity = array_key_exists( $
|
380 |
-
$add = TInvWL_Public_Cart::add( $wishlist, $
|
381 |
if ( $add ) {
|
382 |
$result = tinv_array_merge( $result, $add );
|
383 |
} else {
|
384 |
-
$errors[] = $
|
385 |
}
|
386 |
}
|
387 |
if ( ! empty( $errors ) ) {
|
@@ -439,13 +459,17 @@ class TInvWL_Public_Wishlist_Buttons {
|
|
439 |
}
|
440 |
|
441 |
if ( ! empty( $titles ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
wc_add_notice( sprintf( _n( '%s has been successfully removed from wishlist.', '%s have been successfully removed from wishlist.', count( $titles ), 'ti-woocommerce-wishlist' ), wc_format_list_of_items( $titles ) ) );
|
443 |
}
|
444 |
|
445 |
-
if ( ! is_user_logged_in() && ! empty( $titles2 ) ) {
|
446 |
-
wp_safe_redirect( tinv_url_wishlist() );
|
447 |
-
}
|
448 |
-
|
449 |
return true;
|
450 |
}
|
451 |
|
260 |
public static function add_all( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
|
261 |
$products = self::get_current_products( $wishlist );
|
262 |
$result = $errors = array();
|
263 |
+
foreach ( $products as $_product ) {
|
264 |
+
$product_data = wc_get_product( $_product['variation_id'] ? $_product['variation_id'] : $_product['product_id'] );
|
265 |
+
|
266 |
+
global $product;
|
267 |
+
// store global product data.
|
268 |
+
$_product_tmp = $product;
|
269 |
+
// override global product data.
|
270 |
+
$product = $product_data;
|
271 |
|
272 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
273 |
$redirect_url = $product_data->add_to_cart_url();
|
274 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
275 |
|
276 |
+
// restore global product data.
|
277 |
+
$product = $_product_tmp;
|
278 |
+
|
279 |
+
if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $product_data, $redirect_url, $_product ) ) {
|
280 |
+
$errors[] = $_product['product_id'];
|
281 |
continue;
|
282 |
}
|
283 |
+
$_product = $_product['ID'];
|
284 |
+
$quantity = array_key_exists( $_product, (array) $_quantity ) ? $_quantity[ $_product ] : 1;
|
285 |
+
$add = TInvWL_Public_Cart::add( $wishlist, $_product, $quantity );
|
286 |
if ( $add ) {
|
287 |
$result = tinv_array_merge( $result, $add );
|
288 |
} else {
|
289 |
+
$errors[] = $_product['product_id'];
|
290 |
}
|
291 |
}
|
292 |
if ( ! empty( $errors ) ) {
|
366 |
public static function apply_action_add_selected( $wishlist, $selected = array(), $_quantity = array(), $owner = false ) {
|
367 |
if ( ! empty( $selected ) ) {
|
368 |
$result = $errors = array();
|
369 |
+
foreach ( $selected as $id ) {
|
370 |
$wlp = null;
|
371 |
if ( 0 === $wishlist['ID'] ) {
|
372 |
$wlp = TInvWL_Product_Local::instance();
|
373 |
} else {
|
374 |
$wlp = new TInvWL_Product( $wishlist );
|
375 |
}
|
376 |
+
$_product = $wlp->get_wishlist( array( 'ID' => $id ) );
|
377 |
$_product = array_shift( $_product );
|
378 |
if ( ! empty( $_product ) && ! empty( $_product['data'] ) ) {
|
379 |
+
|
380 |
+
global $product;
|
381 |
+
// store global product data.
|
382 |
+
$_product_tmp = $product;
|
383 |
+
// override global product data.
|
384 |
+
$product = $_product['data'];
|
385 |
+
|
386 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
387 |
$redirect_url = $_product['data']->add_to_cart_url();
|
388 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
389 |
|
390 |
+
|
391 |
+
// restore global product data.
|
392 |
+
$product = $_product_tmp;
|
393 |
+
|
394 |
if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $_product['data'], $redirect_url, $_product ) ) {
|
395 |
$errors[] = $_product['product_id'];
|
396 |
continue;
|
397 |
}
|
398 |
}
|
399 |
+
$quantity = array_key_exists( $id, (array) $_quantity ) ? $_quantity[ $id ] : 1;
|
400 |
+
$add = TInvWL_Public_Cart::add( $wishlist, $id, $quantity );
|
401 |
if ( $add ) {
|
402 |
$result = tinv_array_merge( $result, $add );
|
403 |
} else {
|
404 |
+
$errors[] = $id['product_id'];
|
405 |
}
|
406 |
}
|
407 |
if ( ! empty( $errors ) ) {
|
459 |
}
|
460 |
|
461 |
if ( ! empty( $titles ) ) {
|
462 |
+
add_action( 'tinvwl_before_wishlist', array(
|
463 |
+
'TInvWL_Public_Wishlist_View',
|
464 |
+
'check_cart_hash'
|
465 |
+
), 99, 1 );
|
466 |
+
add_action( 'woocommerce_set_cart_cookies', array(
|
467 |
+
'TInvWL_Public_Wishlist_View',
|
468 |
+
'reset_cart_hash'
|
469 |
+
), 199, 1 );
|
470 |
wc_add_notice( sprintf( _n( '%s has been successfully removed from wishlist.', '%s have been successfully removed from wishlist.', count( $titles ), 'ti-woocommerce-wishlist' ), wc_format_list_of_items( $titles ) ) );
|
471 |
}
|
472 |
|
|
|
|
|
|
|
|
|
473 |
return true;
|
474 |
}
|
475 |
|
public/wishlist/view.class.php
CHANGED
@@ -72,6 +72,8 @@ class TInvWL_Public_Wishlist_View {
|
|
72 |
* Defined shortcode and hooks
|
73 |
*/
|
74 |
function define_hooks() {
|
|
|
|
|
75 |
add_action( 'wp', array( $this, 'wishlist_action' ), 0 );
|
76 |
|
77 |
add_action( 'tinvwl_before_wishlist', array( $this, 'wishlist_header' ) );
|
@@ -86,6 +88,17 @@ class TInvWL_Public_Wishlist_View {
|
|
86 |
TInvWL_Public_Wishlist_Buttons::init( $this->_name );
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
/**
|
90 |
* Change Text for external product
|
91 |
*
|
@@ -294,6 +307,14 @@ class TInvWL_Public_Wishlist_View {
|
|
294 |
}
|
295 |
$title = sprintf( __( '“%s”', 'ti-woocommerce-wishlist' ), $product_data['data']->get_title() );
|
296 |
if ( $wlp->remove( $product_data ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
wc_add_notice( sprintf( __( '%s has been removed from wishlist.', 'ti-woocommerce-wishlist' ), $title ) );
|
298 |
} else {
|
299 |
wc_add_notice( sprintf( __( '%s has not been removed from wishlist.', 'ti-woocommerce-wishlist' ), $title ), 'error' );
|
@@ -304,6 +325,37 @@ class TInvWL_Public_Wishlist_View {
|
|
304 |
do_action( 'tinvwl_action_' . $post['tinvwl-action'], $wishlist, $post['wishlist_pr'], $post['wishlist_qty'], $owner ); // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidHookName.UseUnderscores
|
305 |
}
|
306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
/**
|
308 |
* Apply action add to cart
|
309 |
*
|
@@ -331,18 +383,27 @@ class TInvWL_Public_Wishlist_View {
|
|
331 |
return false;
|
332 |
}
|
333 |
|
334 |
-
$
|
335 |
-
$
|
336 |
-
if ( empty( $
|
337 |
return false;
|
338 |
}
|
339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
341 |
-
$redirect_url = $
|
342 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
343 |
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
346 |
die();
|
347 |
} elseif ( apply_filters( 'tinvwl_allow_addtocart_in_wishlist', true, $wishlist, $owner ) ) {
|
348 |
$add = TInvWL_Public_Cart::add( $wishlist, $id, $quantity );
|
@@ -361,14 +422,14 @@ class TInvWL_Public_Wishlist_View {
|
|
361 |
*
|
362 |
* @param array $atts Array parameter for shortcode.
|
363 |
*
|
364 |
-
* @return
|
365 |
*/
|
366 |
function htmloutput( $atts ) {
|
367 |
$wishlist = $this->get_current_wishlist();
|
368 |
|
369 |
if ( empty( $wishlist ) ) {
|
370 |
$id = get_query_var( 'tinvwlID', null );
|
371 |
-
if ( empty( $id ) && ( is_user_logged_in() || tinv_get_option( 'general', '
|
372 |
return $this->wishlist_empty( array(), array(
|
373 |
'ID' => '',
|
374 |
'author' => get_current_user_id(),
|
72 |
* Defined shortcode and hooks
|
73 |
*/
|
74 |
function define_hooks() {
|
75 |
+
add_action( 'template_redirect', array( $this, 'login_redirect' ) );
|
76 |
+
|
77 |
add_action( 'wp', array( $this, 'wishlist_action' ), 0 );
|
78 |
|
79 |
add_action( 'tinvwl_before_wishlist', array( $this, 'wishlist_header' ) );
|
88 |
TInvWL_Public_Wishlist_Buttons::init( $this->_name );
|
89 |
}
|
90 |
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Redirect guests to login page.
|
94 |
+
*/
|
95 |
+
public function login_redirect() {
|
96 |
+
if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) && ! is_user_logged_in() && tinv_get_option( 'general', 'require_login' ) ) {
|
97 |
+
wp_safe_redirect( wc_get_page_permalink( 'myaccount' ) );
|
98 |
+
exit;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
/**
|
103 |
* Change Text for external product
|
104 |
*
|
307 |
}
|
308 |
$title = sprintf( __( '“%s”', 'ti-woocommerce-wishlist' ), $product_data['data']->get_title() );
|
309 |
if ( $wlp->remove( $product_data ) ) {
|
310 |
+
add_action( 'tinvwl_before_wishlist', array(
|
311 |
+
'TInvWL_Public_Wishlist_View',
|
312 |
+
'check_cart_hash'
|
313 |
+
), 99, 1 );
|
314 |
+
add_action( 'woocommerce_set_cart_cookies', array(
|
315 |
+
'TInvWL_Public_Wishlist_View',
|
316 |
+
'reset_cart_hash'
|
317 |
+
), 99, 1 );
|
318 |
wc_add_notice( sprintf( __( '%s has been removed from wishlist.', 'ti-woocommerce-wishlist' ), $title ) );
|
319 |
} else {
|
320 |
wc_add_notice( sprintf( __( '%s has not been removed from wishlist.', 'ti-woocommerce-wishlist' ), $title ), 'error' );
|
325 |
do_action( 'tinvwl_action_' . $post['tinvwl-action'], $wishlist, $post['wishlist_pr'], $post['wishlist_qty'], $owner ); // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidHookName.UseUnderscores
|
326 |
}
|
327 |
|
328 |
+
/**
|
329 |
+
* Check cart hash to trigger WC fragments refresh on wishlist update.
|
330 |
+
*
|
331 |
+
* @param $wishlist
|
332 |
+
*/
|
333 |
+
public static function check_cart_hash( $wishlist ) {
|
334 |
+
wp_add_inline_script( 'woocommerce', "
|
335 |
+
jQuery(document).ready(function($){
|
336 |
+
if ( typeof wc_cart_fragments_params === 'undefined' ) {
|
337 |
+
return false;
|
338 |
+
}
|
339 |
+
|
340 |
+
var cart_hash_key = wc_cart_fragments_params.cart_hash_key,
|
341 |
+
cart_hash = sessionStorage.getItem( cart_hash_key );
|
342 |
+
|
343 |
+
if ( cart_hash === null || cart_hash === undefined || cart_hash === '' ) {
|
344 |
+
sessionStorage.setItem( cart_hash_key, 'empty' );
|
345 |
+
}
|
346 |
+
});
|
347 |
+
" );
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Reset cart hash to trigger WC fragments refresh on wishlist update.
|
352 |
+
*
|
353 |
+
* @param bool $set
|
354 |
+
*/
|
355 |
+
public static function reset_cart_hash( $set ) {
|
356 |
+
wc_setcookie( 'woocommerce_cart_hash', 'reset', time() - HOUR_IN_SECONDS );
|
357 |
+
}
|
358 |
+
|
359 |
/**
|
360 |
* Apply action add to cart
|
361 |
*
|
383 |
return false;
|
384 |
}
|
385 |
|
386 |
+
$_product = $wlp->get_wishlist( array( 'ID' => $id ) );
|
387 |
+
$_product = array_shift( $_product );
|
388 |
+
if ( empty( $_product ) || empty( $_product['data'] ) ) {
|
389 |
return false;
|
390 |
}
|
391 |
|
392 |
+
global $product;
|
393 |
+
// store global product data.
|
394 |
+
$_product_tmp = $product;
|
395 |
+
// override global product data.
|
396 |
+
$product = $_product['data'];
|
397 |
+
|
398 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
399 |
+
$redirect_url = $_product['data']->add_to_cart_url();
|
400 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
401 |
|
402 |
+
// restore global product data.
|
403 |
+
$product = $_product_tmp;
|
404 |
+
|
405 |
+
if ( apply_filters( 'tinvwl_product_add_to_cart_need_redirect', false, $_product['data'], $redirect_url, $_product ) ) {
|
406 |
+
wp_redirect( apply_filters( 'tinvwl_product_add_to_cart_redirect_url', $redirect_url, $_product['data'], $_product ) ); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.wp_redirect
|
407 |
die();
|
408 |
} elseif ( apply_filters( 'tinvwl_allow_addtocart_in_wishlist', true, $wishlist, $owner ) ) {
|
409 |
$add = TInvWL_Public_Cart::add( $wishlist, $id, $quantity );
|
422 |
*
|
423 |
* @param array $atts Array parameter for shortcode.
|
424 |
*
|
425 |
+
* @return mixed
|
426 |
*/
|
427 |
function htmloutput( $atts ) {
|
428 |
$wishlist = $this->get_current_wishlist();
|
429 |
|
430 |
if ( empty( $wishlist ) ) {
|
431 |
$id = get_query_var( 'tinvwlID', null );
|
432 |
+
if ( empty( $id ) && ( is_user_logged_in() || ! tinv_get_option( 'general', 'require_login' ) ) ) {
|
433 |
return $this->wishlist_empty( array(), array(
|
434 |
'ID' => '',
|
435 |
'author' => get_current_user_id(),
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://templateinvaders.com/?utm_source=wordpressorg&utm_content=d
|
|
4 |
Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.8.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -130,6 +130,15 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
130 |
|
131 |
|
132 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
= 1.8.9 =
|
134 |
*Release Date - 30 July 2018*
|
135 |
|
4 |
Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.8.10
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
130 |
|
131 |
|
132 |
== Changelog ==
|
133 |
+
= 1.8.10 =
|
134 |
+
*Release Date - 13 August 2018*
|
135 |
+
|
136 |
+
* Fixed "wishlist not found" issue when a guest browsing empty wishlist page
|
137 |
+
* Fixed "product in wishlist" button state for a variable product type
|
138 |
+
* Fixed issue with products counter update on product(s) removed from a wishlist
|
139 |
+
* Fixed fatal errors when 3rd party code using global product object outside a loop
|
140 |
+
* Fixed fatal error in upgrading method for PHP prior 5.5 versions
|
141 |
+
|
142 |
= 1.8.9 =
|
143 |
*Release Date - 30 July 2018*
|
144 |
|
templates/ti-wishlist.php
CHANGED
@@ -1,161 +1,161 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* The Template for displaying wishlist.
|
4 |
-
*
|
5 |
-
* @version 1.8.8
|
6 |
-
* @package TInvWishlist\Template
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit; // Exit if accessed directly.
|
11 |
-
}
|
12 |
-
wp_enqueue_script( 'tinvwl' );
|
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' ) ) {
|
17 |
-
wc_print_notices();
|
18 |
-
} ?>
|
19 |
-
<form action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
|
20 |
-
<?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
|
21 |
-
<table class="tinvwl-table-manage-list">
|
22 |
-
<thead>
|
23 |
-
<tr>
|
24 |
-
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
|
25 |
-
<th class="product-cb"><input type="checkbox" class="global-cb"></th>
|
26 |
-
<?php } ?>
|
27 |
-
<th class="product-remove"></th>
|
28 |
-
<th class="product-thumbnail"> </th>
|
29 |
-
<th class="product-name"><span
|
30 |
-
class="tinvwl-full"><?php esc_html_e( 'Product Name', 'ti-woocommerce-wishlist' ); ?></span><span
|
31 |
-
class="tinvwl-mobile"><?php esc_html_e( 'Product', 'ti-woocommerce-wishlist' ); ?></span></th>
|
32 |
-
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
|
33 |
-
<th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
|
34 |
-
<?php } ?>
|
35 |
-
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
|
36 |
-
<th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
|
37 |
-
<?php } ?>
|
38 |
-
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
|
39 |
-
<th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
|
40 |
-
<?php } ?>
|
41 |
-
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
|
42 |
-
<th class="product-action"> </th>
|
43 |
-
<?php } ?>
|
44 |
-
</tr>
|
45 |
-
</thead>
|
46 |
-
<tbody>
|
47 |
-
<?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
|
48 |
-
|
49 |
-
<?php
|
50 |
-
foreach ( $products as $wl_product ) {
|
51 |
-
$product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
|
52 |
-
unset( $wl_product['data'] );
|
53 |
-
if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
|
54 |
-
$product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
|
55 |
-
do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
|
56 |
-
?>
|
57 |
-
<tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
|
58 |
-
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
|
59 |
-
<td class="product-cb">
|
60 |
-
<?php
|
61 |
-
echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
|
62 |
-
'<input type="checkbox" name="wishlist_pr[]" value="%d">', esc_attr( $wl_product['ID'] )
|
63 |
-
), $wl_product, $product );
|
64 |
-
?>
|
65 |
-
</td>
|
66 |
-
<?php } ?>
|
67 |
-
<td class="product-remove">
|
68 |
-
<button type="submit" name="tinvwl-remove"
|
69 |
-
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i class="ftinvwl ftinvwl-times"></i>
|
70 |
-
</button>
|
71 |
-
</td>
|
72 |
-
<td class="product-thumbnail">
|
73 |
-
<?php
|
74 |
-
$thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
|
75 |
-
|
76 |
-
if ( ! $product->is_visible() ) {
|
77 |
-
echo $thumbnail; // WPCS: xss ok.
|
78 |
-
} else {
|
79 |
-
printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
|
80 |
-
}
|
81 |
-
?>
|
82 |
-
</td>
|
83 |
-
<td class="product-name">
|
84 |
-
<?php
|
85 |
-
if ( ! $product->is_visible() ) {
|
86 |
-
echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . ' '; // WPCS: xss ok.
|
87 |
-
} else {
|
88 |
-
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.
|
89 |
-
}
|
90 |
-
|
91 |
-
echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
|
92 |
-
?>
|
93 |
-
</td>
|
94 |
-
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
|
95 |
-
<td class="product-price">
|
96 |
-
<?php
|
97 |
-
echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
|
98 |
-
?>
|
99 |
-
</td>
|
100 |
-
<?php } ?>
|
101 |
-
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
|
102 |
-
<td class="product-date">
|
103 |
-
<?php
|
104 |
-
echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
|
105 |
-
'<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
|
106 |
-
), $wl_product, $product );
|
107 |
-
?>
|
108 |
-
</td>
|
109 |
-
<?php } ?>
|
110 |
-
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
|
111 |
-
<td class="product-stock">
|
112 |
-
<?php
|
113 |
-
$availability = (array) $product->get_availability();
|
114 |
-
if ( ! array_key_exists( 'availability', $availability ) ) {
|
115 |
-
$availability['availability'] = '';
|
116 |
-
}
|
117 |
-
if ( ! array_key_exists( 'class', $availability ) ) {
|
118 |
-
$availability['class'] = '';
|
119 |
-
}
|
120 |
-
$availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-'.(('out-of-stock' === esc_attr( $availability['class'] )? 'times':'check')).'"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
|
121 |
-
|
122 |
-
echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
|
123 |
-
?>
|
124 |
-
</td>
|
125 |
-
<?php } ?>
|
126 |
-
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
|
127 |
-
<td class="product-action">
|
128 |
-
<?php
|
129 |
-
if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
|
130 |
-
?>
|
131 |
-
<button class="button alt" name="tinvwl-add-to-cart"
|
132 |
-
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i
|
133 |
-
class="ftinvwl ftinvwl-shopping-cart"></i><span
|
134 |
-
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>
|
135 |
-
</button>
|
136 |
-
<?php } ?>
|
137 |
-
</td>
|
138 |
-
<?php } ?>
|
139 |
-
</tr>
|
140 |
-
<?php
|
141 |
-
do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
|
142 |
-
} // End if().
|
143 |
-
} // End foreach().
|
144 |
-
?>
|
145 |
-
<?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
|
146 |
-
</tbody>
|
147 |
-
<tfoot>
|
148 |
-
<tr>
|
149 |
-
<td colspan="100">
|
150 |
-
<?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
|
151 |
-
<?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
|
152 |
-
</td>
|
153 |
-
</tr>
|
154 |
-
</tfoot>
|
155 |
-
</table>
|
156 |
-
</form>
|
157 |
-
<?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
|
158 |
-
<div class="tinv-lists-nav tinv-wishlist-clear">
|
159 |
-
<?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
|
160 |
-
</div>
|
161 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The Template for displaying wishlist.
|
4 |
+
*
|
5 |
+
* @version 1.8.8
|
6 |
+
* @package TInvWishlist\Template
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit; // Exit if accessed directly.
|
11 |
+
}
|
12 |
+
wp_enqueue_script( 'tinvwl' );
|
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' ) ) {
|
17 |
+
wc_print_notices();
|
18 |
+
} ?>
|
19 |
+
<form action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
|
20 |
+
<?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
|
21 |
+
<table class="tinvwl-table-manage-list">
|
22 |
+
<thead>
|
23 |
+
<tr>
|
24 |
+
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
|
25 |
+
<th class="product-cb"><input type="checkbox" class="global-cb"></th>
|
26 |
+
<?php } ?>
|
27 |
+
<th class="product-remove"></th>
|
28 |
+
<th class="product-thumbnail"> </th>
|
29 |
+
<th class="product-name"><span
|
30 |
+
class="tinvwl-full"><?php esc_html_e( 'Product Name', 'ti-woocommerce-wishlist' ); ?></span><span
|
31 |
+
class="tinvwl-mobile"><?php esc_html_e( 'Product', 'ti-woocommerce-wishlist' ); ?></span></th>
|
32 |
+
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
|
33 |
+
<th class="product-price"><?php esc_html_e( 'Unit Price', 'ti-woocommerce-wishlist' ); ?></th>
|
34 |
+
<?php } ?>
|
35 |
+
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
|
36 |
+
<th class="product-date"><?php esc_html_e( 'Date Added', 'ti-woocommerce-wishlist' ); ?></th>
|
37 |
+
<?php } ?>
|
38 |
+
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
|
39 |
+
<th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
|
40 |
+
<?php } ?>
|
41 |
+
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
|
42 |
+
<th class="product-action"> </th>
|
43 |
+
<?php } ?>
|
44 |
+
</tr>
|
45 |
+
</thead>
|
46 |
+
<tbody>
|
47 |
+
<?php do_action( 'tinvwl_wishlist_contents_before' ); ?>
|
48 |
+
|
49 |
+
<?php
|
50 |
+
foreach ( $products as $wl_product ) {
|
51 |
+
$product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
|
52 |
+
unset( $wl_product['data'] );
|
53 |
+
if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
|
54 |
+
$product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
|
55 |
+
do_action( 'tinvwl_wishlist_row_before', $wl_product, $product );
|
56 |
+
?>
|
57 |
+
<tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
|
58 |
+
<?php if ( isset( $wishlist_table['colm_checkbox'] ) && $wishlist_table['colm_checkbox'] ) { ?>
|
59 |
+
<td class="product-cb">
|
60 |
+
<?php
|
61 |
+
echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
|
62 |
+
'<input type="checkbox" name="wishlist_pr[]" value="%d">', esc_attr( $wl_product['ID'] )
|
63 |
+
), $wl_product, $product );
|
64 |
+
?>
|
65 |
+
</td>
|
66 |
+
<?php } ?>
|
67 |
+
<td class="product-remove">
|
68 |
+
<button type="submit" name="tinvwl-remove"
|
69 |
+
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i class="ftinvwl ftinvwl-times"></i>
|
70 |
+
</button>
|
71 |
+
</td>
|
72 |
+
<td class="product-thumbnail">
|
73 |
+
<?php
|
74 |
+
$thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );
|
75 |
+
|
76 |
+
if ( ! $product->is_visible() ) {
|
77 |
+
echo $thumbnail; // WPCS: xss ok.
|
78 |
+
} else {
|
79 |
+
printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
|
80 |
+
}
|
81 |
+
?>
|
82 |
+
</td>
|
83 |
+
<td class="product-name">
|
84 |
+
<?php
|
85 |
+
if ( ! $product->is_visible() ) {
|
86 |
+
echo apply_filters( 'tinvwl_wishlist_item_name', $product->get_title(), $wl_product, $product ) . ' '; // WPCS: xss ok.
|
87 |
+
} else {
|
88 |
+
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.
|
89 |
+
}
|
90 |
+
|
91 |
+
echo apply_filters( 'tinvwl_wishlist_item_meta_data', tinv_wishlist_get_item_data( $product, $wl_product ), $wl_product, $product ); // WPCS: xss ok.
|
92 |
+
?>
|
93 |
+
</td>
|
94 |
+
<?php if ( isset( $wishlist_table_row['colm_price'] ) && $wishlist_table_row['colm_price'] ) { ?>
|
95 |
+
<td class="product-price">
|
96 |
+
<?php
|
97 |
+
echo apply_filters( 'tinvwl_wishlist_item_price', $product->get_price_html(), $wl_product, $product ); // WPCS: xss ok.
|
98 |
+
?>
|
99 |
+
</td>
|
100 |
+
<?php } ?>
|
101 |
+
<?php if ( isset( $wishlist_table_row['colm_date'] ) && $wishlist_table_row['colm_date'] ) { ?>
|
102 |
+
<td class="product-date">
|
103 |
+
<?php
|
104 |
+
echo apply_filters( 'tinvwl_wishlist_item_date', sprintf( // WPCS: xss ok.
|
105 |
+
'<time class="entry-date" datetime="%1$s">%2$s</time>', $wl_product['date'], mysql2date( get_option( 'date_format' ), $wl_product['date'] )
|
106 |
+
), $wl_product, $product );
|
107 |
+
?>
|
108 |
+
</td>
|
109 |
+
<?php } ?>
|
110 |
+
<?php if ( isset( $wishlist_table_row['colm_stock'] ) && $wishlist_table_row['colm_stock'] ) { ?>
|
111 |
+
<td class="product-stock">
|
112 |
+
<?php
|
113 |
+
$availability = (array) $product->get_availability();
|
114 |
+
if ( ! array_key_exists( 'availability', $availability ) ) {
|
115 |
+
$availability['availability'] = '';
|
116 |
+
}
|
117 |
+
if ( ! array_key_exists( 'class', $availability ) ) {
|
118 |
+
$availability['class'] = '';
|
119 |
+
}
|
120 |
+
$availability_html = empty( $availability['availability'] ) ? '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-check"></i></span><span class="tinvwl-txt">' . esc_html__( 'In stock', 'ti-woocommerce-wishlist' ) . '</span></p>' : '<p class="stock ' . esc_attr( $availability['class'] ) . '"><span><i class="ftinvwl ftinvwl-'.(('out-of-stock' === esc_attr( $availability['class'] )? 'times':'check')).'"></i></span><span>' . esc_html( $availability['availability'] ) . '</span></p>';
|
121 |
+
|
122 |
+
echo apply_filters( 'tinvwl_wishlist_item_status', $availability_html, $availability['availability'], $wl_product, $product ); // WPCS: xss ok.
|
123 |
+
?>
|
124 |
+
</td>
|
125 |
+
<?php } ?>
|
126 |
+
<?php if ( isset( $wishlist_table_row['add_to_cart'] ) && $wishlist_table_row['add_to_cart'] ) { ?>
|
127 |
+
<td class="product-action">
|
128 |
+
<?php
|
129 |
+
if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_cart', $wishlist_table_row['add_to_cart'], $wl_product, $product ) ) {
|
130 |
+
?>
|
131 |
+
<button class="button alt" name="tinvwl-add-to-cart"
|
132 |
+
value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i
|
133 |
+
class="ftinvwl ftinvwl-shopping-cart"></i><span
|
134 |
+
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>
|
135 |
+
</button>
|
136 |
+
<?php } ?>
|
137 |
+
</td>
|
138 |
+
<?php } ?>
|
139 |
+
</tr>
|
140 |
+
<?php
|
141 |
+
do_action( 'tinvwl_wishlist_row_after', $wl_product, $product );
|
142 |
+
} // End if().
|
143 |
+
} // End foreach().
|
144 |
+
?>
|
145 |
+
<?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
|
146 |
+
</tbody>
|
147 |
+
<tfoot>
|
148 |
+
<tr>
|
149 |
+
<td colspan="100">
|
150 |
+
<?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
|
151 |
+
<?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
|
152 |
+
</td>
|
153 |
+
</tr>
|
154 |
+
</tfoot>
|
155 |
+
</table>
|
156 |
+
</form>
|
157 |
+
<?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
|
158 |
+
<div class="tinv-lists-nav tinv-wishlist-clear">
|
159 |
+
<?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
|
160 |
+
</div>
|
161 |
+
</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.8.
|
8 |
* Requires at least: 4.5
|
9 |
* Tested up to: 4.9
|
10 |
* WC requires at least: 2.6
|
@@ -41,7 +41,7 @@ if ( ! defined( 'TINVWL_DOMAIN' ) ) {
|
|
41 |
}
|
42 |
|
43 |
if ( ! defined( 'TINVWL_FVERSION' ) ) {
|
44 |
-
define( 'TINVWL_FVERSION', '1.8.
|
45 |
}
|
46 |
|
47 |
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.8.10
|
8 |
* Requires at least: 4.5
|
9 |
* Tested up to: 4.9
|
10 |
* WC requires at least: 2.6
|
41 |
}
|
42 |
|
43 |
if ( ! defined( 'TINVWL_FVERSION' ) ) {
|
44 |
+
define( 'TINVWL_FVERSION', '1.8.10' );
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
|
tinv-wishlists-function.php
CHANGED
@@ -709,28 +709,41 @@ if ( ! function_exists( 'tinvwl_add_to_cart_need_redirect' ) ) {
|
|
709 |
* Check if the product is third-party, or has another link added to the cart then redirect to the product page.
|
710 |
*
|
711 |
* @param boolean $redirect Default value to redirect.
|
712 |
-
* @param \WC_Product $
|
713 |
* @param string $redirect_url Current url for redirect.
|
714 |
*
|
715 |
* @return boolean
|
716 |
*/
|
717 |
-
function tinvwl_add_to_cart_need_redirect( $redirect, $
|
718 |
if ( $redirect ) {
|
719 |
return true;
|
720 |
}
|
721 |
-
|
|
|
722 |
return true;
|
723 |
}
|
724 |
|
725 |
$need_url_data = array_filter( array_merge( array(
|
726 |
-
'variation_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $
|
727 |
-
'add-to-cart' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $
|
728 |
-
), array_map( 'urlencode', ( version_compare( WC_VERSION, '3.0.0', '<' ) ? ( is_array( $
|
729 |
-
|
730 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
731 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
732 |
-
$_redirect_url = apply_filters( '
|
733 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
|
|
|
|
|
|
|
|
734 |
if ( $_redirect_url !== $need_url && $_redirect_url !== $need_url_full ) {
|
735 |
return true;
|
736 |
}
|
709 |
* Check if the product is third-party, or has another link added to the cart then redirect to the product page.
|
710 |
*
|
711 |
* @param boolean $redirect Default value to redirect.
|
712 |
+
* @param \WC_Product $_product Product data.
|
713 |
* @param string $redirect_url Current url for redirect.
|
714 |
*
|
715 |
* @return boolean
|
716 |
*/
|
717 |
+
function tinvwl_add_to_cart_need_redirect( $redirect, $_product, $redirect_url ) {
|
718 |
if ( $redirect ) {
|
719 |
return true;
|
720 |
}
|
721 |
+
|
722 |
+
if ( 'external' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $_product->product_type : $_product->get_type() ) ) {
|
723 |
return true;
|
724 |
}
|
725 |
|
726 |
$need_url_data = array_filter( array_merge( array(
|
727 |
+
'variation_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $_product->variation_id : ( $_product->is_type( 'variation' ) ? $_product->get_id() : 0 ) ),
|
728 |
+
'add-to-cart' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $_product->get_id() : ( $_product->is_type( 'variation' ) ? $_product->get_parent_id() : $_product->get_id() ) ),
|
729 |
+
), array_map( 'urlencode', ( version_compare( WC_VERSION, '3.0.0', '<' ) ? ( is_array( $_product->variation_data ) ? $_product->variation_data : array() ) : array() ) ) ) );
|
730 |
+
|
731 |
+
$need_url = apply_filters( 'woocommerce_product_add_to_cart_url1', remove_query_arg( 'added-to-cart', add_query_arg( $need_url_data ) ), $_product );
|
732 |
+
$need_url_full = apply_filters( 'woocommerce_product_add_to_cart_url1', remove_query_arg( 'added-to-cart', add_query_arg( $need_url_data, $_product->get_permalink() ) ), $_product );
|
733 |
+
|
734 |
+
global $product;
|
735 |
+
// store global product data.
|
736 |
+
$_product_tmp = $product;
|
737 |
+
// override global product data.
|
738 |
+
$product = $_product;
|
739 |
+
|
740 |
add_filter( 'clean_url', 'tinvwl_clean_url', 10, 2 );
|
741 |
+
$_redirect_url = apply_filters( 'tinvwl_product_add_to_cart_redirect_url1', $_product->add_to_cart_url(), $_product );
|
742 |
remove_filter( 'clean_url', 'tinvwl_clean_url', 10 );
|
743 |
+
|
744 |
+
// restore global product data.
|
745 |
+
$product = $_product_tmp;
|
746 |
+
|
747 |
if ( $_redirect_url !== $need_url && $_redirect_url !== $need_url_full ) {
|
748 |
return true;
|
749 |
}
|