Version Description
Release Date - 14 April 2019
- WooCommerce PPOM plugin integration updated
- Fixed analytics purchase count issue
Download this release
Release Info
Developer | templateinvaders |
Plugin | WooCommerce Wishlist Plugin |
Version | 1.10.1 |
Comparing to | |
See all releases |
Code changes from version 1.10.0 to 1.10.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.min.js +1 -1
- includes/analytics.class.php +538 -497
- languages/ti-woocommerce-wishlist.pot +4 -4
- public/cart.class.php +81 -9
- readme.txt +8 -2
- templates/ti-wishlist-item-data.php +7 -6
- ti-woocommerce-wishlist.php +2 -2
- tinv-wishlists-function-integration.php +3 -6
- tinv-wishlists-function.php +3 -1
assets/css/admin.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* 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.10.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:'tinvwl-webfont';src:url("../fonts/tinvwl-webfont.eot?xu2uyi");src:url("../fonts/tinvwl-webfont.eot?xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.ttf?xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.woff?xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.svg?xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
1 |
/**
|
2 |
* 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.10.1
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:'tinvwl-webfont';src:url("../fonts/tinvwl-webfont.eot?xu2uyi");src:url("../fonts/tinvwl-webfont.eot?xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.ttf?xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.woff?xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.svg?xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
assets/css/public.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* 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.10.
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:'tinvwl-webfont';src:url("../fonts/tinvwl-webfont.eot?xu2uyi");src:url("../fonts/tinvwl-webfont.eot?xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.ttf?xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.woff?xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.svg?xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
1 |
/**
|
2 |
* 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.10.1
|
4 |
* @link https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
5 |
*/
|
6 |
@font-face{font-family:'tinvwl-webfont';src:url("../fonts/tinvwl-webfont.eot?xu2uyi");src:url("../fonts/tinvwl-webfont.eot?xu2uyi#iefix") format("embedded-opentype"),url("../fonts/tinvwl-webfont.ttf?xu2uyi") format("truetype"),url("../fonts/tinvwl-webfont.woff?xu2uyi") format("woff"),url("../fonts/tinvwl-webfont.svg?xu2uyi#tinvwl-webfont") format("svg");font-weight:normal;font-style:normal}
|
assets/css/theme.min.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* 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.10.
|
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 |
* 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.10.1
|
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/js/admin.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* 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.10.
|
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()?n.preventDefault():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.attr("type","checkbox").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(){var t=s(this),n=function(){var t=s(this),n=t.attr("tiwl-show"),i=t.attr("tiwl-hide"),e=c.isChecked.call(t),o=function(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){c.onEachElm.call(s(n).toggle(i))})};return"string"==typeof n&&o(n,e),"string"==typeof i&&o(i,!e),t};return t.is("input")&&"checkbox"==t.attr("type")?(s(this).on("change",n),n.call(t)):t})},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(){var t=s(this),n=function(e){var t=s(this),n=t.attr("tiwl-show"),i=t.attr("tiwl-hide"),o=e.onClick.call(t),c=function(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){e.onEachElm.call(s(n).toggle(i))})};return"string"==typeof n&&c(n,o),"string"==typeof i&&c(i,!o),t};return t.is("input")||t.is("select")?(s(this).on("change",function(){n.call(this,i)}),n.call(t,i)):t})};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")})})}(jQuery);
|
1 |
/**
|
2 |
* 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.10.1
|
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()?n.preventDefault():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.attr("type","checkbox").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(){var t=s(this),n=function(){var t=s(this),n=t.attr("tiwl-show"),i=t.attr("tiwl-hide"),e=c.isChecked.call(t),o=function(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){c.onEachElm.call(s(n).toggle(i))})};return"string"==typeof n&&o(n,e),"string"==typeof i&&o(i,!e),t};return t.is("input")&&"checkbox"==t.attr("type")?(s(this).on("change",n),n.call(t)):t})},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(){var t=s(this),n=function(e){var t=s(this),n=t.attr("tiwl-show"),i=t.attr("tiwl-hide"),o=e.onClick.call(t),c=function(t,i){t=t.match(/[\w\d-\>\.\#\:\=\[\]]+/gim)||[],s.each(t,function(t,n){e.onEachElm.call(s(n).toggle(i))})};return"string"==typeof n&&c(n,o),"string"==typeof i&&c(i,!o),t};return t.is("input")||t.is("select")?(s(this).on("change",function(){n.call(this,i)}),n.call(t,i)):t})};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")})})}(jQuery);
|
assets/js/public.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* 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.10.
|
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 update_cart_hash(){jQuery(document.body).on("wc_fragments_loaded.wishlist wc_fragments_refreshed.wishlist",function(){if("undefined"==typeof wc_cart_fragments_params)return!1;var t=wc_cart_fragments_params.cart_hash_key;localStorage.setItem(t,localStorage.getItem(t)+(new Date).getTime()),sessionStorage.setItem(t,sessionStorage.getItem(t)+(new Date).getTime()),jQuery(document.body).off("wc_fragments_loaded.wishlist wc_fragments_refreshed.wishlist")})}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(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(t){r(t).addClass("tinv-modal-open"),r(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){r(t).removeClass("tinv-modal-open"),r(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(r(this).is(".disabled-add-wishlist"))return!1;r(this).is(".ftinvwl-animated")&&r(this).addClass("ftinvwl-pulse"),this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):o.onActionProduct.call(this),update_cart_hash()},onPrepareDataAction:function(){},filterProductAlreadyIn:function(t){t=t||[];var n={};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"),e=r(this).val();"checkbox"===i||"radio"===i?r(this).is(":checked")&&(n["form"+t]=e):n["form"+t]=e}),n=n.formvariation_id,t.filter(function(t){if("object"!==_typeof(t.in)||"string"!=typeof n)return t.in;var i=parseInt(n);return 0<=t.in.indexOf(i)})},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 e="";switch(t.length){case 0:break;default:e=r("<ul>");r.each(t,function(t,i){e.append(r("<li>").html(r("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}e.length&&r(this).closest(".tinv-modal-inner").find("img").after(r("<div>").addClass("already-in").html(o.text_already_in+" ").append(e))},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 e=r.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),n=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash",o=sessionStorage.getItem(n),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){e[t]=i}),localStorage.setItem(n,localStorage.getItem(n)+(new Date).getTime()),sessionStorage.setItem(n,sessionStorage.getItem(n)+(new Date).getTime()),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(e)),!e||!e["div.widget_shopping_cart_content"]||o!==a)throw"No fragment";r.each(e,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",redirect:window.location.href},e=this;r(e).closest("form.cart[method=post], .tinvwl-loop-button-wrapper").find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").each(function(){var t=r(this).attr("name"),i=r(this).attr("type"),e=r(this).val(),n=10,o=function t(i,e){if("object"!==_typeof(e))return e;for(var n in void 0===i&&(i={}),e)if(""===n){var o=-1;for(o in i)o=o;i[o=parseInt(o)+1]=t(i[n],e[n])}else i[n]=t(i[n],e[n]);return i};if("button"!==i&&void 0!==t&&"attribute_"!=t.substr(0,10)){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<n;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=e,e=l}t=a[1],n--}"checkbox"===i||"radio"===i?r(this).is(":checked")&&(e.length||"object"===_typeof(e)||(e=!0),s.form[t]=o(s.form[t],e)):s.form[t]=o(s.form[t],e)}}),s=o.onPrepareDataAction.call(e,s)||s,r.post(o.api_url,s,function(t){if(o.onDialogHide.call(e.tinvwl_dialog,e),"object"===_typeof(t))for(var i in t)"function"==typeof o.onAction[i]&&o.onAction[i].call(e,t[i]);else"function"==typeof o.onAction.msg&&o.onAction.msg.call(e,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 e=r(this).find(o.class.select).eq(0);r(this).find(o.class.newtitle).hide().val(""),e.html(""),r.each(t,function(t,i){o.onCreateWishList.call(e,i)}),o.text_create&&o.onCreateWishList.call(e,{ID:"",title:o.text_create,in:!1}),o.onMultiProductAlreadyIn.call(e,t),o.onSelectWishList.call(e,t),r(this).find(o.class.newtitle).toggle(""===e.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,this)):o.onActionProduct.call(this)});var n=this;r(this.tinvwl_dialog).find(o.class.dialogbutton).off("click").on("click",function(){var t,i=r(n.tinvwl_dialog).find(o.class.select),e=r(n.tinvwl_dialog).find(o.class.newtitle);i.val()||e.val()?o.onActionProduct.call(n,i.val(),e.val()):((t=e.is(":visible")?e: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(document).on("hide_variation",".variations_form",function(t){var i=r(this).find(".tinvwl_add_to_wishlist_button");i.length&&!tinvwl_add_to_wishlist.allow_parent_variable&&(t.preventDefault(),i.addClass("disabled-add-wishlist"))}),r(document).on("show_variation",".variations_form",function(t,i,e){var n=r(this).find(".tinvwl_add_to_wishlist_button");if(n.length){var o=JSON.parse(n.attr("data-tinv-wl-list")),a=!1,l="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var s in o)o[s].hasOwnProperty("in")&&Array.isArray(o[s].in)&&-1<(o[s].in||[]).indexOf(i.variation_id)&&(a=!0);n.toggleClass("tinvwl-product-in-list",a).toggleClass("tinvwl-product-make-remove",a&&l).attr("data-tinv-wl-action",a&&l?"remove":"addto"),t.preventDefault(),n.removeClass("disabled-add-wishlist")}})})}(jQuery),function(n){n(document).ready(function(){if(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][title!=whatsapp][title!=clipboard]",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())}),"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)}n("body").on("click",".social-buttons .social.social-clipboard",function(t){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 e=n(".tinv-wishlist .navigation-button");e.length&&e.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(){var t=!("0"==n(".wishlist_products_counter_number").html()||""==n(".wishlist_products_counter_number").html());n(".wishlist_products_counter").toggleClass("wishlist-counter-with-products",t)}),update_cart_hash()}(jQuery),function(n){n.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return n(this).val()},rule:function(){var t=n(this).parents("form").eq(0).find(e.selector),i=e.invert;return 0===t.length?e.ifempty:(t.each(function(){i&&!e.invert||!i&&e.invert||(i=Boolean(e.validate.call(n(this))))}),i)}},e=n.extend(!0,{},i,t);return n(this).each(function(){n(this).on("click",function(t){e.rule.call(n(this))||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault())})})},n(document).ready(function(){n(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),n(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return n(this).is(":checked")}}),n(".global-cb").on("click",function(){n(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",n(this).is(":checked"))})})}(jQuery);
|
1 |
/**
|
2 |
* 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.10.1
|
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 update_cart_hash(){jQuery(document.body).on("wc_fragments_loaded.wishlist wc_fragments_refreshed.wishlist",function(){if("undefined"==typeof wc_cart_fragments_params)return!1;var t=wc_cart_fragments_params.cart_hash_key;localStorage.setItem(t,localStorage.getItem(t)+(new Date).getTime()),sessionStorage.setItem(t,sessionStorage.getItem(t)+(new Date).getTime()),jQuery(document.body).off("wc_fragments_loaded.wishlist wc_fragments_refreshed.wishlist")})}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(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(t){r(t).addClass("tinv-modal-open"),r(t).removeClass("ftinvwl-pulse")},onDialogHide:function(t){r(t).removeClass("tinv-modal-open"),r(t).removeClass("ftinvwl-pulse")},onInited:function(){},onClick:function(){if(r(this).is(".disabled-add-wishlist"))return!1;r(this).is(".ftinvwl-animated")&&r(this).addClass("ftinvwl-pulse"),this.tinvwl_dialog?this.tinvwl_dialog.show_list.call(this):o.onActionProduct.call(this),update_cart_hash()},onPrepareDataAction:function(){},filterProductAlreadyIn:function(t){t=t||[];var n={};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"),e=r(this).val();"checkbox"===i||"radio"===i?r(this).is(":checked")&&(n["form"+t]=e):n["form"+t]=e}),n=n.formvariation_id,t.filter(function(t){if("object"!==_typeof(t.in)||"string"!=typeof n)return t.in;var i=parseInt(n);return 0<=t.in.indexOf(i)})},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 e="";switch(t.length){case 0:break;default:e=r("<ul>");r.each(t,function(t,i){e.append(r("<li>").html(r("<a>").html(i.title).attr({href:i.url})).val(i.ID))})}e.length&&r(this).closest(".tinv-modal-inner").find("img").after(r("<div>").addClass("already-in").html(o.text_already_in+" ").append(e))},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 e=r.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),n=wc_cart_fragments_params.ajax_url.toString()+"-wc_cart_hash",o=sessionStorage.getItem(n),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){e[t]=i}),localStorage.setItem(n,localStorage.getItem(n)+(new Date).getTime()),sessionStorage.setItem(n,sessionStorage.getItem(n)+(new Date).getTime()),sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(e)),!e||!e["div.widget_shopping_cart_content"]||o!==a)throw"No fragment";r.each(e,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",redirect:window.location.href},e=this;r(e).closest("form.cart[method=post], .tinvwl-loop-button-wrapper").find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").each(function(){var t=r(this).attr("name"),i=r(this).attr("type"),e=r(this).val(),n=10,o=function t(i,e){if("object"!==_typeof(e))return e;for(var n in void 0===i&&(i={}),e)if(""===n){var o=-1;for(o in i)o=o;i[o=parseInt(o)+1]=t(i[n],e[n])}else i[n]=t(i[n],e[n]);return i};if("button"!==i&&void 0!==t&&"attribute_"!=t.substr(0,10)){for(;/^(.+)\[([^\[\]]*?)\]$/.test(t)&&0<n;){var a=t.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===a.length){var l={};l[a[2]]=e,e=l}t=a[1],n--}"checkbox"===i||"radio"===i?r(this).is(":checked")&&(e.length||"object"===_typeof(e)||(e=!0),s.form[t]=o(s.form[t],e)):s.form[t]=o(s.form[t],e)}}),s=o.onPrepareDataAction.call(e,s)||s,r.post(o.api_url,s,function(t){if(o.onDialogHide.call(e.tinvwl_dialog,e),"object"===_typeof(t))for(var i in t)"function"==typeof o.onAction[i]&&o.onAction[i].call(e,t[i]);else"function"==typeof o.onAction.msg&&o.onAction.msg.call(e,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 e=r(this).find(o.class.select).eq(0);r(this).find(o.class.newtitle).hide().val(""),e.html(""),r.each(t,function(t,i){o.onCreateWishList.call(e,i)}),o.text_create&&o.onCreateWishList.call(e,{ID:"",title:o.text_create,in:!1}),o.onMultiProductAlreadyIn.call(e,t),o.onSelectWishList.call(e,t),r(this).find(o.class.newtitle).toggle(""===e.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,this)):o.onActionProduct.call(this)});var n=this;r(this.tinvwl_dialog).find(o.class.dialogbutton).off("click").on("click",function(){var t,i=r(n.tinvwl_dialog).find(o.class.select),e=r(n.tinvwl_dialog).find(o.class.newtitle);i.val()||e.val()?o.onActionProduct.call(n,i.val(),e.val()):((t=e.is(":visible")?e: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(document).on("hide_variation",".variations_form",function(t){var i=r(this).find(".tinvwl_add_to_wishlist_button");i.length&&!tinvwl_add_to_wishlist.allow_parent_variable&&(t.preventDefault(),i.addClass("disabled-add-wishlist"))}),r(document).on("show_variation",".variations_form",function(t,i,e){var n=r(this).find(".tinvwl_add_to_wishlist_button");if(n.length){var o=JSON.parse(n.attr("data-tinv-wl-list")),a=!1,l="1"==window.tinvwl_add_to_wishlist.simple_flow;for(var s in o)o[s].hasOwnProperty("in")&&Array.isArray(o[s].in)&&-1<(o[s].in||[]).indexOf(i.variation_id)&&(a=!0);n.toggleClass("tinvwl-product-in-list",a).toggleClass("tinvwl-product-make-remove",a&&l).attr("data-tinv-wl-action",a&&l?"remove":"addto"),t.preventDefault(),n.removeClass("disabled-add-wishlist")}})})}(jQuery),function(n){n(document).ready(function(){if(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][title!=whatsapp][title!=clipboard]",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())}),"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)}n("body").on("click",".social-buttons .social.social-clipboard",function(t){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 e=n(".tinv-wishlist .navigation-button");e.length&&e.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(){var t=!("0"==n(".wishlist_products_counter_number").html()||""==n(".wishlist_products_counter_number").html());n(".wishlist_products_counter").toggleClass("wishlist-counter-with-products",t)}),update_cart_hash()}(jQuery),function(n){n.fn.tinvwl_break_submit=function(t){var i={selector:"input, select, textarea",ifempty:!0,invert:!1,validate:function(){return n(this).val()},rule:function(){var t=n(this).parents("form").eq(0).find(e.selector),i=e.invert;return 0===t.length?e.ifempty:(t.each(function(){i&&!e.invert||!i&&e.invert||(i=Boolean(e.validate.call(n(this))))}),i)}},e=n.extend(!0,{},i,t);return n(this).each(function(){n(this).on("click",function(t){e.rule.call(n(this))||(alert(window.tinvwl_add_to_wishlist.tinvwl_break_submit),t.preventDefault())})})},n(document).ready(function(){n(".tinvwl-break-input").tinvwl_break_submit({selector:".tinvwl-break-input-filed"}),n(".tinvwl-break-checkbox").tinvwl_break_submit({selector:"table td input[type=checkbox]",validate:function(){return n(this).is(":checked")}}),n(".global-cb").on("click",function(){n(this).closest("table").eq(0).find(".product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]").prop("checked",n(this).is(":checked"))})})}(jQuery);
|
includes/analytics.class.php
CHANGED
@@ -1,497 +1,538 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Analytics function class
|
4 |
-
*
|
5 |
-
* @since 1.
|
6 |
-
* @package TInvWishlist\Analytics
|
7 |
-
*/
|
8 |
-
|
9 |
-
// If this file is called directly, abort.
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Analytics function class
|
16 |
-
*/
|
17 |
-
class TInvWL_Analytics {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Database table
|
21 |
-
*
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
private $table;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Plugin name
|
28 |
-
*
|
29 |
-
* @var string
|
30 |
-
*/
|
31 |
-
private $_name;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Constructor
|
35 |
-
*
|
36 |
-
* @
|
37 |
-
* @param
|
38 |
-
*
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$this->
|
45 |
-
$this->
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
*
|
51 |
-
*
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
*
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
*
|
77 |
-
*
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$product_data
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
) )
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
*
|
156 |
-
*
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
*
|
168 |
-
*
|
169 |
-
* @param integer $
|
170 |
-
* @param integer $
|
171 |
-
*
|
172 |
-
* @return boolean
|
173 |
-
*/
|
174 |
-
function
|
175 |
-
return $this->_product( '
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
*
|
180 |
-
*
|
181 |
-
* @param integer $product_id Product id.
|
182 |
-
* @param integer $variation_id Product variation id.
|
183 |
-
* @param integer $quantity Quantity applyed product.
|
184 |
-
*
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
*
|
193 |
-
*
|
194 |
-
* @param integer $
|
195 |
-
* @param integer $
|
196 |
-
* @
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
*
|
206 |
-
*
|
207 |
-
* @param integer $
|
208 |
-
* @
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
*
|
219 |
-
*
|
220 |
-
* @
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
*
|
232 |
-
*
|
233 |
-
* @param integer $
|
234 |
-
* @param integer $
|
235 |
-
* @
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
$
|
257 |
-
'
|
258 |
-
'
|
259 |
-
'
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
$
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
$
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
$
|
399 |
-
}
|
400 |
-
$
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
if ( empty( $
|
427 |
-
return array();
|
428 |
-
}
|
429 |
-
|
430 |
-
foreach ( $
|
431 |
-
$
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
*
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
$wishlist_id
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Analytics function class
|
4 |
+
*
|
5 |
+
* @since 1.10.0
|
6 |
+
* @package TInvWishlist\Analytics
|
7 |
+
*/
|
8 |
+
|
9 |
+
// If this file is called directly, abort.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
die;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Analytics function class
|
16 |
+
*/
|
17 |
+
class TInvWL_Analytics {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Database table
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
private $table;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Plugin name
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
private $_name;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructor
|
35 |
+
*
|
36 |
+
* @param array $wishlist Object wishlist.
|
37 |
+
* @param string $plugin_name Plugin name.
|
38 |
+
*
|
39 |
+
* @global wpdb $wpdb
|
40 |
+
*/
|
41 |
+
function __construct( $wishlist, $plugin_name = TINVWL_PREFIX ) {
|
42 |
+
global $wpdb;
|
43 |
+
|
44 |
+
$this->wishlist = (array) $wishlist;
|
45 |
+
$this->_name = $plugin_name;
|
46 |
+
$this->table = sprintf( '%s%s_%s', $wpdb->prefix, $this->_name, 'analytics' );
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get wishlist id
|
51 |
+
*
|
52 |
+
* @return int
|
53 |
+
*/
|
54 |
+
function wishlist_id() {
|
55 |
+
if ( is_array( $this->wishlist ) && array_key_exists( 'ID', $this->wishlist ) ) {
|
56 |
+
return $this->wishlist['ID'];
|
57 |
+
}
|
58 |
+
|
59 |
+
return 0;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Get author wishlist
|
64 |
+
*
|
65 |
+
* @return int
|
66 |
+
*/
|
67 |
+
function wishlist_author() {
|
68 |
+
if ( is_array( $this->wishlist ) && array_key_exists( 'author', $this->wishlist ) ) {
|
69 |
+
return $this->wishlist['author'];
|
70 |
+
}
|
71 |
+
|
72 |
+
return 0;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get product info
|
77 |
+
*
|
78 |
+
* @param integer $product_id Product id.
|
79 |
+
* @param integer $variation_id Product variation id.
|
80 |
+
*
|
81 |
+
* @return mixed
|
82 |
+
*/
|
83 |
+
private function product_data( $product_id, $variation_id = 0 ) {
|
84 |
+
$product_id = absint( $product_id );
|
85 |
+
$variation_id = absint( $variation_id );
|
86 |
+
|
87 |
+
if ( 'product_variation' == get_post_type( $product_id ) ) { // WPCS: loose comparison ok.
|
88 |
+
$variation_id = $product_id;
|
89 |
+
$product_id = wp_get_post_parent_id( $variation_id );
|
90 |
+
}
|
91 |
+
|
92 |
+
$product_data = wc_get_product( $variation_id ? $variation_id : $product_id );
|
93 |
+
|
94 |
+
if ( ! $product_data || 'trash' === $product_data->post->post_status ) {
|
95 |
+
return null;
|
96 |
+
}
|
97 |
+
|
98 |
+
$product_data->variation_id = absint( $product_data->variation_id );
|
99 |
+
|
100 |
+
return $product_data;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Add views analitycs
|
105 |
+
*
|
106 |
+
* @param integer $wishlist_id If exist wishlist object, you can put 0.
|
107 |
+
* @param boolean $author is author wislist.
|
108 |
+
*
|
109 |
+
* @return boolean
|
110 |
+
*/
|
111 |
+
function wishlist_view( $wishlist_id = 0, $author = null ) {
|
112 |
+
if ( empty( $wishlist_id ) ) {
|
113 |
+
$wishlist_id = $this->wishlist_id();
|
114 |
+
}
|
115 |
+
$this->view_products( $wishlist_id, $author );
|
116 |
+
|
117 |
+
return $this->add( ( $author ? 'author' : 'visite' ), $wishlist_id );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Add views analitycs
|
122 |
+
*
|
123 |
+
* @param integer $wishlist_id If exist wishlist object, you can put 0.
|
124 |
+
* @param boolean $author is author wislist.
|
125 |
+
*
|
126 |
+
* @return boolean
|
127 |
+
*/
|
128 |
+
function view_products( $wishlist_id = 0, $author = null ) {
|
129 |
+
if ( empty( $wishlist_id ) ) {
|
130 |
+
$wishlist_id = $this->wishlist_id();
|
131 |
+
}
|
132 |
+
$wishlist_id = absint( $wishlist_id );
|
133 |
+
$wlp = new TInvWL_Product( array(), $this->_name );
|
134 |
+
$products = $wlp->get_wishlist( array(
|
135 |
+
'wishlist_id' => $wishlist_id,
|
136 |
+
'external' => false,
|
137 |
+
) );
|
138 |
+
if ( empty( $products ) || ! is_array( $products ) ) {
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
foreach ( $products as $product ) {
|
142 |
+
$this->add( ( $author ? 'author' : 'visite' ), $wishlist_id, $product['product_id'], $product['variation_id'] );
|
143 |
+
}
|
144 |
+
|
145 |
+
return true;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Apply analytics actions
|
150 |
+
*
|
151 |
+
* @param string $type Type action.
|
152 |
+
* @param integer $product_id Product id.
|
153 |
+
* @param integer $variation_id Product variation id.
|
154 |
+
* @param integer $quantity Quantity applyed product.
|
155 |
+
*
|
156 |
+
* @return boolean
|
157 |
+
*/
|
158 |
+
private function _product( $type, $product_id, $variation_id = 0, $quantity = 1 ) {
|
159 |
+
$wishlist_id = $this->wishlist_id();
|
160 |
+
$quantity = absint( $quantity );
|
161 |
+
|
162 |
+
return $this->add( $type, $wishlist_id, $product_id, $variation_id, $quantity );
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Add to cart product
|
167 |
+
*
|
168 |
+
* @param integer $product_id Product id.
|
169 |
+
* @param integer $variation_id Product variation id.
|
170 |
+
* @param integer $quantity Quantity applyed product.
|
171 |
+
*
|
172 |
+
* @return boolean
|
173 |
+
*/
|
174 |
+
function cart_product( $product_id, $variation_id = 0, $quantity = 1 ) {
|
175 |
+
return $this->_product( 'add_to_cart', $product_id, $variation_id, $quantity );
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Bougt product
|
180 |
+
*
|
181 |
+
* @param integer $product_id Product id.
|
182 |
+
* @param integer $variation_id Product variation id.
|
183 |
+
* @param integer $quantity Quantity applyed product.
|
184 |
+
*
|
185 |
+
* @return boolean
|
186 |
+
*/
|
187 |
+
function sell_product( $product_id, $variation_id = 0, $quantity = 1 ) {
|
188 |
+
return $this->_product( 'sell', $product_id, $variation_id, $quantity );
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Click to product page from wishlist
|
193 |
+
*
|
194 |
+
* @param integer $product_id Product id.
|
195 |
+
* @param integer $variation_id Product variation id.
|
196 |
+
* @param integer $quantity Quantity applyed product.
|
197 |
+
*
|
198 |
+
* @return boolean
|
199 |
+
*/
|
200 |
+
function click_product_from_wl( $product_id, $variation_id = 0, $quantity = 1 ) {
|
201 |
+
return $this->_product( 'click', $product_id, $variation_id, $quantity );
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Click to product page from wishlist by author
|
206 |
+
*
|
207 |
+
* @param integer $product_id Product id.
|
208 |
+
* @param integer $variation_id Product variation id.
|
209 |
+
* @param integer $quantity Quantity applyed product.
|
210 |
+
*
|
211 |
+
* @return boolean
|
212 |
+
*/
|
213 |
+
function click_author_product_from_wl( $product_id, $variation_id = 0, $quantity = 1 ) {
|
214 |
+
return $this->_product( 'author_click', $product_id, $variation_id, $quantity );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Bought product from wishlist
|
219 |
+
*
|
220 |
+
* @param integer $product_id Product id.
|
221 |
+
* @param integer $variation_id Product variation id.
|
222 |
+
* @param integer $quantity Quantity applyed product.
|
223 |
+
*
|
224 |
+
* @return boolean
|
225 |
+
*/
|
226 |
+
function sell_product_from_wl( $product_id, $variation_id = 0, $quantity = 1 ) {
|
227 |
+
return $this->_product( 'wishlist', $product_id, $variation_id, $quantity );
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Gifted product
|
232 |
+
*
|
233 |
+
* @param integer $product_id Product id.
|
234 |
+
* @param integer $variation_id Product variation id.
|
235 |
+
* @param integer $quantity Quantity applyed product.
|
236 |
+
*
|
237 |
+
* @return boolean
|
238 |
+
*/
|
239 |
+
function gifted_product( $product_id, $variation_id = 0, $quantity = 1 ) {
|
240 |
+
return $this->_product( 'gift', $product_id, $variation_id, $quantity );
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Add action product
|
245 |
+
*
|
246 |
+
* @param string $type Action field.
|
247 |
+
* @param integer $wishlist_id If exist wishlist object, you can put 0.
|
248 |
+
* @param integer $product_id Product id.
|
249 |
+
* @param integer $variation_id Product variation id.
|
250 |
+
* @param integer $quantity Quantity applyed actions.
|
251 |
+
*
|
252 |
+
* @return boolean
|
253 |
+
* @global wpdb $wpdb
|
254 |
+
*/
|
255 |
+
function add( $type = 'visite', $wishlist_id = 0, $product_id = 0, $variation_id = 0, $quantity = 1 ) {
|
256 |
+
if ( ! in_array( $type, array(
|
257 |
+
'add_to_cart',
|
258 |
+
'author',
|
259 |
+
'author_click',
|
260 |
+
'click',
|
261 |
+
'gift',
|
262 |
+
'visite',
|
263 |
+
'wishlist'
|
264 |
+
) ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
|
265 |
+
return false;
|
266 |
+
}
|
267 |
+
if ( empty( $wishlist_id ) ) {
|
268 |
+
$wishlist_id = $this->wishlist_id();
|
269 |
+
}
|
270 |
+
if ( empty( $wishlist_id ) ) {
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
if ( empty( $product_id ) && ! empty( $variation_id ) ) {
|
274 |
+
$product_data = $this->product_data( $product_id, $variation_id );
|
275 |
+
if ( $product_data ) {
|
276 |
+
$product_id = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) );
|
277 |
+
$variation_id = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
|
278 |
+
} else {
|
279 |
+
return false;
|
280 |
+
}
|
281 |
+
}
|
282 |
+
$data = array(
|
283 |
+
'wishlist_id' => $wishlist_id,
|
284 |
+
'product_id' => $product_id,
|
285 |
+
'variation_id' => $variation_id,
|
286 |
+
);
|
287 |
+
$data['ID'] = md5( implode( '|', $data ) );
|
288 |
+
|
289 |
+
if ( 'visite' == $type ) { // WPCS: loose comparison ok.
|
290 |
+
$user = wp_get_current_user();
|
291 |
+
if ( $user->exists() ) {
|
292 |
+
if ( $this->wishlist_author() == $user->ID ) { // WPCS: loose comparison ok.
|
293 |
+
$type = 'author';
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
switch ( $type ) {
|
298 |
+
case 'author':
|
299 |
+
$data['visite_author'] = $quantity;
|
300 |
+
case 'visite':
|
301 |
+
$data['visite'] = $quantity;
|
302 |
+
break;
|
303 |
+
case 'author_click':
|
304 |
+
$data['click_author'] = $quantity;
|
305 |
+
case 'click':
|
306 |
+
$data['click'] = $quantity;
|
307 |
+
break;
|
308 |
+
case 'add_to_cart':
|
309 |
+
$data['cart'] = $quantity;
|
310 |
+
break;
|
311 |
+
case 'gift':
|
312 |
+
$data['sell_as_gift'] = $quantity;
|
313 |
+
case 'wishlist':
|
314 |
+
$data['sell_of_wishlist'] = $quantity;
|
315 |
+
break;
|
316 |
+
}
|
317 |
+
switch ( $type ) {
|
318 |
+
case 'author':
|
319 |
+
case 'visite':
|
320 |
+
break;
|
321 |
+
default :
|
322 |
+
if ( empty( $product_id ) ) {
|
323 |
+
return false;
|
324 |
+
}
|
325 |
+
}
|
326 |
+
$fields = array();
|
327 |
+
$values = array();
|
328 |
+
$duplicates = array();
|
329 |
+
foreach ( $data as $key => $value ) {
|
330 |
+
$fields[] = $key;
|
331 |
+
$values[] = $value;
|
332 |
+
if ( in_array( $key, array(
|
333 |
+
'cart',
|
334 |
+
'sell_as_gift',
|
335 |
+
'click_author',
|
336 |
+
'click',
|
337 |
+
'sell_of_wishlist',
|
338 |
+
'visite',
|
339 |
+
'visite_author'
|
340 |
+
) ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
|
341 |
+
$duplicates[] = sprintf( '`%s`=`%s`+%d', $key, $key, $value );
|
342 |
+
}
|
343 |
+
}
|
344 |
+
$fields = '`' . implode( '`,`', $fields ) . '`';
|
345 |
+
$values = "'" . implode( "','", $values ) . "'";
|
346 |
+
$duplicates = implode( ',', $duplicates );
|
347 |
+
global $wpdb;
|
348 |
+
|
349 |
+
return $wpdb->query( "INSERT INTO `$this->table` ($fields) VALUES ($values) ON DUPLICATE KEY UPDATE $duplicates" ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Get products
|
354 |
+
*
|
355 |
+
* @param array $data Request.
|
356 |
+
*
|
357 |
+
* @return array
|
358 |
+
* @global wpdb $wpdb
|
359 |
+
*/
|
360 |
+
function get( $data = array() ) {
|
361 |
+
$default = array(
|
362 |
+
'count' => 10,
|
363 |
+
'field' => null,
|
364 |
+
'offset' => 0,
|
365 |
+
'order' => 'ASC',
|
366 |
+
'order_by' => 'visite',
|
367 |
+
'external' => true,
|
368 |
+
'sql' => '',
|
369 |
+
);
|
370 |
+
|
371 |
+
foreach ( $default as $_k => $_version ) {
|
372 |
+
if ( array_key_exists( $_k, $data ) ) {
|
373 |
+
$default[ $_k ] = $data[ $_k ];
|
374 |
+
unset( $data[ $_k ] );
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
$default['offset'] = absint( $default['offset'] );
|
379 |
+
$default['count'] = absint( $default['count'] );
|
380 |
+
if ( is_array( $default['field'] ) ) {
|
381 |
+
$default['field'] = '`' . implode( '`,`', $default['field'] ) . '`';
|
382 |
+
} elseif ( is_string( $default['field'] ) ) {
|
383 |
+
$default['field'] = array( 'ID', $default['field'] );
|
384 |
+
$default['field'] = '`' . implode( '`,`', $default['field'] ) . '`';
|
385 |
+
} else {
|
386 |
+
$default['field'] = '*';
|
387 |
+
}
|
388 |
+
$sql = "SELECT {$default[ 'field' ]} FROM `{$this->table}`";
|
389 |
+
|
390 |
+
$where = '1';
|
391 |
+
if ( ! empty( $data ) && is_array( $data ) ) {
|
392 |
+
foreach ( $data as $f => $v ) {
|
393 |
+
$s = is_array( $v ) ? ' IN ' : '=';
|
394 |
+
if ( is_array( $v ) ) {
|
395 |
+
$v = "'" . implode( "','", $v ) . "'";
|
396 |
+
$v = "($v)";
|
397 |
+
} else {
|
398 |
+
$v = "'$v'";
|
399 |
+
}
|
400 |
+
$data[ $f ] = sprintf( '`%s`%s%s', $f, $s, $v );
|
401 |
+
}
|
402 |
+
$where = implode( ' AND ', $data );
|
403 |
+
$sql .= ' WHERE ' . $where;
|
404 |
+
}
|
405 |
+
|
406 |
+
$sql .= sprintf( ' ORDER BY `%s` %s LIMIT %d,%d;', $default['order_by'], $default['order'], $default['offset'], $default['count'] );
|
407 |
+
if ( ! empty( $default['sql'] ) ) {
|
408 |
+
$replacer = $replace = array();
|
409 |
+
$replace[0] = '{table}';
|
410 |
+
$replacer[0] = $this->table;
|
411 |
+
$replace[1] = '{where}';
|
412 |
+
$replacer[1] = $where;
|
413 |
+
|
414 |
+
foreach ( $default as $key => $value ) {
|
415 |
+
$i = count( $replace );
|
416 |
+
|
417 |
+
$replace[ $i ] = '{' . $key . '}';
|
418 |
+
$replacer[ $i ] = $value;
|
419 |
+
}
|
420 |
+
|
421 |
+
$sql = str_replace( $replace, $replacer, $default['sql'] );
|
422 |
+
}
|
423 |
+
global $wpdb;
|
424 |
+
$products = $wpdb->get_results( $sql, ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
425 |
+
|
426 |
+
if ( empty( $products ) ) {
|
427 |
+
return array();
|
428 |
+
}
|
429 |
+
if ( $default['external'] ) {
|
430 |
+
foreach ( $products as $k => $product ) {
|
431 |
+
$product_data = $this->product_data( $product['variation_id'], $product['product_id'] );
|
432 |
+
if ( $product_data ) {
|
433 |
+
$product['product_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) );
|
434 |
+
$product['variation_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
|
435 |
+
}
|
436 |
+
$product['data'] = $product_data;
|
437 |
+
$products[ $k ] = $product;
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
return $products;
|
442 |
+
}
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Get Analytics
|
446 |
+
*
|
447 |
+
* @param integer $wishlist_id If exist wishlist object, you can put 0.
|
448 |
+
*
|
449 |
+
* @return array
|
450 |
+
* @global wpdb $wpdb
|
451 |
+
*/
|
452 |
+
function get_wishlist( $wishlist_id = 0 ) {
|
453 |
+
$wishlist_id = absint( $wishlist_id );
|
454 |
+
if ( empty( $wishlist_id ) ) {
|
455 |
+
$wishlist_id = $this->wishlist_id();
|
456 |
+
}
|
457 |
+
global $wpdb;
|
458 |
+
$analytics = array();
|
459 |
+
if ( empty( $wishlist_id ) ) {
|
460 |
+
$analytics = $wpdb->get_results( $wpdb->prepare( "SELECT `wishlist_id`,`visite`, `visite_author` FROM `$this->table` WHERE `product_id`=%d AND `variation_id`=%d;", 0, 0 ), ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
461 |
+
} else {
|
462 |
+
$analytics = $wpdb->get_results( $wpdb->prepare( "SELECT `wishlist_id`,`visite`, `visite_author` FROM `$this->table` WHERE `wishlist_id`=%d AND `product_id`=%d AND `variation_id`=%d;", $wishlist_id, 0, 0 ), ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
463 |
+
}
|
464 |
+
if ( empty( $analytics ) ) {
|
465 |
+
return array();
|
466 |
+
}
|
467 |
+
foreach ( $analytics as $key => $analytic ) {
|
468 |
+
foreach ( $analytic as $field => $value ) {
|
469 |
+
$analytic[ $field ] = absint( $value );
|
470 |
+
}
|
471 |
+
$analytics[ $key ] = $analytic;
|
472 |
+
}
|
473 |
+
|
474 |
+
return $analytics;
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* Get Analytics Product
|
479 |
+
*
|
480 |
+
* @param type $wishlist_id If exist wishlist object, you can put 0.
|
481 |
+
* @param type $product_id Product id.
|
482 |
+
* @param type $variation_id Product variation id.
|
483 |
+
*
|
484 |
+
* @return type
|
485 |
+
* @global wpdb $wpdb
|
486 |
+
*/
|
487 |
+
function get_product( $wishlist_id = 0, $product_id = 0, $variation_id = 0 ) {
|
488 |
+
|
489 |
+
$wishlist_id = absint( $wishlist_id );
|
490 |
+
if ( empty( $wishlist_id ) ) {
|
491 |
+
$wishlist_id = $this->wishlist_id();
|
492 |
+
}
|
493 |
+
$wishlist_id = absint( $wishlist_id );
|
494 |
+
$product_id = absint( $product_id );
|
495 |
+
$variation_id = absint( $variation_id );
|
496 |
+
if ( ! empty( $product_id ) || ! empty( $variation_id ) ) {
|
497 |
+
$product_data = $this->product_data( $product_id, $variation_id );
|
498 |
+
if ( $product_data ) {
|
499 |
+
$product_id = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->id : ( $product_data->is_type( 'variation' ) ? $product_data->get_parent_id() : $product_data->get_id() ) );
|
500 |
+
$variation_id = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->variation_id : ( $product_data->is_type( 'variation' ) ? $product_data->get_id() : 0 ) );
|
501 |
+
} else {
|
502 |
+
$product_id = 0;
|
503 |
+
$variation_id = 0;
|
504 |
+
}
|
505 |
+
} else {
|
506 |
+
$product_id = 0;
|
507 |
+
$variation_id = 0;
|
508 |
+
}
|
509 |
+
|
510 |
+
global $wpdb;
|
511 |
+
$analytics = array();
|
512 |
+
if ( empty( $product_id ) && empty( $variation_id ) ) {
|
513 |
+
if ( empty( $wishlist_id ) ) {
|
514 |
+
$analytics = $wpdb->get_results( $wpdb->prepare( "SELECT `wishlist_id`,`product_id`,`variation_id`,`sell`, `sell_of_wishlist`, `sell_as_gift` FROM `$this->table` WHERE `product_id`<>%d AND `variation_id`<>%d;", 0, 0 ), ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
515 |
+
} else {
|
516 |
+
$analytics = $wpdb->get_results( $wpdb->prepare( "SELECT `wishlist_id`,`product_id`,`variation_id`,`sell`, `sell_of_wishlist`, `sell_as_gift` FROM `$this->table` WHERE `wishlist_id`=%d AND `product_id`<>%d AND `variation_id`<>%d;", $wishlist_id, 0, 0 ), ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
517 |
+
}
|
518 |
+
} else {
|
519 |
+
if ( empty( $wishlist_id ) ) {
|
520 |
+
$analytics = $wpdb->get_results( $wpdb->prepare( "SELECT `wishlist_id`,`product_id`,`variation_id`,`sell`, `sell_of_wishlist`, `sell_as_gift` FROM `$this->table` WHERE `product_id`=%d AND `variation_id`=%d;", $product_id, $variation_id ), ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
521 |
+
} else {
|
522 |
+
$analytics = $wpdb->get_results( $wpdb->prepare( "SELECT `wishlist_id`,`product_id`,`variation_id`,`sell`, `sell_of_wishlist`, `sell_as_gift` FROM `$this->table` WHERE `wishlist_id`=%d AND `product_id`=%d AND `variation_id`=%d;", $wishlist_id, $product_id, $variation_id ), ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
523 |
+
}
|
524 |
+
}
|
525 |
+
if ( empty( $analytics ) ) {
|
526 |
+
return array();
|
527 |
+
}
|
528 |
+
|
529 |
+
foreach ( $analytics as $key => $analytic ) {
|
530 |
+
foreach ( $analytic as $field => $value ) {
|
531 |
+
$analytic[ $field ] = absint( $value );
|
532 |
+
}
|
533 |
+
$analytics[ $key ] = $analytic;
|
534 |
+
}
|
535 |
+
|
536 |
+
return $analytics;
|
537 |
+
}
|
538 |
+
}
|
languages/ti-woocommerce-wishlist.pot
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
# Copyright (C) 2019 WooCommerce Wishlist Plugin - 1.10.
|
2 |
-
# This file is distributed under the same license as the WooCommerce Wishlist Plugin - 1.10.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Wishlist Plugin - 1.10.
|
6 |
"MIME-Version: 1.0\n"
|
7 |
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -1053,7 +1053,7 @@ msgstr ""
|
|
1053 |
msgid "Out of stock"
|
1054 |
msgstr ""
|
1055 |
|
1056 |
-
#: tinv-wishlists-function-integration.php:
|
1057 |
msgid "Base price"
|
1058 |
msgstr ""
|
1059 |
|
1 |
+
# Copyright (C) 2019 WooCommerce Wishlist Plugin - 1.10.1
|
2 |
+
# This file is distributed under the same license as the WooCommerce Wishlist Plugin - 1.10.1 package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Wishlist Plugin - 1.10.1\n"
|
6 |
"MIME-Version: 1.0\n"
|
7 |
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
"Content-Transfer-Encoding: 8bit\n"
|
1053 |
msgid "Out of stock"
|
1054 |
msgstr ""
|
1055 |
|
1056 |
+
#: tinv-wishlists-function-integration.php:1655
|
1057 |
msgid "Base price"
|
1058 |
msgstr ""
|
1059 |
|
public/cart.class.php
CHANGED
@@ -89,7 +89,7 @@ class TInvWL_Public_Cart {
|
|
89 |
* @param integer $wl_product Wishlist product id.
|
90 |
* @param integer $wl_quantity Product quantity.
|
91 |
*
|
92 |
-
* @return boolean
|
93 |
*/
|
94 |
public static function add( $wishlist = null, $wl_product = 0, $wl_quantity = 1 ) {
|
95 |
if ( empty( $wishlist ) ) {
|
@@ -150,6 +150,7 @@ class TInvWL_Public_Cart {
|
|
150 |
self::ar_f_wl( $wishlist, $product_id, $quantity, $variation_id, $product['meta'] );
|
151 |
}
|
152 |
self::set_item_data( $cart_item_key, $wishlist['share_key'], $quantity );
|
|
|
153 |
self::unprepare_post();
|
154 |
|
155 |
return array( $product_id => $quantity );
|
@@ -232,6 +233,34 @@ class TInvWL_Public_Cart {
|
|
232 |
return true;
|
233 |
}
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
/**
|
236 |
* Remove product added from wishlist
|
237 |
*
|
@@ -323,6 +352,31 @@ class TInvWL_Public_Cart {
|
|
323 |
}
|
324 |
}
|
325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
/**
|
327 |
* Autoremove product from wishlist
|
328 |
*
|
@@ -372,24 +426,40 @@ class TInvWL_Public_Cart {
|
|
372 |
* @param string $old_status Not used.
|
373 |
* @param string $new_status Updated status order.
|
374 |
*
|
375 |
-
* @return
|
376 |
*/
|
377 |
function order_status_analytics( $order_id, $old_status, $new_status ) {
|
378 |
$new_status = str_replace( 'wc-', '', $new_status );
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
|
380 |
-
if ( 'completed' == $new_status ) { // WPCS: loose comparison ok.
|
381 |
-
$order = new WC_Order( $order_id );
|
382 |
$items = $order->get_items();
|
383 |
if ( empty( $items ) || ! is_array( $items ) ) {
|
384 |
-
return
|
385 |
}
|
386 |
|
387 |
foreach ( $items as $item ) {
|
388 |
-
|
389 |
-
|
390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
if ( is_array( $_wishlist_cart ) ) {
|
392 |
-
// @bug remove individual product from all user wishlists
|
393 |
foreach ( $_wishlist_cart as $key => $quantity ) {
|
394 |
if ( 0 >= $_quantity ) {
|
395 |
break;
|
@@ -405,6 +475,8 @@ class TInvWL_Public_Cart {
|
|
405 |
}
|
406 |
}
|
407 |
}
|
|
|
|
|
408 |
}
|
409 |
}
|
410 |
}
|
89 |
* @param integer $wl_product Wishlist product id.
|
90 |
* @param integer $wl_quantity Product quantity.
|
91 |
*
|
92 |
+
* @return array|boolean
|
93 |
*/
|
94 |
public static function add( $wishlist = null, $wl_product = 0, $wl_quantity = 1 ) {
|
95 |
if ( empty( $wishlist ) ) {
|
150 |
self::ar_f_wl( $wishlist, $product_id, $quantity, $variation_id, $product['meta'] );
|
151 |
}
|
152 |
self::set_item_data( $cart_item_key, $wishlist['share_key'], $quantity );
|
153 |
+
self::set_item_meta( $cart_item_key, $product['meta'] );
|
154 |
self::unprepare_post();
|
155 |
|
156 |
return array( $product_id => $quantity );
|
233 |
return true;
|
234 |
}
|
235 |
|
236 |
+
/**
|
237 |
+
* Get product added from wishlist meta
|
238 |
+
*
|
239 |
+
* @param string $cart_item_key Cart product key.
|
240 |
+
*
|
241 |
+
* @return array
|
242 |
+
*/
|
243 |
+
public static function get_item_meta( $cart_item_key ) {
|
244 |
+
$data = (array) WC()->session->get( 'tinvwl_wishlist_meta', array() );
|
245 |
+
if ( array_key_exists( $cart_item_key, $data ) ) {
|
246 |
+
return $data[ $cart_item_key ];
|
247 |
+
}
|
248 |
+
|
249 |
+
return array();
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Set product added from wishlist meta
|
254 |
+
*
|
255 |
+
* @param string $cart_item_key Cart product key.
|
256 |
+
* @param array $meta Meta data.
|
257 |
+
*/
|
258 |
+
public static function set_item_meta( $cart_item_key, $meta = array() ) {
|
259 |
+
$data = (array) WC()->session->get( 'tinvwl_wishlist_meta', array() );
|
260 |
+
$data[ $cart_item_key ] = $meta;
|
261 |
+
WC()->session->set( 'tinvwl_wishlist_meta', $data );
|
262 |
+
}
|
263 |
+
|
264 |
/**
|
265 |
* Remove product added from wishlist
|
266 |
*
|
352 |
}
|
353 |
}
|
354 |
|
355 |
+
/**
|
356 |
+
* Get wishlist by key or user id
|
357 |
+
*
|
358 |
+
* @param string $key Share key.
|
359 |
+
* @param integer $user_id Author order id.
|
360 |
+
*
|
361 |
+
* @return array
|
362 |
+
*/
|
363 |
+
private function get_order_wishlist( $key, $user_id = 0 ) {
|
364 |
+
$wl = new TInvWL_Wishlist( self::$_name );
|
365 |
+
if ( ! empty( $key ) ) {
|
366 |
+
$wishlist = $wl->get_by_share_key( $key );
|
367 |
+
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' ) ) ) ) {
|
368 |
+
return null;
|
369 |
+
}
|
370 |
+
|
371 |
+
return $wishlist;
|
372 |
+
}
|
373 |
+
if ( ! empty( $user_id ) ) {
|
374 |
+
return $wl->add_user_default( $user_id );
|
375 |
+
}
|
376 |
+
|
377 |
+
return null;
|
378 |
+
}
|
379 |
+
|
380 |
/**
|
381 |
* Autoremove product from wishlist
|
382 |
*
|
426 |
* @param string $old_status Not used.
|
427 |
* @param string $new_status Updated status order.
|
428 |
*
|
429 |
+
* @return void
|
430 |
*/
|
431 |
function order_status_analytics( $order_id, $old_status, $new_status ) {
|
432 |
$new_status = str_replace( 'wc-', '', $new_status );
|
433 |
+
$order = new WC_Order( $order_id );
|
434 |
+
|
435 |
+
if ( in_array( $new_status, array(
|
436 |
+
'processing',
|
437 |
+
'completed'
|
438 |
+
) ) && empty( get_post_meta( $order_id, '_wishlist_analytics_processed', true ) ) ) {
|
439 |
|
|
|
|
|
440 |
$items = $order->get_items();
|
441 |
if ( empty( $items ) || ! is_array( $items ) ) {
|
442 |
+
return;
|
443 |
}
|
444 |
|
445 |
foreach ( $items as $item ) {
|
446 |
+
|
447 |
+
if ( version_compare( WC_VERSION, '3.0.0', '<' ) ) {
|
448 |
+
//WooCommerce before 3.0
|
449 |
+
|
450 |
+
if ( array_key_exists( '_tinvwl_wishlist_cart', (array) $item ) ) {
|
451 |
+
$_wishlist_cart = maybe_unserialize( $item['_tinvwl_wishlist_cart'] );
|
452 |
+
}
|
453 |
+
} else {
|
454 |
+
// WooCommerce 3.0
|
455 |
+
|
456 |
+
// Check if wishlist meta exists for current item order.
|
457 |
+
$_wishlist_cart = $item->get_meta( '_tinvwl_wishlist_cart' );
|
458 |
+
}
|
459 |
+
|
460 |
+
if ( $_wishlist_cart ) {
|
461 |
+
$_quantity = absint( $item['qty'] );
|
462 |
if ( is_array( $_wishlist_cart ) ) {
|
|
|
463 |
foreach ( $_wishlist_cart as $key => $quantity ) {
|
464 |
if ( 0 >= $_quantity ) {
|
465 |
break;
|
475 |
}
|
476 |
}
|
477 |
}
|
478 |
+
|
479 |
+
update_post_meta( $order_id, '_wishlist_analytics_processed', '1' );
|
480 |
}
|
481 |
}
|
482 |
}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
=== WooCommerce Wishlist Plugin ===
|
2 |
Contributors: templateinvaders
|
3 |
Donate link: https://templateinvaders.com/product/ti-woocommerce-wishlist-wordpress-plugin/?utm_source=wordpressorg&utm_content=donate
|
4 |
Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.1
|
7 |
-
Stable tag: 1.10.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -140,6 +140,12 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
140 |
|
141 |
|
142 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
= 1.10.0 =
|
144 |
*Release Date - 9 April 2019*
|
145 |
|
1 |
+
=== WooCommerce Wishlist Plugin ===
|
2 |
Contributors: templateinvaders
|
3 |
Donate link: https://templateinvaders.com/product/ti-woocommerce-wishlist-wordpress-plugin/?utm_source=wordpressorg&utm_content=donate
|
4 |
Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.1
|
7 |
+
Stable tag: 1.10.1
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
140 |
|
141 |
|
142 |
== Changelog ==
|
143 |
+
= 1.10.1 =
|
144 |
+
*Release Date - 14 April 2019*
|
145 |
+
|
146 |
+
* [WooCommerce PPOM](https://wordpress.org/plugins/woocommerce-product-addon/) plugin integration updated
|
147 |
+
* Fixed analytics purchase count issue
|
148 |
+
|
149 |
= 1.10.0 =
|
150 |
*Release Date - 9 April 2019*
|
151 |
|
templates/ti-wishlist-item-data.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* The Template for displaying variation product data.
|
4 |
*
|
5 |
-
* @version 1.
|
6 |
* @package TInvWishlist\Template
|
7 |
*/
|
8 |
|
@@ -13,10 +13,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
13 |
?>
|
14 |
<dl class="variation">
|
15 |
<?php foreach ( $item_data as $data ) : ?>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
21 |
<?php endforeach; ?>
|
22 |
</dl>
|
2 |
/**
|
3 |
* The Template for displaying variation product data.
|
4 |
*
|
5 |
+
* @version 1.10.1
|
6 |
* @package TInvWishlist\Template
|
7 |
*/
|
8 |
|
13 |
?>
|
14 |
<dl class="variation">
|
15 |
<?php foreach ( $item_data as $data ) : ?>
|
16 |
+
<?php if ( $data['key'] ) { ?>
|
17 |
+
<dt class="variation-<?php echo sanitize_html_class( $data['key'] ); ?>"><?php echo wp_kses_post( $data['key'] ); ?>:</dt>
|
18 |
+
<?php } ?>
|
19 |
+
<?php if ( $data['display'] ) { ?>
|
20 |
+
<dd class="variation-<?php echo sanitize_html_class( $data['key'] ); ?>"><?php echo wp_kses_post( $data['display'] ); ?></dd>
|
21 |
+
<?php } ?>
|
22 |
<?php endforeach; ?>
|
23 |
</dl>
|
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.10.
|
8 |
* Requires at least: 4.5
|
9 |
* Tested up to: 5.1
|
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.10.
|
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.10.1
|
8 |
* Requires at least: 4.5
|
9 |
* Tested up to: 5.1
|
10 |
* WC requires at least: 2.6
|
41 |
}
|
42 |
|
43 |
if ( ! defined( 'TINVWL_FVERSION' ) ) {
|
44 |
+
define( 'TINVWL_FVERSION', '1.10.1' );
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
|
tinv-wishlists-function-integration.php
CHANGED
@@ -1341,8 +1341,7 @@ if ( ! function_exists( 'tinv_wishlist_metasupport_woocommerce_product_add_on' )
|
|
1341 |
* @return array
|
1342 |
*/
|
1343 |
function tinv_wishlist_metasupport_woocommerce_product_add_on( $meta, $product_id ) {
|
1344 |
-
|
1345 |
-
if ( ! empty( $personalized_meta ) ) {
|
1346 |
$meta = array();
|
1347 |
}
|
1348 |
|
@@ -1364,9 +1363,7 @@ if ( ! function_exists( 'tinv_wishlist_item_meta_woocommerce_product_add_on' ) )
|
|
1364 |
* @return array
|
1365 |
*/
|
1366 |
function tinv_wishlist_item_meta_woocommerce_product_add_on( $meta, $wl_product, $product ) {
|
1367 |
-
|
1368 |
-
if ( ! empty( $personalized_meta ) && class_exists( 'NM_PersonalizedProduct' ) ) {
|
1369 |
-
|
1370 |
$product_meta = ( isset( $wl_product['meta']['ppom'] ) ) ? $wl_product['meta']['ppom']['fields'] : '';
|
1371 |
|
1372 |
$item_meta = array();
|
@@ -1483,7 +1480,7 @@ if ( ! function_exists( 'tinv_wishlist_item_meta_woocommerce_product_add_on' ) )
|
|
1483 |
if ( 0 < count( $item_meta ) ) {
|
1484 |
ob_start();
|
1485 |
tinv_wishlist_template( 'ti-wishlist-item-data.php', array( 'item_data' => $item_meta ) );
|
1486 |
-
$meta .=
|
1487 |
}
|
1488 |
} // End if().
|
1489 |
|
1341 |
* @return array
|
1342 |
*/
|
1343 |
function tinv_wishlist_metasupport_woocommerce_product_add_on( $meta, $product_id ) {
|
1344 |
+
if ( isset( $meta['ppom'] ) ) {
|
|
|
1345 |
$meta = array();
|
1346 |
}
|
1347 |
|
1363 |
* @return array
|
1364 |
*/
|
1365 |
function tinv_wishlist_item_meta_woocommerce_product_add_on( $meta, $wl_product, $product ) {
|
1366 |
+
if ( isset( $wl_product['meta'] ) && isset( $wl_product['meta']['ppom'] ) && class_exists( 'NM_PersonalizedProduct' ) ) {
|
|
|
|
|
1367 |
$product_meta = ( isset( $wl_product['meta']['ppom'] ) ) ? $wl_product['meta']['ppom']['fields'] : '';
|
1368 |
|
1369 |
$item_meta = array();
|
1480 |
if ( 0 < count( $item_meta ) ) {
|
1481 |
ob_start();
|
1482 |
tinv_wishlist_template( 'ti-wishlist-item-data.php', array( 'item_data' => $item_meta ) );
|
1483 |
+
$meta .= ob_get_clean();
|
1484 |
}
|
1485 |
} // End if().
|
1486 |
|
tinv-wishlists-function.php
CHANGED
@@ -742,7 +742,9 @@ if ( ! function_exists( 'tinv_wishlist_print_meta' ) ) {
|
|
742 |
echo esc_html( $data['key'] ) . ': ' . wp_kses_post( $data['display'] ) . '<br>';
|
743 |
}
|
744 |
} else {
|
745 |
-
|
|
|
|
|
746 |
}
|
747 |
|
748 |
return apply_filters( 'tinvwl_wishlist_item_meta_wishlist', ob_get_clean() );
|
742 |
echo esc_html( $data['key'] ) . ': ' . wp_kses_post( $data['display'] ) . '<br>';
|
743 |
}
|
744 |
} else {
|
745 |
+
if ( $item_data ) {
|
746 |
+
tinv_wishlist_template( 'ti-wishlist-item-data.php', array( 'item_data' => $item_data ) );
|
747 |
+
}
|
748 |
}
|
749 |
|
750 |
return apply_filters( 'tinvwl_wishlist_item_meta_wishlist', ob_get_clean() );
|