Version Description
Release Date - 12 August 2021
- Fixed variable products issue with Polylang plugin
- Fixed product translation issue for WPML plugin when product added to cart from wishlist
Download this release
Release Info
Developer | templateinvaders |
Plugin | WooCommerce Wishlist Plugin |
Version | 1.27.3 |
Comparing to | |
See all releases |
Code changes from version 1.27.2 to 1.27.3
- assets/css/admin-form-rtl.min.css +1 -1
- assets/css/admin-form.min.css +1 -1
- assets/css/admin-rtl.min.css +1 -1
- assets/css/admin-setup-rtl.min.css +1 -1
- assets/css/admin-setup.min.css +1 -1
- assets/css/admin.min.css +1 -1
- assets/css/public-rtl.min.css +1 -1
- assets/css/public.min.css +1 -1
- assets/css/theme-rtl.min.css +1 -1
- assets/css/theme.min.css +1 -1
- assets/css/webfont-rtl.min.css +1 -1
- assets/css/webfont.min.css +1 -1
- assets/js/admin.min.js +1 -1
- assets/js/public.min.js +1 -1
- includes/product.helper.php +7 -1
- languages/ti-woocommerce-wishlist.pot +3 -3
- public/cart.class.php +177 -152
- readme.txt +8 -2
- ti-woocommerce-wishlist.php +2 -2
assets/css/admin-form-rtl.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
|
assets/css/admin-form.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tiwlform-number-container{display:inline-block;margin:2px;position:relative;vertical-align:middle}
|
assets/css/admin-rtl.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
*{-webkit-box-sizing:border-box;box-sizing:border-box}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
*{-webkit-box-sizing:border-box;box-sizing:border-box}
|
assets/css/admin-setup-rtl.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
html{background:#f6f3ed}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
html{background:#f6f3ed}
|
assets/css/admin-setup.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
html{background:#f6f3ed}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
html{background:#f6f3ed}
|
assets/css/admin.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
*{-webkit-box-sizing:border-box;box-sizing:border-box}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
*{-webkit-box-sizing:border-box;box-sizing:border-box}
|
assets/css/public-rtl.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
|
assets/css/public.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist form,.tinv-wishlist p:last-child,.tinv-wishlist table{margin-bottom:0}
|
assets/css/theme-rtl.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type=button],.tinv-wishlist input[type=reset],.tinv-wishlist input[type=submit]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type=button],.tinv-wishlist input[type=reset],.tinv-wishlist input[type=submit]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
|
assets/css/theme.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type=button],.tinv-wishlist input[type=reset],.tinv-wishlist input[type=submit]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
.tinv-wishlist,.tinv-wishlist input,.tinv-wishlist select,.tinv-wishlist textarea,.tinv-wishlist button,.tinv-wishlist input[type=button],.tinv-wishlist input[type=reset],.tinv-wishlist input[type=submit]{font-family:Georgia,serif;font-size:14px;font-weight:400;text-transform:none;line-height:1.75}
|
assets/css/webfont-rtl.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:"tinvwl-webfont";font-display:block;src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:"tinvwl-webfont";font-display:block;src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
assets/css/webfont.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:"tinvwl-webfont";font-display:block;src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:"tinvwl-webfont";font-display:block;src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi");src:url("../fonts/tinvwl-webfont.eot?ver=xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.woff2?ver=xu2uyi") format("woff2"),url("../fonts/tinvwl-webfont.woff?ver=xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.ttf?ver=xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.svg?ver=xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
assets/js/admin.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
"use strict";function TInvWL($,h){this.pf="tinvwl",this.g="_",this.ho=h||!1,this.n="TInvWL",this.aj_act=function(t){return[this.pf,t].join(this.g)},this._csel=function(t,n){return"{0}{1}{2}".format(n=n||".",this.pf,t)},this._tm=function(t){var n=$("script#{0}[type='text/template']".format(t));return n.length?n.html():""},this.formElm=function(){if($(this._csel("-form-onoff")).tiwl_onoff(),$("input[type=checkbox][tiwl-show], input[type=checkbox][tiwl-hide]").tiwl_onoffblock(),$("[tiwl-value][tiwl-show], [tiwl-value][tiwl-hide]").tiwl_byvalueblock(),void 0!==$.fn.wpColorPicker){var e=function(t){var n=t.substring(1),i=parseInt(n,16);return.2126*(i>>16&255)+.7152*(i>>8&255)+.0722*(i>>0&255)},n=this._csel("-form-color");$(n).each(function(){var n=$(this),t=$(this).closest(".tinvwl-color-picker"),i=t.find(".tinvwl-eyedropper");n.css("background-color",n.val()),175<e(n.val())&&n.css("color","#000000"),n.iris({mode:"hsv",target:$(this).parent().parent(),change:function(t,n){175<e(n.color.toCSS())?$(this).css("color","#000000"):$(this).css("color",""),$(this).css("background-color",n.color.toCSS())}}),t.on("click",".iris-square-value",function(t){t.preventDefault(),n.iris("toggle")}),i.on("click",function(t){t.preventDefault(),n.iris("show")}),n.on("focusin",function(){n.iris("show")})}),$(document).on("click",function(t){$(t.target).is(n+", .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .ftinvwl-eyedropper")?$(n).not($(t.target).closest(".tinvwl-color-picker").find(n)).iris("hide"):$(n).iris("hide")})}},this.wizard_page=function(t){$(t).find("select").change(this._wizard_page_ch),this.wizard_page_ch($(t).find("select"))},this.wizard_page_ch=function(t){var n=(t=$(t)).parent(this._csel("-page-select")),i=n.find("input[type=hidden]").val(),e=n.find(this._csel("-error-icon")),o=n.find(this._csel("-error-desc"));""!==t.val()?(n.removeClass("tinvwl-error"),e.hide(),o.hide()):0==i&&(n.addClass("tinvwl-error"),e.show(),o.show())},this.pageElm=function(){$(this._csel("-header","div.")).prependTo("#wpbody-content"),$(this._csel("-page-select")).each(this._wizard_page),$(".bulkactions [type=submit]").each(this._control_bulkactions),$(".action-search [type=submit]").each(this._control_search)},this.control_bulkactions=function(t){$(t).on("click",this._control_bulkactions_ck)},this.control_bulkactions_ck=function(t,n){var i=(t=$(t)).parents(".bulkactions").eq(0).find("[name=action]"),e=t.parents("form").eq(0);i&&("-1"!==i.val()&&e.find("input[type=checkbox]:checked").length||n.preventDefault())},this.control_search=function(t){$(t).on("click",this._control_search_ck)},this.control_search_ck=function(t,n){var i=(t=$(t)).parents(".action-search").eq(0).find("[name=s]");i&&""===i.val()&&n.preventDefault()},this.Run=function(){this.formElm(),this.pageElm()},this.cg=function(){var t=this.n;if(this.ho){var n=new Date;t=t+n.getFullYear()+n.getMonth()+n.getDate()}window[t]=this},this.cg(),String.prototype.format||(String.prototype.format=function(){var i=arguments;return this.replace(/{(\d+)}/g,function(t,n){return void 0!==i[n]?i[n]:t})}),function(o){var n=o.n,ho=o.ho,c="";for(var i in ho&&(c="t=new Date(),n=n+t.getFullYear()+t.getMonth()+t.getDate(),"),o)"function"!=typeof o[i]||"_"===i[0]||o.hasOwnProperty("_"+i)||eval("o._"+i+"=function(a,b,c,d){var n='"+n+"',"+c+"o=window[n]||null;if (o) {return o."+i+"(this,a,b,c,d);};};")}(this)}!function(s){s.fn.tiwl_onoff=function(t){var o=s.extend(!0,{},{value:{on:"",off:""},class:"tiwlform-onoff",wrap:"container",button:"button"},t);return s(this).each(function(){var n=s(this),t=s("<div>").attr({class:o.class+"-"+o.button}),i=o.class+"-"+o.wrap,e=s("<div>").attr({id:n.attr("id")+"_"+o.wrap,class:i});return n.is("input")&&(e.attr("class",e.attr("class")+" "+n.attr("class")),n.is(":disabled")&&(e.toggleClass("disabled",n.is(":disabled")),n.prop("disabled",!1)),e.toggleClass("checked",n.is(":checked")),n.hide().removeAttr("class").wrap(e).before(t),e=n.parent(),n.on("change",function(t){if(e.hasClass("disabled"))return t.preventDefault();e.toggleClass("checked",s(this).is(":checked"))}),e.on("click",function(t){if(e.hasClass("disabled"))return t.preventDefault();n.is(":enabled")&&e.hasClass("checked")===n.is(":checked")&&n.click()})),n})},s.fn.tiwl_onoffblock=function(t){var n={onEachElm:function(){},isChecked:function(){return s(this).is(":checked")}},c=s.extend(!0,{},n,t);return s(this).each(function(){function t(){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){c.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),e=n.attr("tiwl-hide"),o=c.isChecked.call(n);return"string"==typeof i&&t(i,o),"string"==typeof e&&t(e,!o),n}var n=s(this);return n.is("input")&&"checkbox"==n.attr("type")?(s(this).on("change",t),t.call(n)):n})},s.fn.tiwl_byvalueblock=function(t){var n={onEachElm:function(){},onClick:function(){return s(this).val()==s(this).attr("tiwl-value")}},i=s.extend(!0,{},n,t);return s(this).each(function(){function t(e){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){e.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),o=n.attr("tiwl-hide"),c=e.onClick.call(n);return"string"==typeof i&&t(i,c),"string"==typeof o&&t(o,!c),n}var n=s(this);return n.is("input")||n.is("select")?(s(this).on("change",function(){t.call(this,i)}),t.call(n,i)):n})};var n=new TInvWL(s);s(document).ready(function(){if(n.Run(),jQuery('input[name="general-show_notice"]').change(function(){var t=!jQuery(this).is(":checked"),n=jQuery('input[name="general-redirect_require_login"]');t&&!n.is(":checked")&&n.click().trigger("change"),n.closest(".tiwlform-onoff-container").toggleClass("disabled",t)}).change(),s(".tablenav").each(function(){var t=s(this);s.trim(t.find(".alignleft").html()).length||t.find(".alignleft").remove(),s.trim(t.find(".alignright").html()).length&&!t.find(".tablenav-pages").hasClass("one-page")||(t.find(".alignright").remove(),t.find(".tinv-wishlist-clear").remove()),s.trim(t.html()).length||t.remove()}),s(".tablenav .bulkactions select").addClass("tinvwl-select grey").wrap('<span class="tinvwl-select-wrap">').parent().append('<span class="tinvwl-caret"><span></span></span>'),s(".tablenav .bulkactions .button.action, .tablenav #search-submit").removeClass("button").addClass("tinvwl-btn grey"),s(".tinvwl-modal-btn").on("click",function(){s(this).next(".tinvwl-modal").addClass("tinvwl-modal-open")}),s(".tinvwl-overlay, .tinvwl-close-modal, .tinvwl_button_close").on("click",function(t){t.preventDefault(),s(this).parents(".tinvwl-modal:first").removeClass("tinvwl-modal-open")}),void 0!==s.fn.popover){var t=s(".tinvwl-help");t.popover({content:function(){return s(this).closest(".tinvwl-info-wrap").find(".tinvwl-info-desc").html()}}),t.on("click",function(){s(this).popover("toggle")}),t.on("focusout",function(){s(this).popover("hide")}),s(window).on("resize",function(){t.popover("hide")})}s("body").on("click",".tinvwl-confirm-reset",function(t){t.preventDefault(),confirm(tinvwl_comfirm.text_comfirm_reset)&&s(this).removeClass("tinvwl-confirm-reset").trigger("click")})}),s(document).on("click",".tinvwl-chat-notice .notice-dismiss",function(t){s.post(tinvwl_comfirm.ajax_url,{action:"tinvwl_admin_chat_notice"})})}(jQuery);
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
"use strict";function TInvWL($,h){this.pf="tinvwl",this.g="_",this.ho=h||!1,this.n="TInvWL",this.aj_act=function(t){return[this.pf,t].join(this.g)},this._csel=function(t,n){return"{0}{1}{2}".format(n=n||".",this.pf,t)},this._tm=function(t){var n=$("script#{0}[type='text/template']".format(t));return n.length?n.html():""},this.formElm=function(){if($(this._csel("-form-onoff")).tiwl_onoff(),$("input[type=checkbox][tiwl-show], input[type=checkbox][tiwl-hide]").tiwl_onoffblock(),$("[tiwl-value][tiwl-show], [tiwl-value][tiwl-hide]").tiwl_byvalueblock(),void 0!==$.fn.wpColorPicker){var e=function(t){var n=t.substring(1),i=parseInt(n,16);return.2126*(i>>16&255)+.7152*(i>>8&255)+.0722*(i>>0&255)},n=this._csel("-form-color");$(n).each(function(){var n=$(this),t=$(this).closest(".tinvwl-color-picker"),i=t.find(".tinvwl-eyedropper");n.css("background-color",n.val()),175<e(n.val())&&n.css("color","#000000"),n.iris({mode:"hsv",target:$(this).parent().parent(),change:function(t,n){175<e(n.color.toCSS())?$(this).css("color","#000000"):$(this).css("color",""),$(this).css("background-color",n.color.toCSS())}}),t.on("click",".iris-square-value",function(t){t.preventDefault(),n.iris("toggle")}),i.on("click",function(t){t.preventDefault(),n.iris("show")}),n.on("focusin",function(){n.iris("show")})}),$(document).on("click",function(t){$(t.target).is(n+", .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .ftinvwl-eyedropper")?$(n).not($(t.target).closest(".tinvwl-color-picker").find(n)).iris("hide"):$(n).iris("hide")})}},this.wizard_page=function(t){$(t).find("select").change(this._wizard_page_ch),this.wizard_page_ch($(t).find("select"))},this.wizard_page_ch=function(t){var n=(t=$(t)).parent(this._csel("-page-select")),i=n.find("input[type=hidden]").val(),e=n.find(this._csel("-error-icon")),o=n.find(this._csel("-error-desc"));""!==t.val()?(n.removeClass("tinvwl-error"),e.hide(),o.hide()):0==i&&(n.addClass("tinvwl-error"),e.show(),o.show())},this.pageElm=function(){$(this._csel("-header","div.")).prependTo("#wpbody-content"),$(this._csel("-page-select")).each(this._wizard_page),$(".bulkactions [type=submit]").each(this._control_bulkactions),$(".action-search [type=submit]").each(this._control_search)},this.control_bulkactions=function(t){$(t).on("click",this._control_bulkactions_ck)},this.control_bulkactions_ck=function(t,n){var i=(t=$(t)).parents(".bulkactions").eq(0).find("[name=action]"),e=t.parents("form").eq(0);i&&("-1"!==i.val()&&e.find("input[type=checkbox]:checked").length||n.preventDefault())},this.control_search=function(t){$(t).on("click",this._control_search_ck)},this.control_search_ck=function(t,n){var i=(t=$(t)).parents(".action-search").eq(0).find("[name=s]");i&&""===i.val()&&n.preventDefault()},this.Run=function(){this.formElm(),this.pageElm()},this.cg=function(){var t=this.n;if(this.ho){var n=new Date;t=t+n.getFullYear()+n.getMonth()+n.getDate()}window[t]=this},this.cg(),String.prototype.format||(String.prototype.format=function(){var i=arguments;return this.replace(/{(\d+)}/g,function(t,n){return void 0!==i[n]?i[n]:t})}),function(o){var n=o.n,ho=o.ho,c="";for(var i in ho&&(c="t=new Date(),n=n+t.getFullYear()+t.getMonth()+t.getDate(),"),o)"function"!=typeof o[i]||"_"===i[0]||o.hasOwnProperty("_"+i)||eval("o._"+i+"=function(a,b,c,d){var n='"+n+"',"+c+"o=window[n]||null;if (o) {return o."+i+"(this,a,b,c,d);};};")}(this)}!function(s){s.fn.tiwl_onoff=function(t){var o=s.extend(!0,{},{value:{on:"",off:""},class:"tiwlform-onoff",wrap:"container",button:"button"},t);return s(this).each(function(){var n=s(this),t=s("<div>").attr({class:o.class+"-"+o.button}),i=o.class+"-"+o.wrap,e=s("<div>").attr({id:n.attr("id")+"_"+o.wrap,class:i});return n.is("input")&&(e.attr("class",e.attr("class")+" "+n.attr("class")),n.is(":disabled")&&(e.toggleClass("disabled",n.is(":disabled")),n.prop("disabled",!1)),e.toggleClass("checked",n.is(":checked")),n.hide().removeAttr("class").wrap(e).before(t),e=n.parent(),n.on("change",function(t){if(e.hasClass("disabled"))return t.preventDefault();e.toggleClass("checked",s(this).is(":checked"))}),e.on("click",function(t){if(e.hasClass("disabled"))return t.preventDefault();n.is(":enabled")&&e.hasClass("checked")===n.is(":checked")&&n.click()})),n})},s.fn.tiwl_onoffblock=function(t){var n={onEachElm:function(){},isChecked:function(){return s(this).is(":checked")}},c=s.extend(!0,{},n,t);return s(this).each(function(){function t(){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){c.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),e=n.attr("tiwl-hide"),o=c.isChecked.call(n);return"string"==typeof i&&t(i,o),"string"==typeof e&&t(e,!o),n}var n=s(this);return n.is("input")&&"checkbox"==n.attr("type")?(s(this).on("change",t),t.call(n)):n})},s.fn.tiwl_byvalueblock=function(t){var n={onEachElm:function(){},onClick:function(){return s(this).val()==s(this).attr("tiwl-value")}},i=s.extend(!0,{},n,t);return s(this).each(function(){function t(e){function t(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){e.onEachElm.call(s(n).toggle(i))})}var n=s(this),i=n.attr("tiwl-show"),o=n.attr("tiwl-hide"),c=e.onClick.call(n);return"string"==typeof i&&t(i,c),"string"==typeof o&&t(o,!c),n}var n=s(this);return n.is("input")||n.is("select")?(s(this).on("change",function(){t.call(this,i)}),t.call(n,i)):n})};var n=new TInvWL(s);s(document).ready(function(){if(n.Run(),jQuery('input[name="general-show_notice"]').change(function(){var t=!jQuery(this).is(":checked"),n=jQuery('input[name="general-redirect_require_login"]');t&&!n.is(":checked")&&n.click().trigger("change"),n.closest(".tiwlform-onoff-container").toggleClass("disabled",t)}).change(),s(".tablenav").each(function(){var t=s(this);s.trim(t.find(".alignleft").html()).length||t.find(".alignleft").remove(),s.trim(t.find(".alignright").html()).length&&!t.find(".tablenav-pages").hasClass("one-page")||(t.find(".alignright").remove(),t.find(".tinv-wishlist-clear").remove()),s.trim(t.html()).length||t.remove()}),s(".tablenav .bulkactions select").addClass("tinvwl-select grey").wrap('<span class="tinvwl-select-wrap">').parent().append('<span class="tinvwl-caret"><span></span></span>'),s(".tablenav .bulkactions .button.action, .tablenav #search-submit").removeClass("button").addClass("tinvwl-btn grey"),s(".tinvwl-modal-btn").on("click",function(){s(this).next(".tinvwl-modal").addClass("tinvwl-modal-open")}),s(".tinvwl-overlay, .tinvwl-close-modal, .tinvwl_button_close").on("click",function(t){t.preventDefault(),s(this).parents(".tinvwl-modal:first").removeClass("tinvwl-modal-open")}),void 0!==s.fn.popover){var t=s(".tinvwl-help");t.popover({content:function(){return s(this).closest(".tinvwl-info-wrap").find(".tinvwl-info-desc").html()}}),t.on("click",function(){s(this).popover("toggle")}),t.on("focusout",function(){s(this).popover("hide")}),s(window).on("resize",function(){t.popover("hide")})}s("body").on("click",".tinvwl-confirm-reset",function(t){t.preventDefault(),confirm(tinvwl_comfirm.text_comfirm_reset)&&s(this).removeClass("tinvwl-confirm-reset").trigger("click")})}),s(document).on("click",".tinvwl-chat-notice .notice-dismiss",function(t){s.post(tinvwl_comfirm.ajax_url,{action:"tinvwl_admin_chat_notice"})})}(jQuery);
|
assets/js/public.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
-
* @version 1.27.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function showTooltip(t,i){t.setAttribute("class","social social-clipboard tooltipped tooltipped-s"),t.setAttribute("aria-label",i)}function clearTooltip(t){t.currentTarget.setAttribute("class","social social-clipboard "),t.currentTarget.removeAttribute("aria-label")}!function(c){c.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href.split("?")[0],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(){c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){c(this).append(c("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(t){c(t).addClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){c(t).removeClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(c(this).is(".disabled-add-wishlist"))return!1;c(this).is(".ftinvwl-animated")&&c(this).addClass("ftinvwl-pulse"),this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):e.onActionProduct.call(this)},onPrepareDataAction:function(t,i){c("body").trigger("tinvwl_wishlist_button_clicked",[t,i])},filterProductAlreadyIn:function(t){t=t||[];var o={};return c("form.cart[method=post], .woocommerce-variation-add-to-cart, form.vtajaxform[method=post]").find("input, select").each(function(){var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val();("checkbox"!==i&&"radio"!==i||c(this).is(":checked"))&&(o["form"+t]=n)}),o=o.formvariation_id,t.filter(function(t){if("object"!==_typeof(t.in)||"string"!=typeof o)return t.in;var i=parseInt(o);return 0<=t.in.indexOf(i)})},onMultiProductAlreadyIn:function(t){t=t||[];t=e.onPrepareList.call(t)||t,t=e.filterProductAlreadyIn.call(this,t)||t,c(this).parent().parent().find(".already-in").remove();var n="";switch(t.length){case 0:break;default:n=c("<ul>");c.each(t,function(t,i){n.append(c("<li>").html(c("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}n.length&&c(this).closest(".tinv-modal-inner").find("img").after(c("<div>").addClass("already-in").html(e.text_already_in+" ").append(n))},onAction:{redirect:function(t){e.redirectTimer&&clearTimeout(e.redirectTimer),e.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(){},msg:function(t){if(!t)return!1;var i=c(t).eq(0);c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c("body > .tinv-wishlist").append(i),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),e.redirectTimer&&clearTimeout(e.redirectTimer)})},status:function(t){c("body").trigger("tinvwl_wishlist_added_status",[this,t])},removed:function(){},make_remove:function(){},wishlists_data:function(t){d(JSON.stringify(t))}}};i.onActionProduct=function(t,i){var r={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:c(this).attr("data-tinv-wl-producttype"),product_id:c(this).attr("data-tinv-wl-product")||0,product_variation:c(this).attr("data-tinv-wl-productvariation")||0,product_action:c(this).attr("data-tinv-wl-action")||"addto",redirect:window.location.href},n=this,o=[],d=new FormData;tinvwl_add_to_wishlist.wpml&&(r.lang=tinvwl_add_to_wishlist.wpml),c('form.cart[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"], form.vtajaxform[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),o.length||(c(n).closest("form.cart[method=post], form.vtajaxform[method=post]").each(function(){o.push(c(this))}),o.length||o.push(c("form.cart[method=post]"))),c('.tinv-wraper[data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),c.each(o,function(t,i){c(i).find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").each(function(){function e(t,i){if("object"!==_typeof(i))return i;for(var n in void 0===t&&(t={}),i)if(""===n){var o=-1;for(o in t)o=o;t[o=parseInt(o)+1]=e(t[n],i[n])}else t[n]=e(t[n],i[n]);return t}var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val(),o=10;if("button"!==i&&void 0!==t){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<o;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=n,n=l}t=a[1],o--}if("file"===i){var s=c(this)[0].files;s&&d.append(t,s[0])}"checkbox"===i||"radio"===i?c(this).is(":checked")&&(n.length||"object"===_typeof(n)||(n=!0),r.form[t]=e(r.form[t],n)):r.form[t]=e(r.form[t],n)}})}),r=e.onPrepareDataAction.call(n,n,r)||r,c.each(r,function(n,t){"form"===n?c.each(t,function(t,i){"object"===_typeof(i)&&(i=JSON.stringify(i)),d.append(n+"["+t+"]",i)}):d.append(n,t)}),c.ajax({url:e.api_url,method:"POST",contentType:!1,processData:!1,data:d}).done(function(t){if(e.onDialogHide.call(n.tinvwl_dialog,n),"object"===_typeof(t))for(var i in t)"function"==typeof e.onAction[i]&&e.onAction[i].call(n,t[i]);else"function"==typeof e.onAction.msg&&e.onAction.msg.call(n,t)})};var e=c.extend(!0,{},i,t);return c(this).each(function(){if(!c(this).attr("data-tinv-wl-list"))return!1;if(e.dialogbox&&e.dialogbox.length&&(this.tinvwl_dialog=e.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=e.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=c(this).nextAll(e.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){e.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=c(this).find(e.class.select).eq(0);c(this).find(e.class.newtitle).hide().val(""),n.html(""),c.each(t,function(t,i){e.onCreateWishList.call(n,i)}),e.text_create&&e.onCreateWishList.call(n,{ID:"",title:e.text_create,in:!1}),e.onMultiProductAlreadyIn.call(n,t),e.onSelectWishList.call(n,t),c(this).find(e.class.newtitle).toggle(""===n.val())}),"function"!=typeof this.tinvwl_dialog.show_list&&(this.tinvwl_dialog.show_list=function(){var t=JSON.parse(c(this).attr("data-tinv-wl-list"))||[];t.length?(t=e.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),e.onDialogShow.call(this.tinvwl_dialog,this)):e.onActionProduct.call(this)});var o=this;c(this.tinvwl_dialog).find(e.class.dialogbutton).off("click").on("click",function(){var t,i=c(o.tinvwl_dialog).find(e.class.select),n=c(o.tinvwl_dialog).find(e.class.newtitle);i.val()||n.val()?e.onActionProduct.call(o,i.val(),n.val()):((t=n.is(":visible")?n:i).addClass("empty-name-wishlist"),window.setTimeout(function(){t.removeClass("empty-name-wishlist")},1e3))})}c(this).off("click").on("click",e.onClick),e.onInited.call(this,e)})},c(document).ready(function(){c("body").on("click",".tinvwl_add_to_wishlist_button",function(t){if(c("body").trigger("tinvwl_add_to_wishlist_button_click",[this]),c(this).is(".disabled-add-wishlist"))return t.preventDefault(),void window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);c(this).is(".inited-add-wishlist")||c(this).tinvwl_to_wishlist({onInited:function(t){c(this).addClass("inited-add-wishlist"),t.onClick.call(this)}})}),c(document).on("hide_variation",".variations_form",function(t){var i=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(i.attr("data-tinv-wl-productvariation",0),i.length&&i.attr("data-tinv-wl-list")){var n=JSON.parse(i.attr("data-tinv-wl-list")),o=!1,e="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var a in n)n[a].hasOwnProperty("in")&&Array.isArray(n[a].in)&&-1<(n[a].in||[]).indexOf(0)&&(o=!0);i.toggleClass("tinvwl-product-in-list",o).toggleClass("tinvwl-product-make-remove",o&&e).attr("data-tinv-wl-action",o&&e?"remove":"addto")}i.length&&!tinvwl_add_to_wishlist.allow_parent_variable&&(t.preventDefault(),i.addClass("disabled-add-wishlist"))}),c(document).on("show_variation",".variations_form",function(t,i,n){var o=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(o.attr("data-tinv-wl-productvariation",i.variation_id),o.length&&o.attr("data-tinv-wl-list")){var e=JSON.parse(o.attr("data-tinv-wl-list")),a=!1,l="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var s in e)e[s].hasOwnProperty("in")&&Array.isArray(e[s].in)&&-1<(e[s].in||[]).indexOf(i.variation_id)&&(a=!0);o.toggleClass("tinvwl-product-in-list",a).toggleClass("tinvwl-product-make-remove",a&&l).attr("data-tinv-wl-action",a&&l?"remove":"addto")}t.preventDefault(),o.removeClass("disabled-add-wishlist")}),c(window).on("storage onstorage",function(t){if(s===t.originalEvent.key&&localStorage.getItem(s)!==sessionStorage.getItem(s)&&localStorage.getItem(s)){var i=JSON.parse(localStorage.getItem(s));"object"===_typeof(i)&&null!==i&&(i.hasOwnProperty("products")||i.hasOwnProperty("counter"))&&d(localStorage.getItem(s))}});var n=[],i=!1;c("a.tinvwl_add_to_wishlist_button").each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))}),c(".wishlist_products_counter_number").each(function(){i=!0});function o(){if(n.length||i){var t={};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.plugin_url+"includes/api/ajax.php",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)}).fail(function(){!function(){if(n.length||i){var t={ids:n,counter:i,tinvwl_request:!0};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.rest_root+"wishlist/v1/products",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)})}}()})}}function e(){if(l&&(tinvwl_add_to_wishlist.update_wishlists_data&&localStorage.setItem(s,""),localStorage.getItem(s))){var t=JSON.parse(localStorage.getItem(s));if("object"===_typeof(t)&&null!==t&&(t.hasOwnProperty("products")||t.hasOwnProperty("counter"))&&(!t.hasOwnProperty("lang")&&!tinvwl_add_to_wishlist.wpml||tinvwl_add_to_wishlist.wpml&&t.lang===tinvwl_add_to_wishlist.wpml))return void r(t)}tinvwl_add_to_wishlist.block_ajax_wishlists_data||o()}e();var t=new MutationObserver(function(t){n=[],t.forEach(function(t){var i=t.addedNodes;null!==i&&c(i).each(function(){var t=c(this).find(".tinvwl_add_to_wishlist_button");t.length&&t.each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))})})}),n.length&&e()}),a=document.body;t.observe(a,{childList:!0,subtree:!0})});var l=!0,s=tinvwl_add_to_wishlist.hash_key;try{l="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("ti","test"),window.sessionStorage.removeItem("ti"),window.localStorage.setItem("ti","test"),window.localStorage.removeItem("ti")}catch(t){l=!1}function r(t){var l="1"==window.tinvwl_add_to_wishlist.simple_flow;l&&c("a.tinvwl_add_to_wishlist_button").each(function(){c(this).removeClass("tinvwl-product-make-remove").removeClass("tinvwl-product-already-on-wishlist").removeClass("tinvwl-product-in-list").attr("data-tinv-wl-action","addto").attr("data-tinv-wl-list","[]")}),c("body").trigger("tinvwl_wishlist_mark_products",[t]),c.each(t.products,function(t,e){var a=t;c('a.tinvwl_add_to_wishlist_button[data-tinv-wl-product="'+a+'"]').each(function(){var t=parseInt(c(this).attr("data-tinv-wl-productvariation")),i=c(this).data("tinv-wl-productvariations")||[],n=!1;for(var o in e)e[o].hasOwnProperty("in")&&Array.isArray(e[o].in)&&(-1<(e[o].in||[]).indexOf(a)||-1<(e[o].in||[]).indexOf(t)||i.some(function(t){return 0<=(e[o].in||[]).indexOf(t)}))&&(n=!0);c("body").trigger("tinvwl_wishlist_product_marked",[this,n]),c(this).attr("data-tinv-wl-list",JSON.stringify(e)).toggleClass("tinvwl-product-in-list",n).toggleClass("tinvwl-product-make-remove",n&&l).attr("data-tinv-wl-action",n&&l?"remove":"addto")})}),function(t){"1"==window.tinvwl_add_to_wishlist.hide_zero_counter&&0===t&&(t="false");jQuery("i.wishlist-icon").addClass("added"),"false"!==t?(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html(t),jQuery("i.wishlist-icon").attr("data-icon-label",t)):(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html("").closest("span.wishlist-counter-with-products").removeClass("wishlist-counter-with-products"),jQuery("i.wishlist-icon").removeAttr("data-icon-label"));var i=!("0"==t||"false"==t);jQuery(".wishlist_products_counter").toggleClass("wishlist-counter-with-products",i),setTimeout(function(){jQuery("i.wishlist-icon").removeClass("added")},500)}(t.counter)}function d(t){l&&(localStorage.setItem(s,t),sessionStorage.setItem(s,t),r(JSON.parse(t)))}}(jQuery),function(o){o(document).ready(function(){if(o("#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">'),o(".tinv-lists-nav").each(function(){o(this).html().trim().length||o(this).remove()}),o("body").on("click",".social-buttons .social:not(.social-email,.social-whatsapp,.social-clipboard)",function(t){var i=window.open(o(this).attr("href"),o(this).attr("title"),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");i&&(i.focus(),t.preventDefault())}),"undefined"!=typeof ClipboardJS){new ClipboardJS(".social-buttons .social.social-clipboard",{text:function(t){return t.getAttribute("href")}}).on("success",function(t){showTooltip(t.trigger,tinvwl_add_to_wishlist.tinvwl_clipboard)});for(var t=document.querySelectorAll(".social-buttons .social.social-clipboard"),i=0;i<t.length;i++)t[i].addEventListener("mouseleave",clearTooltip),t[i].addEventListener("blur",clearTooltip)}o("body").on("click",".social-buttons .social.social-clipboard",function(t){t.preventDefault()}),o("body").on("click",".tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close",function(t){t.preventDefault(),o(this).parents(".tinv-modal:first").removeClass("tinv-modal-open"),o("body").trigger("tinvwl_modal_closed",[this])}),o("body").on("click",".tinv-wishlist .tinvwl-btn-onclick",function(t){o(this).data("url")&&(t.preventDefault(),window.location=o(this).data("url"))});var n=o(".tinv-wishlist .navigation-button");n.length&&n.each(function(){var t=o(this).find("> li");t.length<5&&t.parent().addClass("tinvwl-btns-count-"+t.length)}),o(".tinv-login .showlogin").off("click").on("click",function(t){t.preventDefault(),o(this).closest(".tinv-login").find(".login").toggle()}),o(".tinv-wishlist table.tinvwl-table-manage-list tfoot td").each(function(){o(this).toggle(!!o(this).children().not(".look_in").length||!!o(this).children(".look_in").children().length)})})}(jQuery),function(o){o.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return o(this).val()},rule:function(){var t=o(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(o(this))))}),i)}},n=o.extend(!0,{},i,t);return o(this).each(function(){o(this).on("click",function(t){var i=[];void 0!==o(this).attr("tinvwl_break_submit")&&(i=o(this).attr("tinvwl_break_submit").split(",")),-1!==jQuery.inArray(n.selector,i)&&(i=[]),n.rule.call(o(this))||0!==i.length||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault()),i.push(n.selector),o(this).attr("tinvwl_break_submit",i),n.rule.call(o(this))&&o(this).removeAttr("tinvwl_break_submit")})})},o(document).ready(function(){o(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),o(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return o(this).is(":checked")}}),o(".global-cb").on("click",function(){o(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",o(this).is(":checked"))})})}(jQuery);
|
1 |
/**
|
2 |
* TI WooCommerce Wishlist Plugin - Allow your store guests and customers to add products to Wishlist. Add Wishlist functionality to your store for free.
|
3 |
+
* @version 1.27.3
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function showTooltip(t,i){t.setAttribute("class","social social-clipboard tooltipped tooltipped-s"),t.setAttribute("aria-label",i)}function clearTooltip(t){t.currentTarget.setAttribute("class","social social-clipboard "),t.currentTarget.removeAttribute("aria-label")}!function(c){c.fn.tinvwl_to_wishlist=function(t){var i={api_url:window.location.href.split("?")[0],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(){c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c(this).appendTo("body > .tinv-wishlist")},onCreateWishList:function(t){c(this).append(c("<option>").html(t.title).val(t.ID).toggleClass("tinv_in_wishlist",t.in))},onSelectWishList:function(){},onDialogShow:function(t){c(t).addClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){c(t).removeClass("tinv-modal-open"),c(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(c(this).is(".disabled-add-wishlist"))return!1;c(this).is(".ftinvwl-animated")&&c(this).addClass("ftinvwl-pulse"),this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):e.onActionProduct.call(this)},onPrepareDataAction:function(t,i){c("body").trigger("tinvwl_wishlist_button_clicked",[t,i])},filterProductAlreadyIn:function(t){t=t||[];var o={};return c("form.cart[method=post], .woocommerce-variation-add-to-cart, form.vtajaxform[method=post]").find("input, select").each(function(){var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val();("checkbox"!==i&&"radio"!==i||c(this).is(":checked"))&&(o["form"+t]=n)}),o=o.formvariation_id,t.filter(function(t){if("object"!==_typeof(t.in)||"string"!=typeof o)return t.in;var i=parseInt(o);return 0<=t.in.indexOf(i)})},onMultiProductAlreadyIn:function(t){t=t||[];t=e.onPrepareList.call(t)||t,t=e.filterProductAlreadyIn.call(this,t)||t,c(this).parent().parent().find(".already-in").remove();var n="";switch(t.length){case 0:break;default:n=c("<ul>");c.each(t,function(t,i){n.append(c("<li>").html(c("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}n.length&&c(this).closest(".tinv-modal-inner").find("img").after(c("<div>").addClass("already-in").html(e.text_already_in+" ").append(n))},onAction:{redirect:function(t){e.redirectTimer&&clearTimeout(e.redirectTimer),e.redirectTimer=window.setTimeout(function(){window.location.href=t},4e3)},force_redirect:function(t){window.location.href=t},wishlists:function(){},msg:function(t){if(!t)return!1;var i=c(t).eq(0);c("body > .tinv-wishlist").length||c("body").append(c("<div>").addClass("tinv-wishlist")),c("body > .tinv-wishlist").append(i),i.on("click",".tinv-close-modal, .tinvwl_button_close, .tinv-overlay",function(t){t.preventDefault(),i.remove(),e.redirectTimer&&clearTimeout(e.redirectTimer)})},status:function(t){c("body").trigger("tinvwl_wishlist_added_status",[this,t])},removed:function(){},make_remove:function(){},wishlists_data:function(t){d(JSON.stringify(t))}}};i.onActionProduct=function(t,i){var r={form:{},tinv_wishlist_id:t||"",tinv_wishlist_name:i||"",product_type:c(this).attr("data-tinv-wl-producttype"),product_id:c(this).attr("data-tinv-wl-product")||0,product_variation:c(this).attr("data-tinv-wl-productvariation")||0,product_action:c(this).attr("data-tinv-wl-action")||"addto",redirect:window.location.href},n=this,o=[],d=new FormData;tinvwl_add_to_wishlist.wpml&&(r.lang=tinvwl_add_to_wishlist.wpml),c('form.cart[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"], form.vtajaxform[method=post][data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),o.length||(c(n).closest("form.cart[method=post], form.vtajaxform[method=post]").each(function(){o.push(c(this))}),o.length||o.push(c("form.cart[method=post]"))),c('.tinv-wraper[data-product_id="'+c(this).attr("data-tinv-wl-product")+'"]').each(function(){o.push(c(this))}),c.each(o,function(t,i){c(i).find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").each(function(){function e(t,i){if("object"!==_typeof(i))return i;for(var n in void 0===t&&(t={}),i)if(""===n){var o=-1;for(o in t)o=o;t[o=parseInt(o)+1]=e(t[n],i[n])}else t[n]=e(t[n],i[n]);return t}var t=c(this).attr("name"),i=c(this).attr("type"),n=c(this).val(),o=10;if("button"!==i&&void 0!==t){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<o;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=n,n=l}t=a[1],o--}if("file"===i){var s=c(this)[0].files;s&&d.append(t,s[0])}"checkbox"===i||"radio"===i?c(this).is(":checked")&&(n.length||"object"===_typeof(n)||(n=!0),r.form[t]=e(r.form[t],n)):r.form[t]=e(r.form[t],n)}})}),r=e.onPrepareDataAction.call(n,n,r)||r,c.each(r,function(n,t){"form"===n?c.each(t,function(t,i){"object"===_typeof(i)&&(i=JSON.stringify(i)),d.append(n+"["+t+"]",i)}):d.append(n,t)}),c.ajax({url:e.api_url,method:"POST",contentType:!1,processData:!1,data:d}).done(function(t){if(e.onDialogHide.call(n.tinvwl_dialog,n),"object"===_typeof(t))for(var i in t)"function"==typeof e.onAction[i]&&e.onAction[i].call(n,t[i]);else"function"==typeof e.onAction.msg&&e.onAction.msg.call(n,t)})};var e=c.extend(!0,{},i,t);return c(this).each(function(){if(!c(this).attr("data-tinv-wl-list"))return!1;if(e.dialogbox&&e.dialogbox.length&&(this.tinvwl_dialog=e.dialogbox),this.tinvwl_dialog||(this.tinvwl_dialog=e.onGetDialogBox.call(this)),!this.tinvwl_dialog){var t=c(this).nextAll(e.class.dialogbox).eq(0);t.length&&(this.tinvwl_dialog=t)}if(this.tinvwl_dialog){e.onPrepareDialogBox.call(this.tinvwl_dialog),"function"!=typeof this.tinvwl_dialog.update_list&&(this.tinvwl_dialog.update_list=function(t){var n=c(this).find(e.class.select).eq(0);c(this).find(e.class.newtitle).hide().val(""),n.html(""),c.each(t,function(t,i){e.onCreateWishList.call(n,i)}),e.text_create&&e.onCreateWishList.call(n,{ID:"",title:e.text_create,in:!1}),e.onMultiProductAlreadyIn.call(n,t),e.onSelectWishList.call(n,t),c(this).find(e.class.newtitle).toggle(""===n.val())}),"function"!=typeof this.tinvwl_dialog.show_list&&(this.tinvwl_dialog.show_list=function(){var t=JSON.parse(c(this).attr("data-tinv-wl-list"))||[];t.length?(t=e.onPrepareList.call(t)||t,this.tinvwl_dialog.update_list(t),e.onDialogShow.call(this.tinvwl_dialog,this)):e.onActionProduct.call(this)});var o=this;c(this.tinvwl_dialog).find(e.class.dialogbutton).off("click").on("click",function(){var t,i=c(o.tinvwl_dialog).find(e.class.select),n=c(o.tinvwl_dialog).find(e.class.newtitle);i.val()||n.val()?e.onActionProduct.call(o,i.val(),n.val()):((t=n.is(":visible")?n:i).addClass("empty-name-wishlist"),window.setTimeout(function(){t.removeClass("empty-name-wishlist")},1e3))})}c(this).off("click").on("click",e.onClick),e.onInited.call(this,e)})},c(document).ready(function(){c("body").on("click",".tinvwl_add_to_wishlist_button",function(t){if(c("body").trigger("tinvwl_add_to_wishlist_button_click",[this]),c(this).is(".disabled-add-wishlist"))return t.preventDefault(),void window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);c(this).is(".inited-add-wishlist")||c(this).tinvwl_to_wishlist({onInited:function(t){c(this).addClass("inited-add-wishlist"),t.onClick.call(this)}})}),c(document).on("hide_variation",".variations_form",function(t){var i=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(i.attr("data-tinv-wl-productvariation",0),i.length&&i.attr("data-tinv-wl-list")){var n=JSON.parse(i.attr("data-tinv-wl-list")),o=!1,e="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var a in n)n[a].hasOwnProperty("in")&&Array.isArray(n[a].in)&&-1<(n[a].in||[]).indexOf(0)&&(o=!0);i.toggleClass("tinvwl-product-in-list",o).toggleClass("tinvwl-product-make-remove",o&&e).attr("data-tinv-wl-action",o&&e?"remove":"addto")}i.length&&!tinvwl_add_to_wishlist.allow_parent_variable&&(t.preventDefault(),i.addClass("disabled-add-wishlist"))}),c(document).on("show_variation",".variations_form",function(t,i,n){var o=c('.tinvwl_add_to_wishlist_button:not(.tinvwl-loop)[data-tinv-wl-product="'+c(this).data("product_id")+'"]');if(o.attr("data-tinv-wl-productvariation",i.variation_id),o.length&&o.attr("data-tinv-wl-list")){var e=JSON.parse(o.attr("data-tinv-wl-list")),a=!1,l="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var s in e)e[s].hasOwnProperty("in")&&Array.isArray(e[s].in)&&-1<(e[s].in||[]).indexOf(i.variation_id)&&(a=!0);o.toggleClass("tinvwl-product-in-list",a).toggleClass("tinvwl-product-make-remove",a&&l).attr("data-tinv-wl-action",a&&l?"remove":"addto")}t.preventDefault(),o.removeClass("disabled-add-wishlist")}),c(window).on("storage onstorage",function(t){if(s===t.originalEvent.key&&localStorage.getItem(s)!==sessionStorage.getItem(s)&&localStorage.getItem(s)){var i=JSON.parse(localStorage.getItem(s));"object"===_typeof(i)&&null!==i&&(i.hasOwnProperty("products")||i.hasOwnProperty("counter"))&&d(localStorage.getItem(s))}});var n=[],i=!1;c("a.tinvwl_add_to_wishlist_button").each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))}),c(".wishlist_products_counter_number").each(function(){i=!0});function o(){if(n.length||i){var t={};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.plugin_url+"includes/api/ajax.php",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)}).fail(function(){!function(){if(n.length||i){var t={ids:n,counter:i,tinvwl_request:!0};tinvwl_add_to_wishlist.wpml&&(t.lang=tinvwl_add_to_wishlist.wpml),c.ajax({url:tinvwl_add_to_wishlist.rest_root+"wishlist/v1/products",method:"POST",data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",tinvwl_add_to_wishlist.nonce)}}).done(function(t){d(JSON.stringify(t)),r(t)})}}()})}}function e(){if(l&&(tinvwl_add_to_wishlist.update_wishlists_data&&localStorage.setItem(s,""),localStorage.getItem(s))){var t=JSON.parse(localStorage.getItem(s));if("object"===_typeof(t)&&null!==t&&(t.hasOwnProperty("products")||t.hasOwnProperty("counter"))&&(!t.hasOwnProperty("lang")&&!tinvwl_add_to_wishlist.wpml||tinvwl_add_to_wishlist.wpml&&t.lang===tinvwl_add_to_wishlist.wpml))return void r(t)}tinvwl_add_to_wishlist.block_ajax_wishlists_data||o()}e();var t=new MutationObserver(function(t){n=[],t.forEach(function(t){var i=t.addedNodes;null!==i&&c(i).each(function(){var t=c(this).find(".tinvwl_add_to_wishlist_button");t.length&&t.each(function(){"undefined"!==c(this).data("tinv-wl-product")&&c(this).data("tinv-wl-product")&&n.push(c(this).data("tinv-wl-product"))})})}),n.length&&e()}),a=document.body;t.observe(a,{childList:!0,subtree:!0})});var l=!0,s=tinvwl_add_to_wishlist.hash_key;try{l="sessionStorage"in window&&null!==window.sessionStorage,window.sessionStorage.setItem("ti","test"),window.sessionStorage.removeItem("ti"),window.localStorage.setItem("ti","test"),window.localStorage.removeItem("ti")}catch(t){l=!1}function r(t){var l="1"==window.tinvwl_add_to_wishlist.simple_flow;l&&c("a.tinvwl_add_to_wishlist_button").each(function(){c(this).removeClass("tinvwl-product-make-remove").removeClass("tinvwl-product-already-on-wishlist").removeClass("tinvwl-product-in-list").attr("data-tinv-wl-action","addto").attr("data-tinv-wl-list","[]")}),c("body").trigger("tinvwl_wishlist_mark_products",[t]),c.each(t.products,function(t,e){var a=t;c('a.tinvwl_add_to_wishlist_button[data-tinv-wl-product="'+a+'"]').each(function(){var t=parseInt(c(this).attr("data-tinv-wl-productvariation")),i=c(this).data("tinv-wl-productvariations")||[],n=!1;for(var o in e)e[o].hasOwnProperty("in")&&Array.isArray(e[o].in)&&(-1<(e[o].in||[]).indexOf(a)||-1<(e[o].in||[]).indexOf(t)||i.some(function(t){return 0<=(e[o].in||[]).indexOf(t)}))&&(n=!0);c("body").trigger("tinvwl_wishlist_product_marked",[this,n]),c(this).attr("data-tinv-wl-list",JSON.stringify(e)).toggleClass("tinvwl-product-in-list",n).toggleClass("tinvwl-product-make-remove",n&&l).attr("data-tinv-wl-action",n&&l?"remove":"addto")})}),function(t){"1"==window.tinvwl_add_to_wishlist.hide_zero_counter&&0===t&&(t="false");jQuery("i.wishlist-icon").addClass("added"),"false"!==t?(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html(t),jQuery("i.wishlist-icon").attr("data-icon-label",t)):(jQuery(".wishlist_products_counter_number, body.theme-woostify .wishlist-item-count").html("").closest("span.wishlist-counter-with-products").removeClass("wishlist-counter-with-products"),jQuery("i.wishlist-icon").removeAttr("data-icon-label"));var i=!("0"==t||"false"==t);jQuery(".wishlist_products_counter").toggleClass("wishlist-counter-with-products",i),setTimeout(function(){jQuery("i.wishlist-icon").removeClass("added")},500)}(t.counter)}function d(t){l&&(localStorage.setItem(s,t),sessionStorage.setItem(s,t),r(JSON.parse(t)))}}(jQuery),function(o){o(document).ready(function(){if(o("#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">'),o(".tinv-lists-nav").each(function(){o(this).html().trim().length||o(this).remove()}),o("body").on("click",".social-buttons .social:not(.social-email,.social-whatsapp,.social-clipboard)",function(t){var i=window.open(o(this).attr("href"),o(this).attr("title"),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");i&&(i.focus(),t.preventDefault())}),"undefined"!=typeof ClipboardJS){new ClipboardJS(".social-buttons .social.social-clipboard",{text:function(t){return t.getAttribute("href")}}).on("success",function(t){showTooltip(t.trigger,tinvwl_add_to_wishlist.tinvwl_clipboard)});for(var t=document.querySelectorAll(".social-buttons .social.social-clipboard"),i=0;i<t.length;i++)t[i].addEventListener("mouseleave",clearTooltip),t[i].addEventListener("blur",clearTooltip)}o("body").on("click",".social-buttons .social.social-clipboard",function(t){t.preventDefault()}),o("body").on("click",".tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close",function(t){t.preventDefault(),o(this).parents(".tinv-modal:first").removeClass("tinv-modal-open"),o("body").trigger("tinvwl_modal_closed",[this])}),o("body").on("click",".tinv-wishlist .tinvwl-btn-onclick",function(t){o(this).data("url")&&(t.preventDefault(),window.location=o(this).data("url"))});var n=o(".tinv-wishlist .navigation-button");n.length&&n.each(function(){var t=o(this).find("> li");t.length<5&&t.parent().addClass("tinvwl-btns-count-"+t.length)}),o(".tinv-login .showlogin").off("click").on("click",function(t){t.preventDefault(),o(this).closest(".tinv-login").find(".login").toggle()}),o(".tinv-wishlist table.tinvwl-table-manage-list tfoot td").each(function(){o(this).toggle(!!o(this).children().not(".look_in").length||!!o(this).children(".look_in").children().length)})})}(jQuery),function(o){o.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return o(this).val()},rule:function(){var t=o(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(o(this))))}),i)}},n=o.extend(!0,{},i,t);return o(this).each(function(){o(this).on("click",function(t){var i=[];void 0!==o(this).attr("tinvwl_break_submit")&&(i=o(this).attr("tinvwl_break_submit").split(",")),-1!==jQuery.inArray(n.selector,i)&&(i=[]),n.rule.call(o(this))||0!==i.length||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault()),i.push(n.selector),o(this).attr("tinvwl_break_submit",i),n.rule.call(o(this))&&o(this).removeAttr("tinvwl_break_submit")})})},o(document).ready(function(){o(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),o(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return o(this).is(":checked")}}),o(".global-cb").on("click",function(){o(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",o(this).is(":checked"))})})}(jQuery);
|
includes/product.helper.php
CHANGED
@@ -419,7 +419,13 @@ class TInvWL_Product
|
|
419 |
|
420 |
if ($_product->get_id() === absint((apply_filters('wpml_object_id', $wlproduct['product_id'], 'product', false)) ? apply_filters('wpml_object_id', $wlproduct['product_id'], 'product', false) : $wlproduct['product_id'])) {
|
421 |
if (in_array($_product->get_type(), array('variable', 'grouped'))) {
|
422 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
} else {
|
424 |
$products[$key]['data'] = $_product;
|
425 |
}
|
419 |
|
420 |
if ($_product->get_id() === absint((apply_filters('wpml_object_id', $wlproduct['product_id'], 'product', false)) ? apply_filters('wpml_object_id', $wlproduct['product_id'], 'product', false) : $wlproduct['product_id'])) {
|
421 |
if (in_array($_product->get_type(), array('variable', 'grouped'))) {
|
422 |
+
$use_original_id = false;
|
423 |
+
|
424 |
+
if (function_exists('pll_is_translated_post_type')) {
|
425 |
+
$use_original_id = true;
|
426 |
+
}
|
427 |
+
|
428 |
+
$products[$key]['data'] = $wlproduct['variation_id'] ? wc_get_product(apply_filters('wpml_object_id', $wlproduct['variation_id'], 'product_variation', $use_original_id)) : $_product;
|
429 |
} else {
|
430 |
$products[$key]['data'] = $_product;
|
431 |
}
|
languages/ti-woocommerce-wishlist.pot
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
# Copyright (C) 2021 TI WooCommerce Wishlist Plugin - 1.27.
|
2 |
-
# This file is distributed under the same license as the TI WooCommerce Wishlist Plugin - 1.27.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: TI WooCommerce Wishlist Plugin - 1.27.
|
6 |
"MIME-Version: 1.0\n"
|
7 |
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
"Content-Transfer-Encoding: 8bit\n"
|
1 |
+
# Copyright (C) 2021 TI WooCommerce Wishlist Plugin - 1.27.3
|
2 |
+
# This file is distributed under the same license as the TI WooCommerce Wishlist Plugin - 1.27.3 package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: TI WooCommerce Wishlist Plugin - 1.27.3\n"
|
6 |
"MIME-Version: 1.0\n"
|
7 |
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
"Content-Transfer-Encoding: 8bit\n"
|
public/cart.class.php
CHANGED
@@ -7,14 +7,15 @@
|
|
7 |
*/
|
8 |
|
9 |
// If this file is called directly, abort.
|
10 |
-
if (
|
11 |
die;
|
12 |
}
|
13 |
|
14 |
/**
|
15 |
* Cart action for wishlists
|
16 |
*/
|
17 |
-
class TInvWL_Public_Cart
|
|
|
18 |
|
19 |
/**
|
20 |
* Plugin name
|
@@ -50,9 +51,10 @@ class TInvWL_Public_Cart {
|
|
50 |
*
|
51 |
* @return \TInvWL_Public_Cart
|
52 |
*/
|
53 |
-
public static function instance(
|
54 |
-
|
55 |
-
|
|
|
56 |
}
|
57 |
|
58 |
return self::$_instance;
|
@@ -63,7 +65,8 @@ class TInvWL_Public_Cart {
|
|
63 |
*
|
64 |
* @param string $plugin_name Plugin name.
|
65 |
*/
|
66 |
-
function __construct(
|
|
|
67 |
self::$_name = $plugin_name;
|
68 |
$this->define_hooks();
|
69 |
}
|
@@ -71,22 +74,23 @@ class TInvWL_Public_Cart {
|
|
71 |
/**
|
72 |
* Define hooks
|
73 |
*/
|
74 |
-
function define_hooks()
|
75 |
-
|
76 |
-
|
|
|
77 |
} else {
|
78 |
-
add_action(
|
79 |
}
|
80 |
-
if (
|
81 |
-
add_action(
|
82 |
} else {
|
83 |
-
add_action(
|
84 |
}
|
85 |
|
86 |
-
add_action(
|
87 |
|
88 |
-
add_action(
|
89 |
-
add_action(
|
90 |
}
|
91 |
|
92 |
/**
|
@@ -98,39 +102,46 @@ class TInvWL_Public_Cart {
|
|
98 |
*
|
99 |
* @return array|boolean
|
100 |
*/
|
101 |
-
public static function add(
|
102 |
-
|
|
|
103 |
$wishlist = tinv_wishlist_get();
|
104 |
}
|
105 |
$wlp = null;
|
106 |
-
if (
|
107 |
$wlp = TInvWL_Product_Local::instance();
|
108 |
} else {
|
109 |
-
$wlp = new TInvWL_Product(
|
110 |
}
|
111 |
-
$product = $wlp->get_wishlist(
|
112 |
-
$product = array_shift(
|
113 |
-
if (
|
114 |
return false;
|
115 |
}
|
116 |
-
if (
|
117 |
return false;
|
118 |
}
|
119 |
|
120 |
-
$product
|
121 |
-
self::prepare_post(
|
122 |
|
123 |
-
$
|
124 |
-
$quantity = empty( $wl_quantity ) ? 1 : wc_stock_amount( $wl_quantity );
|
125 |
-
$variation_id = $product['variation_id'];
|
126 |
-
$variations = $product['data']->is_type( 'variation' ) ? wc_get_product_variation_attributes( $product['data']->get_id() ) : array();
|
127 |
|
128 |
-
if (
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
// Could be any value that saved to a custom meta.
|
132 |
-
if (
|
133 |
-
$variations[
|
134 |
} else {
|
135 |
continue;
|
136 |
}
|
@@ -138,11 +149,11 @@ class TInvWL_Public_Cart {
|
|
138 |
}
|
139 |
}
|
140 |
|
141 |
-
$passed_validation = $product['data']->is_purchasable() && (
|
142 |
-
$passed_validation = apply_filters(
|
143 |
-
if (
|
144 |
-
$cart_item_key = WC()->cart->add_to_cart(
|
145 |
-
if (
|
146 |
|
147 |
/* Run a 3rd party code when product added to a cart from a wishlist.
|
148 |
*
|
@@ -150,17 +161,17 @@ class TInvWL_Public_Cart {
|
|
150 |
* @param integer $quantity Product quantity.
|
151 |
* @param array $product product data.
|
152 |
* */
|
153 |
-
do_action(
|
154 |
-
$wla = new TInvWL_Analytics(
|
155 |
-
$wla->cart_product(
|
156 |
-
if (
|
157 |
-
self::ar_f_wl(
|
158 |
}
|
159 |
-
self::set_item_data(
|
160 |
-
self::set_item_meta(
|
161 |
self::unprepare_post();
|
162 |
|
163 |
-
return array(
|
164 |
}
|
165 |
}
|
166 |
self::unprepare_post();
|
@@ -173,14 +184,15 @@ class TInvWL_Public_Cart {
|
|
173 |
*
|
174 |
* @param array $product Wishlist Product.
|
175 |
*/
|
176 |
-
public static function prepare_post(
|
177 |
-
|
|
|
178 |
self::$_request = $_REQUEST;
|
179 |
-
if (
|
180 |
-
$_POST
|
181 |
$_REQUEST = $product['meta'];
|
182 |
} else {
|
183 |
-
$_POST
|
184 |
$_REQUEST = array();
|
185 |
}
|
186 |
}
|
@@ -188,8 +200,9 @@ class TInvWL_Public_Cart {
|
|
188 |
/**
|
189 |
* Unprepare _POST data
|
190 |
*/
|
191 |
-
public static function unprepare_post()
|
192 |
-
|
|
|
193 |
$_REQUEST = self::$_request;
|
194 |
}
|
195 |
|
@@ -201,16 +214,17 @@ class TInvWL_Public_Cart {
|
|
201 |
*
|
202 |
* @return array
|
203 |
*/
|
204 |
-
public static function get_item_data(
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
208 |
}
|
209 |
|
210 |
-
if (
|
211 |
-
return $data[
|
212 |
} else {
|
213 |
-
return empty(
|
214 |
}
|
215 |
}
|
216 |
|
@@ -223,19 +237,20 @@ class TInvWL_Public_Cart {
|
|
223 |
*
|
224 |
* @return boolean
|
225 |
*/
|
226 |
-
public static function set_item_data(
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
230 |
}
|
231 |
|
232 |
-
if (
|
233 |
-
$data[
|
234 |
} else {
|
235 |
-
$data[
|
236 |
}
|
237 |
|
238 |
-
WC()->session->set(
|
239 |
|
240 |
return true;
|
241 |
}
|
@@ -247,10 +262,11 @@ class TInvWL_Public_Cart {
|
|
247 |
*
|
248 |
* @return array
|
249 |
*/
|
250 |
-
public static function get_item_meta(
|
251 |
-
|
252 |
-
|
253 |
-
|
|
|
254 |
}
|
255 |
|
256 |
return array();
|
@@ -262,10 +278,11 @@ class TInvWL_Public_Cart {
|
|
262 |
* @param string $cart_item_key Cart product key.
|
263 |
* @param array $meta Meta data.
|
264 |
*/
|
265 |
-
public static function set_item_meta(
|
266 |
-
|
267 |
-
$data
|
268 |
-
|
|
|
269 |
}
|
270 |
|
271 |
/**
|
@@ -276,25 +293,26 @@ class TInvWL_Public_Cart {
|
|
276 |
*
|
277 |
* @return boolean
|
278 |
*/
|
279 |
-
public static function remove_item_data(
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
283 |
|
284 |
return true;
|
285 |
}
|
286 |
-
if (
|
287 |
return false;
|
288 |
}
|
289 |
-
if (
|
290 |
-
unset(
|
291 |
} else {
|
292 |
-
if (
|
293 |
return false;
|
294 |
}
|
295 |
-
unset(
|
296 |
}
|
297 |
-
WC()->session->set(
|
298 |
|
299 |
return true;
|
300 |
}
|
@@ -306,9 +324,10 @@ class TInvWL_Public_Cart {
|
|
306 |
*
|
307 |
* @return boolean
|
308 |
*/
|
309 |
-
public static function remove_item_data_cart_session(
|
310 |
-
|
311 |
-
|
|
|
312 |
|
313 |
return true;
|
314 |
}
|
@@ -319,12 +338,13 @@ class TInvWL_Public_Cart {
|
|
319 |
*
|
320 |
* @param \WC_Order $order Order object.
|
321 |
*/
|
322 |
-
public function add_order_item_meta(
|
323 |
-
|
324 |
-
|
325 |
-
$data =
|
326 |
-
|
327 |
-
|
|
|
328 |
}
|
329 |
}
|
330 |
}
|
@@ -334,24 +354,25 @@ class TInvWL_Public_Cart {
|
|
334 |
*
|
335 |
* @param int $order Order ID.
|
336 |
*/
|
337 |
-
public function purchased_items(
|
338 |
-
|
339 |
-
|
|
|
340 |
return;
|
341 |
}
|
342 |
-
foreach (
|
343 |
|
344 |
-
$_wishlist_cart = self::get_order_item_meta(
|
345 |
|
346 |
-
if (
|
347 |
$wishlist = null;
|
348 |
|
349 |
-
if (
|
350 |
-
reset(
|
351 |
-
$share_key = key(
|
352 |
|
353 |
-
$wl
|
354 |
-
$wishlist = $wl->get_by_share_key(
|
355 |
}
|
356 |
|
357 |
/* Run a 3rd party code when product purchased from wishlist.
|
@@ -360,7 +381,7 @@ class TInvWL_Public_Cart {
|
|
360 |
* @param WC_Order_Item_Product $item Order item product object.
|
361 |
* @param array $wishlist A wishlist data where product added from.
|
362 |
* */
|
363 |
-
do_action(
|
364 |
}
|
365 |
}
|
366 |
}
|
@@ -373,18 +394,19 @@ class TInvWL_Public_Cart {
|
|
373 |
*
|
374 |
* @return array
|
375 |
*/
|
376 |
-
private function get_order_wishlist(
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
|
|
381 |
return null;
|
382 |
}
|
383 |
|
384 |
return $wishlist;
|
385 |
}
|
386 |
-
if (
|
387 |
-
return $wl->add_user_default(
|
388 |
}
|
389 |
|
390 |
return null;
|
@@ -401,33 +423,34 @@ class TInvWL_Public_Cart {
|
|
401 |
*
|
402 |
* @return integer
|
403 |
*/
|
404 |
-
private static function ar_f_wl(
|
405 |
-
|
406 |
-
$
|
407 |
-
$
|
408 |
-
|
|
|
409 |
return $quantity;
|
410 |
}
|
411 |
$wlp = null;
|
412 |
-
if (
|
413 |
$wlp = TInvWL_Product_Local::instance();
|
414 |
} else {
|
415 |
-
$wlp = new TInvWL_Product(
|
416 |
}
|
417 |
-
if (
|
418 |
return 0;
|
419 |
}
|
420 |
-
$products = $wlp->get_wishlist(
|
421 |
-
'product_id'
|
422 |
'variation_id' => $variation_id,
|
423 |
-
'meta'
|
424 |
-
'external'
|
425 |
-
)
|
426 |
-
$product
|
427 |
-
if (
|
428 |
return $quantity;
|
429 |
}
|
430 |
-
$wlp->remove_product_from_wl(
|
431 |
|
432 |
return 0;
|
433 |
}
|
@@ -441,44 +464,45 @@ class TInvWL_Public_Cart {
|
|
441 |
*
|
442 |
* @return void
|
443 |
*/
|
444 |
-
function order_status_analytics(
|
445 |
-
|
446 |
-
$
|
|
|
447 |
|
448 |
-
if (
|
449 |
'processing',
|
450 |
'completed',
|
451 |
-
)
|
452 |
|
453 |
$items = $order->get_items();
|
454 |
-
if (
|
455 |
return;
|
456 |
}
|
457 |
|
458 |
-
foreach (
|
459 |
|
460 |
-
$_wishlist_cart = self::get_order_item_meta(
|
461 |
|
462 |
-
if (
|
463 |
-
$_quantity = absint(
|
464 |
-
if (
|
465 |
-
foreach (
|
466 |
-
if (
|
467 |
break;
|
468 |
}
|
469 |
-
$wishlist = $this->get_order_wishlist(
|
470 |
|
471 |
-
if (
|
472 |
continue;
|
473 |
}
|
474 |
-
$wla = new TInvWL_Analytics(
|
475 |
-
$wla->sell_product_from_wl(
|
476 |
}
|
477 |
}
|
478 |
}
|
479 |
}
|
480 |
|
481 |
-
update_post_meta(
|
482 |
}
|
483 |
}
|
484 |
|
@@ -490,10 +514,11 @@ class TInvWL_Public_Cart {
|
|
490 |
*
|
491 |
* @return mixed
|
492 |
*/
|
493 |
-
public static function get_order_item_meta(
|
|
|
494 |
|
495 |
// Check if wishlist meta exists for current item order.
|
496 |
-
$value = $item->get_meta(
|
497 |
|
498 |
return $value;
|
499 |
}
|
7 |
*/
|
8 |
|
9 |
// If this file is called directly, abort.
|
10 |
+
if (!defined('ABSPATH')) {
|
11 |
die;
|
12 |
}
|
13 |
|
14 |
/**
|
15 |
* Cart action for wishlists
|
16 |
*/
|
17 |
+
class TInvWL_Public_Cart
|
18 |
+
{
|
19 |
|
20 |
/**
|
21 |
* Plugin name
|
51 |
*
|
52 |
* @return \TInvWL_Public_Cart
|
53 |
*/
|
54 |
+
public static function instance($plugin_name = TINVWL_PREFIX)
|
55 |
+
{
|
56 |
+
if (is_null(self::$_instance)) {
|
57 |
+
self::$_instance = new self($plugin_name);
|
58 |
}
|
59 |
|
60 |
return self::$_instance;
|
65 |
*
|
66 |
* @param string $plugin_name Plugin name.
|
67 |
*/
|
68 |
+
function __construct($plugin_name)
|
69 |
+
{
|
70 |
self::$_name = $plugin_name;
|
71 |
$this->define_hooks();
|
72 |
}
|
74 |
/**
|
75 |
* Define hooks
|
76 |
*/
|
77 |
+
function define_hooks()
|
78 |
+
{
|
79 |
+
if (version_compare(WC_VERSION, '3.7.0', '<')) {
|
80 |
+
add_action('woocommerce_before_cart_item_quantity_zero', array(__CLASS__, 'remove_item_data'));
|
81 |
} else {
|
82 |
+
add_action('woocommerce_remove_cart_item', array(__CLASS__, 'remove_item_data'));
|
83 |
}
|
84 |
+
if (version_compare(WC_VERSION, '3.9.0', '<')) {
|
85 |
+
add_action('woocommerce_cart_emptied', array(__CLASS__, 'remove_item_data'));
|
86 |
} else {
|
87 |
+
add_action('woocommerce_cart_emptied', array(__CLASS__, 'remove_item_data_cart_session'));
|
88 |
}
|
89 |
|
90 |
+
add_action('woocommerce_checkout_create_order', array($this, 'add_order_item_meta'));
|
91 |
|
92 |
+
add_action('woocommerce_checkout_update_order_meta', array($this, 'purchased_items'));
|
93 |
+
add_action('woocommerce_order_status_changed', array($this, 'order_status_analytics'), 9, 3);
|
94 |
}
|
95 |
|
96 |
/**
|
102 |
*
|
103 |
* @return array|boolean
|
104 |
*/
|
105 |
+
public static function add($wishlist = null, $wl_product = 0, $wl_quantity = 1)
|
106 |
+
{
|
107 |
+
if (empty($wishlist)) {
|
108 |
$wishlist = tinv_wishlist_get();
|
109 |
}
|
110 |
$wlp = null;
|
111 |
+
if (0 === $wishlist['ID']) {
|
112 |
$wlp = TInvWL_Product_Local::instance();
|
113 |
} else {
|
114 |
+
$wlp = new TInvWL_Product($wishlist);
|
115 |
}
|
116 |
+
$product = $wlp->get_wishlist(array('ID' => $wl_product));
|
117 |
+
$product = array_shift($product);
|
118 |
+
if (empty($product)) {
|
119 |
return false;
|
120 |
}
|
121 |
+
if (empty($product['data'])) {
|
122 |
return false;
|
123 |
}
|
124 |
|
125 |
+
$product = apply_filters('tinvwl_addproduct_tocart', $product);
|
126 |
+
self::prepare_post($product);
|
127 |
|
128 |
+
$use_original_id = false;
|
|
|
|
|
|
|
129 |
|
130 |
+
if (function_exists('pll_is_translated_post_type')) {
|
131 |
+
$use_original_id = true;
|
132 |
+
}
|
133 |
+
|
134 |
+
$product_id = apply_filters('woocommerce_add_to_cart_product_id', apply_filters('wpml_object_id', absint($product['product_id']), 'product', $use_original_id));
|
135 |
+
$quantity = empty($wl_quantity) ? 1 : wc_stock_amount($wl_quantity);
|
136 |
+
$variation_id = apply_filters('wpml_object_id', $product['variation_id'], 'product_variation', $use_original_id);
|
137 |
+
$variations = $product['data']->is_type('variation') ? wc_get_product_variation_attributes(apply_filters('wpml_object_id', $product['data']->get_id(), 'product', $use_original_id)) : array();
|
138 |
+
|
139 |
+
if (!empty($variation_id) && is_array($variations)) {
|
140 |
+
foreach ($variations as $name => $value) {
|
141 |
+
if ('' === $value) {
|
142 |
// Could be any value that saved to a custom meta.
|
143 |
+
if (array_key_exists('meta', $product) && array_key_exists($name, $product['meta'])) {
|
144 |
+
$variations[$name] = $product['meta'][$name];
|
145 |
} else {
|
146 |
continue;
|
147 |
}
|
149 |
}
|
150 |
}
|
151 |
|
152 |
+
$passed_validation = $product['data']->is_purchasable() && ($product['data']->is_in_stock() || $product['data']->backorders_allowed()) && 'external' !== $product['data']->get_type();
|
153 |
+
$passed_validation = apply_filters('woocommerce_add_to_cart_validation', $passed_validation, $product_id, $quantity, $variation_id, $variations);
|
154 |
+
if ($passed_validation) {
|
155 |
+
$cart_item_key = WC()->cart->add_to_cart($product_id, $quantity, $variation_id, $variations);
|
156 |
+
if ($cart_item_key) {
|
157 |
|
158 |
/* Run a 3rd party code when product added to a cart from a wishlist.
|
159 |
*
|
161 |
* @param integer $quantity Product quantity.
|
162 |
* @param array $product product data.
|
163 |
* */
|
164 |
+
do_action('tinvwl_product_added_to_cart', $cart_item_key, $quantity, $product);
|
165 |
+
$wla = new TInvWL_Analytics($wishlist, self::$_name);
|
166 |
+
$wla->cart_product($product_id, $variation_id);
|
167 |
+
if (('private' !== $wishlist['status'] && tinv_get_option('processing', 'autoremove_anyone')) || $wishlist['is_owner'] && 'tinvwl-addcart' === tinv_get_option('processing', 'autoremove_status')) {
|
168 |
+
self::ar_f_wl($wishlist, $product_id, $quantity, $variation_id, $product['meta']);
|
169 |
}
|
170 |
+
self::set_item_data($cart_item_key, $wishlist['share_key'], $quantity);
|
171 |
+
self::set_item_meta($cart_item_key, $product['meta']);
|
172 |
self::unprepare_post();
|
173 |
|
174 |
+
return array($product_id => $quantity);
|
175 |
}
|
176 |
}
|
177 |
self::unprepare_post();
|
184 |
*
|
185 |
* @param array $product Wishlist Product.
|
186 |
*/
|
187 |
+
public static function prepare_post($product)
|
188 |
+
{
|
189 |
+
self::$_post = $_POST; // @codingStandardsIgnoreLine WordPress.VIP.SuperGlobalInputUsage.AccessDetected
|
190 |
self::$_request = $_REQUEST;
|
191 |
+
if (array_key_exists('meta', $product) && !empty($product['meta'])) {
|
192 |
+
$_POST = $product['meta']; // May be a conflict there will be no GET attributes.
|
193 |
$_REQUEST = $product['meta'];
|
194 |
} else {
|
195 |
+
$_POST = array();
|
196 |
$_REQUEST = array();
|
197 |
}
|
198 |
}
|
200 |
/**
|
201 |
* Unprepare _POST data
|
202 |
*/
|
203 |
+
public static function unprepare_post()
|
204 |
+
{
|
205 |
+
$_POST = self::$_post;
|
206 |
$_REQUEST = self::$_request;
|
207 |
}
|
208 |
|
214 |
*
|
215 |
* @return array
|
216 |
*/
|
217 |
+
public static function get_item_data($cart_item_key, $wishlist = null)
|
218 |
+
{
|
219 |
+
$data = (array)WC()->session->get('tinvwl_wishlist_cart', array());
|
220 |
+
if (empty($data[$cart_item_key])) {
|
221 |
+
$data[$cart_item_key] = array();
|
222 |
}
|
223 |
|
224 |
+
if (empty($wishlist)) {
|
225 |
+
return $data[$cart_item_key];
|
226 |
} else {
|
227 |
+
return empty($data[$cart_item_key][$wishlist]) ? 0 : $data[$cart_item_key][$wishlist];
|
228 |
}
|
229 |
}
|
230 |
|
237 |
*
|
238 |
* @return boolean
|
239 |
*/
|
240 |
+
public static function set_item_data($cart_item_key, $wishlist, $quantity = 1)
|
241 |
+
{
|
242 |
+
$data = (array)WC()->session->get('tinvwl_wishlist_cart', array());
|
243 |
+
if (empty($data[$cart_item_key])) {
|
244 |
+
$data[$cart_item_key] = array();
|
245 |
}
|
246 |
|
247 |
+
if (array_key_exists($wishlist, $data[$cart_item_key])) {
|
248 |
+
$data[$cart_item_key][$wishlist] += $quantity;
|
249 |
} else {
|
250 |
+
$data[$cart_item_key][$wishlist] = $quantity;
|
251 |
}
|
252 |
|
253 |
+
WC()->session->set('tinvwl_wishlist_cart', $data);
|
254 |
|
255 |
return true;
|
256 |
}
|
262 |
*
|
263 |
* @return array
|
264 |
*/
|
265 |
+
public static function get_item_meta($cart_item_key)
|
266 |
+
{
|
267 |
+
$data = (array)WC()->session->get('tinvwl_wishlist_meta', array());
|
268 |
+
if (array_key_exists($cart_item_key, $data)) {
|
269 |
+
return $data[$cart_item_key];
|
270 |
}
|
271 |
|
272 |
return array();
|
278 |
* @param string $cart_item_key Cart product key.
|
279 |
* @param array $meta Meta data.
|
280 |
*/
|
281 |
+
public static function set_item_meta($cart_item_key, $meta = array())
|
282 |
+
{
|
283 |
+
$data = (array)WC()->session->get('tinvwl_wishlist_meta', array());
|
284 |
+
$data[$cart_item_key] = $meta;
|
285 |
+
WC()->session->set('tinvwl_wishlist_meta', $data);
|
286 |
}
|
287 |
|
288 |
/**
|
293 |
*
|
294 |
* @return boolean
|
295 |
*/
|
296 |
+
public static function remove_item_data($cart_item_key = null, $wishlist = null)
|
297 |
+
{
|
298 |
+
$data = (array)WC()->session->get('tinvwl_wishlist_cart', array());
|
299 |
+
if (empty($cart_item_key)) {
|
300 |
+
WC()->session->set('tinvwl_wishlist_cart', array());
|
301 |
|
302 |
return true;
|
303 |
}
|
304 |
+
if (!array_key_exists($cart_item_key, $data)) {
|
305 |
return false;
|
306 |
}
|
307 |
+
if (empty($wishlist)) {
|
308 |
+
unset($data[$cart_item_key]);
|
309 |
} else {
|
310 |
+
if (!array_key_exists($wishlist, $data[$cart_item_key])) {
|
311 |
return false;
|
312 |
}
|
313 |
+
unset($data[$cart_item_key][$wishlist]);
|
314 |
}
|
315 |
+
WC()->session->set('tinvwl_wishlist_cart', $data);
|
316 |
|
317 |
return true;
|
318 |
}
|
324 |
*
|
325 |
* @return boolean
|
326 |
*/
|
327 |
+
public static function remove_item_data_cart_session($clear_persistent_cart = true)
|
328 |
+
{
|
329 |
+
if ($clear_persistent_cart) {
|
330 |
+
WC()->session->set('tinvwl_wishlist_cart', array());
|
331 |
|
332 |
return true;
|
333 |
}
|
338 |
*
|
339 |
* @param \WC_Order $order Order object.
|
340 |
*/
|
341 |
+
public function add_order_item_meta($order)
|
342 |
+
{
|
343 |
+
foreach ($order->get_items() as $item) {
|
344 |
+
$data = self::get_item_data($item->legacy_cart_item_key);
|
345 |
+
$data = apply_filters('tinvwl_addproduct_toorder', $data, $item->legacy_cart_item_key, $item->legacy_values);
|
346 |
+
if (!empty($data)) {
|
347 |
+
$item->update_meta_data('_tinvwl_wishlist_cart', $data);
|
348 |
}
|
349 |
}
|
350 |
}
|
354 |
*
|
355 |
* @param int $order Order ID.
|
356 |
*/
|
357 |
+
public function purchased_items($order_id)
|
358 |
+
{
|
359 |
+
$order = wc_get_order($order_id);
|
360 |
+
if (!$order) {
|
361 |
return;
|
362 |
}
|
363 |
+
foreach ($order->get_items() as $item) {
|
364 |
|
365 |
+
$_wishlist_cart = self::get_order_item_meta($item, '_tinvwl_wishlist_cart');
|
366 |
|
367 |
+
if ($_wishlist_cart) {
|
368 |
$wishlist = null;
|
369 |
|
370 |
+
if (is_array($_wishlist_cart)) {
|
371 |
+
reset($_wishlist_cart);
|
372 |
+
$share_key = key($_wishlist_cart);
|
373 |
|
374 |
+
$wl = new TInvWL_Wishlist();
|
375 |
+
$wishlist = $wl->get_by_share_key($share_key);
|
376 |
}
|
377 |
|
378 |
/* Run a 3rd party code when product purchased from wishlist.
|
381 |
* @param WC_Order_Item_Product $item Order item product object.
|
382 |
* @param array $wishlist A wishlist data where product added from.
|
383 |
* */
|
384 |
+
do_action('tinvwl_product_purchased', $order, $item, $wishlist);
|
385 |
}
|
386 |
}
|
387 |
}
|
394 |
*
|
395 |
* @return array
|
396 |
*/
|
397 |
+
private function get_order_wishlist($key, $user_id = 0)
|
398 |
+
{
|
399 |
+
$wl = new TInvWL_Wishlist(self::$_name);
|
400 |
+
if (!empty($key)) {
|
401 |
+
$wishlist = $wl->get_by_share_key($key);
|
402 |
+
if (!empty($user_id) && ($wishlist['author'] !== $user_id && !((tinv_get_option('processing', 'autoremove_anyone_type') ? tinv_get_option('processing', 'autoremove_anyone_type') === $wishlist['status'] : 'private' !== $wishlist['status']) && tinv_get_option('processing', 'autoremove_anyone')))) {
|
403 |
return null;
|
404 |
}
|
405 |
|
406 |
return $wishlist;
|
407 |
}
|
408 |
+
if (!empty($user_id)) {
|
409 |
+
return $wl->add_user_default($user_id);
|
410 |
}
|
411 |
|
412 |
return null;
|
423 |
*
|
424 |
* @return integer
|
425 |
*/
|
426 |
+
private static function ar_f_wl($wishlist, $product_id, $quantity = 1, $variation_id = 0, $meta = array())
|
427 |
+
{
|
428 |
+
$product_id = absint($product_id);
|
429 |
+
$quantity = absint($quantity);
|
430 |
+
$variation_id = absint($variation_id);
|
431 |
+
if (!tinv_get_option('processing', 'autoremove') || empty($wishlist) || empty($product_id) || empty($quantity)) {
|
432 |
return $quantity;
|
433 |
}
|
434 |
$wlp = null;
|
435 |
+
if (0 === $wishlist['ID']) {
|
436 |
$wlp = TInvWL_Product_Local::instance();
|
437 |
} else {
|
438 |
+
$wlp = new TInvWL_Product($wishlist, self::$_name);
|
439 |
}
|
440 |
+
if (empty($wlp)) {
|
441 |
return 0;
|
442 |
}
|
443 |
+
$products = $wlp->get_wishlist(array(
|
444 |
+
'product_id' => $product_id,
|
445 |
'variation_id' => $variation_id,
|
446 |
+
'meta' => $meta,
|
447 |
+
'external' => false,
|
448 |
+
));
|
449 |
+
$product = array_shift($products);
|
450 |
+
if (empty($product)) {
|
451 |
return $quantity;
|
452 |
}
|
453 |
+
$wlp->remove_product_from_wl(0, $product_id, $variation_id, $product['meta']);
|
454 |
|
455 |
return 0;
|
456 |
}
|
464 |
*
|
465 |
* @return void
|
466 |
*/
|
467 |
+
function order_status_analytics($order_id, $old_status, $new_status)
|
468 |
+
{
|
469 |
+
$new_status = str_replace('wc-', '', $new_status);
|
470 |
+
$order = new WC_Order($order_id);
|
471 |
|
472 |
+
if (in_array($new_status, array(
|
473 |
'processing',
|
474 |
'completed',
|
475 |
+
)) && empty(get_post_meta($order_id, '_wishlist_analytics_processed', true))) {
|
476 |
|
477 |
$items = $order->get_items();
|
478 |
+
if (empty($items) || !is_array($items)) {
|
479 |
return;
|
480 |
}
|
481 |
|
482 |
+
foreach ($items as $item) {
|
483 |
|
484 |
+
$_wishlist_cart = self::get_order_item_meta($item, '_tinvwl_wishlist_cart');
|
485 |
|
486 |
+
if ($_wishlist_cart) {
|
487 |
+
$_quantity = absint($item['qty']);
|
488 |
+
if (is_array($_wishlist_cart)) {
|
489 |
+
foreach (array_keys($_wishlist_cart) as $key) {
|
490 |
+
if (0 >= $_quantity) {
|
491 |
break;
|
492 |
}
|
493 |
+
$wishlist = $this->get_order_wishlist($key);
|
494 |
|
495 |
+
if (empty($wishlist)) {
|
496 |
continue;
|
497 |
}
|
498 |
+
$wla = new TInvWL_Analytics($wishlist, self::$_name);
|
499 |
+
$wla->sell_product_from_wl($item['product_id'], $item['variation_id']);
|
500 |
}
|
501 |
}
|
502 |
}
|
503 |
}
|
504 |
|
505 |
+
update_post_meta($order_id, '_wishlist_analytics_processed', '1');
|
506 |
}
|
507 |
}
|
508 |
|
514 |
*
|
515 |
* @return mixed
|
516 |
*/
|
517 |
+
public static function get_order_item_meta($item, $key)
|
518 |
+
{
|
519 |
|
520 |
// Check if wishlist meta exists for current item order.
|
521 |
+
$value = $item->get_meta($key);
|
522 |
|
523 |
return $value;
|
524 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: templateinvaders
|
|
3 |
Tags: woocommerce, wishlist, woocommerce wishlist, e-commerce, ecommerce
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 5.8
|
6 |
-
Stable tag: 1.27.
|
7 |
License: GPLv3
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
@@ -163,10 +163,16 @@ Yes, you can! Join in on our [GitHub repository](https://github.com/TemplateInva
|
|
163 |
|
164 |
|
165 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
= 1.27.2 =
|
167 |
*Release Date - 11 August 2021*
|
168 |
|
169 |
-
* Fixed products in wishlist issue for WPML different languages
|
170 |
* Fixed PHP fatal error
|
171 |
|
172 |
= 1.27.1 =
|
3 |
Tags: woocommerce, wishlist, woocommerce wishlist, e-commerce, ecommerce
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 5.8
|
6 |
+
Stable tag: 1.27.3
|
7 |
License: GPLv3
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
163 |
|
164 |
|
165 |
== Changelog ==
|
166 |
+
= 1.27.3 =
|
167 |
+
*Release Date - 12 August 2021*
|
168 |
+
|
169 |
+
* Fixed variable products issue with [Polylang](https://wordpress.org/plugins/polylang/) plugin
|
170 |
+
* Fixed product translation issue for [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) plugin when product added to cart from wishlist
|
171 |
+
|
172 |
= 1.27.2 =
|
173 |
*Release Date - 11 August 2021*
|
174 |
|
175 |
+
* Fixed products in wishlist issue for [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) different languages
|
176 |
* Fixed PHP fatal error
|
177 |
|
178 |
= 1.27.1 =
|
ti-woocommerce-wishlist.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: TI WooCommerce Wishlist
|
5 |
* Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
6 |
* Description: Wishlist functionality for your WooCommerce store.
|
7 |
-
* Version: 1.27.
|
8 |
* Requires at least: 4.7
|
9 |
* Tested up to: 5.8
|
10 |
* WC requires at least: 3.0
|
@@ -41,7 +41,7 @@ if (!defined('TINVWL_DOMAIN')) {
|
|
41 |
}
|
42 |
|
43 |
if (!defined('TINVWL_FVERSION')) {
|
44 |
-
define('TINVWL_FVERSION', '1.27.
|
45 |
}
|
46 |
|
47 |
if (!defined('TINVWL_LOAD_FREE')) {
|
4 |
* Plugin Name: TI WooCommerce Wishlist
|
5 |
* Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
6 |
* Description: Wishlist functionality for your WooCommerce store.
|
7 |
+
* Version: 1.27.3
|
8 |
* Requires at least: 4.7
|
9 |
* Tested up to: 5.8
|
10 |
* WC requires at least: 3.0
|
41 |
}
|
42 |
|
43 |
if (!defined('TINVWL_FVERSION')) {
|
44 |
+
define('TINVWL_FVERSION', '1.27.3');
|
45 |
}
|
46 |
|
47 |
if (!defined('TINVWL_LOAD_FREE')) {
|