Version Description
(2021-04-06) = * Added: Google product review template has been added - (beta test). * Fixed: PHP Warning: min() lowest shipping price issue fixed.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 4.3.61 |
Comparing to | |
See all releases |
Code changes from version 4.3.60 to 4.3.61
- README.txt +5 -1
- admin/js/woo-feed-admin.min.js +2 -2
- includes/classes/class-woo-feed-merchant.php +1 -0
- includes/classes/class-woo-feed-products-v3.php +5 -2
- includes/classes/class-woo-feed-shipping.php +4 -0
- includes/feeds/class-woo-feed-review.php +205 -68
- includes/helper.php +1 -3
- woo-feed.php +30 -7
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Cata
|
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.7
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 4.3.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -498,6 +498,10 @@ Using pro version:
|
|
498 |
|
499 |
== Changelog ==
|
500 |
|
|
|
|
|
|
|
|
|
501 |
= 4.3.60 (2021-04-04) =
|
502 |
* Added: Compatibility for Pricing Deals for WooCommerce by Vark.
|
503 |
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.7
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 4.3.61
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
498 |
|
499 |
== Changelog ==
|
500 |
|
501 |
+
= 4.3.61 (2021-04-06) =
|
502 |
+
* Added: Google product review template has been added - (beta test).
|
503 |
+
* Fixed: PHP Warning: min() lowest shipping price issue fixed.
|
504 |
+
|
505 |
= 4.3.60 (2021-04-04) =
|
506 |
* Added: Compatibility for Pricing Deals for WooCommerce by Vark.
|
507 |
|
admin/js/woo-feed-admin.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}!function(s,a,r,i,c){s.fn.disabled=function(n){return s(this).each(function(){var e=s(this),t="disabled";void 0!==e.prop(t)?e.prop(t,void 0===n||!0===n):!0===n?e.addClass(t):e.removeClass(t)}),self},s.fn.isDisabled=function(){var e=s(this),t="disabled";return void 0!==e.prop(t)?e.prop(t):e.hasClass(t)};function e(e){s(e.currentTarget).removeClass(function(e,t){return(t.match(/\btooltipped-\S+/g)||[]).join(" ")}).removeClass("tooltipped").removeAttr("aria-label")}function o(e,t){s(e).addClass("tooltipped tooltipped-s").attr("aria-label",t)}function l(e,t){return s.extend(!0,{},e,t)}function t(){n=s(".toClipboard"),!ClipboardJS.isSupported()||/iPhone|iPad/i.test(navigator.userAgent)?n.find("img").hide(0):(n.each(function(){s(this).on("mouseleave",e).on("blur",e)}),new ClipboardJS(".toClipboard").on("error",function(e){var t,n;o(e.trigger,(t=e.action,n="cut"===t?"X":"C",/iPhone|iPad/i.test(navigator.userAgent)?"No support :(":/Mac/i.test(navigator.userAgent)?"Press ⌘-"+n+" to "+t:"Press Ctrl-"+n+" to "+t))}).on("success",function(e){o(e.trigger,"Copied!")}))}var n,d,f={in_array:function(e,t){try{return-1!==t.indexOf(e)}catch(e){return!1}},selectize_render_item:function(e,t){return'<div class="item wapk-selectize-item">'.concat(t(e.text),"</div>")},ajax_fail:function(e){console.warn(e),alert(e.hasOwnProperty("statusText")&&e.hasOwnProperty("status")?c.ajax.error+"\n"+e.statusText+" ("+e.status+")":e)},sortable:function(e,n,a,r){return(e||s(".sorted_table")).each(function(){var e=s(this),t=e.find("tbody > tr:eq(0) > td").length||a||9;e.wf_sortable(l({containerSelector:"table",itemPath:"> tbody",itemSelector:"tr",handle:"i.wf_sortedtable",placeholder:'<tr class="placeholder"><td colspan="'.concat(t,'"></td></tr>'),onDrop:function(e,t,n,a){e.removeClass(t.group.options.draggedClass).removeAttr("style"),s("body").removeClass(t.group.options.bodyClass),r&&"function"==typeof r&&r(e,t,n,a)}},n))})},selectize:function(e,t){return(e||s("select.selectize")).not(".selectized").each(function(){var e=s(this);e.selectize(l({create:e.data("create")||!1,plugins:e.data("plugins")?e.data("plugins").split(",").map(function(e){return e.trim()}):[],render:{item:f.selectize_render_item}},t))})},fancySelect:function(e,t){return(e||s("select.fancySelect")).not(".FancySelectInit").each(function(){s(this).fancySelect(l({maxItemShow:3},t))})},reindex_config_table:function(){s("#table-1").find("tbody tr").each(function(n,e){s(e).find("[name]").each(function(e,t){s(t).attr("name",s(t).attr("name").replace(/(\[\d\])/g,"[".concat(n,"]")))})})},common:function(){f.sortable(s(".sorted_table"),{},9,f.reindex_config_table),f.selectize(),f.fancySelect(s(".outputType"))}},_={form:null,init:function(){this.form=s(".generateFeed"),this.form.length&&(f.common(),s(r).trigger(new jQuery.Event("feedEditor.init",{target:this.form})))},renderMerchantInfo:function(n,a,r){function e(e){var t;r.hasOwnProperty(e)&&(n.find(".merchant-info-section."+e+" .data").html(r[e]),"feed_file_type"===e&&((t=r[e].split(",").map(function(e){return e.trim().toLowerCase()}).filter(function(e){return""!==e&&e!==c.na.toLowerCase()})).length?(a.find("option").removeAttr("selected").each(function(){var e=s(this);e.val()&&!f.in_array(e.val(),t)?e.disabled(!0):e.disabled(!1)}),1===t.length&&a.find('option[value="'+t[0]+'"]').attr("selected","selected")):a.find("option").disabled(!1)))}for(var t in r)e(t);n.find(".spinner").removeClass("is-active"),a.disabled(!1),a.trigger("change"),a.parent().find(".spinner").removeClass("is-active")},renderMerchantTemplate:function(n,a){function e(t){if(a.hasOwnProperty(t))if("tabs"===t)n.html(a[t]);else{var e=s('[name="'+t+'"]');e.length&&e.each(function(){var e=s(this);e.is("select")?e.find('[value="'+a[t]+'"]').prop("selected",!0):(e.is("[type=checkbox]")||e.is("[type=radio]"))&&e.val()===a[t]?e.prop("checked",!0):e.val(a[t])}).trigger("change")}}for(var t in a)e(t);_.init()}},u=[],p=[],h=function(){function e(){_classCallCheck(this,e),this._feed=c.generator.feed,this._limit=c.generator.limit,this._progress=0,this._timer=null,this._color=!1,this._total_batch=0,this._current_batch=0,this._product_ids=[],this._progress_per_batch=0,this._refresh=!0,this._regenerate=c.generator.regenerate,a.isRegenerating=!1,this._all_btn=s(".wpf_regenerate"),this._current_btn=s("#".concat(this._feed.replace("wf_config","wf_feed_"))),this._current_btn_label=""}return _createClass(e,[{key:"init",value:function(){var n=this;""!==this._feed&&this._regenerate&&!1===a.isRegenerating&&this.generate();var e=a.location.search;return"webappick-manage-feeds"===new URLSearchParams(e).get("page")&&s("body").addClass("woo-import-popup-body"),s(r).on("click",".woo-feed-campaign-close-button",function(e){e.preventDefault(),s(this).parent(".woo-feed-promotion").hide();var t=s(this).data("condition");1===t&&i.post("woo_feed_hide_promotion",{_ajax_nonce:c.nonce,condition:t}).then(function(e){n._log(e)}).fail(function(e){n._log(e),n._updateProgressStatus(e.message),n._color="red"})}),s(r).on("click",".wpf_regenerate",function(e){e.preventDefault(),n._current_btn=s(this),n._current_btn.hasClass("disabled")||!0===a.isRegenerating||(n._feed=n._current_btn.attr("id").replace("wf_feed_","wf_config"),""!==n._feed&&n.generate())}),this}},{key:"_block_button",value:function(){this._all_btn.length&&this._all_btn.addClass("disabled"),this._current_btn.length&&(this._current_btn.find("span").addClass("wpf_spin reverse_spin"),this._current_btn_label=this._current_btn.attr("title"),this._current_btn.attr("aria-label",c.regenerate).attr("title",c.regenerate))}},{key:"_unblock_button",value:function(){this._all_btn.length&&this._all_btn.removeClass("disabled"),this._current_btn.length&&(this._current_btn.find("span").removeClass("wpf_spin"),this._current_btn.find("span").removeClass("reverse_spin"),this._current_btn.attr("aria-label",this._current_btn_label).attr("title",this._current_btn_label))}},{key:"generate",value:function(){var t=this,n=this;a.isRegenerating=!0,this._block_button(),this._resetProgressBar(),this._progressBarActive(),this._log("Counting Total Products"),this._updateProgressStatus("Fetching products."),this._get_product_ids().then(function(e){t._progress=10,n._log({response:e}),e.success?(n._log("Total ".concat(e.total," Products found.")),n._product_ids=e.product,n._total_batch=t._product_ids.length,n._current_batch=0,n._progress_per_batch=(90-t._progress)/t._total_batch,n._process_batch(),n._updateProgressStatus("Processing Products...")):n._updateProgressStatus(e.data.message)}).fail(function(e){n._log(e),n._updateProgressStatus(e.message),n._color="red",setTimeout(function(){n._stopProgressBar(),n._unblock_button()},1500)})}},{key:"_get_product_ids",value:function(){return this._progress=5,i.post("get_product_information",{_ajax_nonce:c.nonce,feed:this._feed,limit:this._limit})}},{key:"_process_batch",value:function(){var t=this,e="Processing Batch ".concat(this._current_batch+1," of ").concat(this._total_batch);this._updateProgressStatus(e),this._log(e),i.post("make_batch_feed",{_ajax_nonce:c.nonce,feed:this._feed,products:this._product_ids[this._current_batch],loop:this._current_batch}).then(function(e){t._current_batch++,t._log("Batch ".concat(t._current_batch," Completed")),t._log(e),t._current_batch<t._total_batch&&(t._process_batch(),t._progress+=t._progress_per_batch),t._current_batch===t._total_batch&&t._save_feed_file()}).fail(function(e){t._log(e),t._updateProgressStatus(e.message),t._color="red",setTimeout(function(){t._stopProgressBar(),t._unblock_button()},1500)})}},{key:"_save_feed_file",value:function(){var t=this;this._log("Saving feed file"),this._updateProgressStatus("Saving feed file"),i.post("save_feed_file",{_ajax_nonce:c.nonce,feed:this._feed}).then(function(e){t._log(e),t._progress=100,t._refresh&&(a.location.href="".concat(c.pages.list.feed,"&link=").concat(e.url,"&cat=").concat(e.cat)),setTimeout(function(){t._stopProgressBar(),setTimeout(function(){t._resetProgressBar(!0),t._unblock_button()},3e3)},2500)}).fail(function(e){t._log(e),t._updateProgressStatus(e.message),t._color="red",setTimeout(function(){t._stopProgressBar(),t._unblock_button()},1500)})}},{key:"_log",value:function(e){return c.wpf_debug&&console.log(e),this}},{key:"_progressBarActive",value:function(e){var t=0<arguments.length&&void 0!==e?e:0,n=this;return this._toggleProgressBar(!0),this._timer=setInterval(function(){n._updateProgressBar()},t||1e3),this}},{key:"_stopProgressBar",value:function(){return clearInterval(this._timer),this}},{key:"_resetProgressBar",value:function(e){return this._toggleProgressBar(!1),this._updateProgressStatus(""),clearInterval(this._timer),this._color=!1,this._timer=null,this._progress=0,e&&this._updateProgressBar(),this}},{key:"_toggleProgressBar",value:function(e){var t=s("#feed_progress_table");return e?t.show():t.hide(),this}},{key:"_updateProgressStatus",value:function(e){return s(".feed-progress-status").text(e),this}},{key:"_updateProgressBar",value:function(){var e=s(".feed-progress-percentage"),t=s(".feed-progress-bar-fill"),n="".concat(Math.round(this._progress),"%");t.css({width:n}),e.text(n)}}]),e}();a.wf={helper:f,feedEditor:_,generator:h},s(a).on("load",function(){null!==s(location).attr("href").match(/webappick.*feed/g)&&s("#wpbody-content").addClass("woofeed-body-content");var e=a.location.search;new URLSearchParams(e).get("action");t(),postboxes.add_postbox_toggles(pagenow),(new h).init(),""!==c.generator.feed&&c.generator.regenerate,_.init(),f.common(),s(".wfmasterTooltip").hover(function(){var e=s(this),t=e.attr("wftitle");e.data("tipText",t).removeAttr("wftitle"),s('<p class="wftooltip"></p>').text(t).appendTo("body").fadeIn("slow")},function(){var e=s(this);e.attr("wftitle",e.data("tipText")),s(".wftooltip").remove()}).mousemove(function(e){s(".wftooltip").css({top:e.pageY+10,left:e.pageX+20})}),s(".generateFeed").validate(),s(r).on("click","[data-toggle_slide]",function(e){e.preventDefault(),s(s(this).data("toggle_slide")).slideToggle("fast")}).on("click","#wf_newRow",function(){var e=s("#table-1 tbody"),t=s("#feed_config_template").text().trim().replace(/__idx__/g,e.find("tr").length);e.append(t),f.fancySelect(s(".outputType"))}).on("click",".single-feed-delete",function(e){e.preventDefault(),confirm(c.form.del_confirm)&&(a.location.href=s(this).attr("val"))}).on("click",".wf_clean_cache_wrapper",function(e){e.preventDefault();var t=s(".woo-feed-clean-cache-nonce").val(),n=s(".woo-feed-cache-loader");n.show(),i.post("clear_cache_data",{_ajax_clean_nonce:t}).then(function(e){e.success&&(n.hide(),location.reload())}).fail(function(e){console.log("something wrong")})}).on("click","#woo-feed-copy-status-btn",function(e){e.preventDefault();var t=s("#woo-feed-copy-status-btn"),n=s("#woo-feed-status-area");t.val("Copied"),n.css("visibility","visible"),n.select(),r.execCommand("copy")}).on("change",".wf_attr.wf_attributes",function(e){e.preventDefault(),s(".fancy-picker-picked").trigger("click");var t,n,a=s(this).val(),r=s(this).parents("tr").find(".outputType"),o=s(this).parents("tr").find(".fancy-picker-content .fancy-picker-option"),i=s(this).parents("tr").find(".fancy-picker-data span");n=["price","current_price","sale_price","price_with_tax","current_price_with_tax","sale_price_with_tax"].includes(a)?(t="for_price","Price"):""!==a&&-1!==a.indexOf("wf_taxo")?(t="for_custom_taxo","parent_if_empty"):(t="for_all","Default"),o.removeClass("selected"),"for_custom_taxo"===t||"for_price"===t?o.each(function(e){n===s(this).text()&&(s(this).addClass("selected"),i.text(n),r.find("option").text(n),r.find("option").val(s(this).data("value")))}):o.each(function(e){"parent_if_empty"!==s(this).text()&&"for_all"===t&&(s(this).addClass("selected"),i.text(n),r.find("option").text(n),r.find("option").val(s(this).data("value")))})}).on("click","#doaction, #doaction2",function(){return confirm(c.form.del_confirm_multi)}).on("change",".dType",function(){var e=s(this),t=e.val(),n=e.closest("tr");"pattern"===t?(n.find(".value_attribute").hide(),n.find(".value_pattern").show()):"attribute"===t?(n.find(".value_attribute").show(),n.find(".value_pattern").hide()):"remove"===t&&(n.find(".value_attribute").hide(),n.find(".value_pattern").hide())}).on("click",".delRow",function(e){e.preventDefault(),s(this).closest("tr").remove(),f.reindex_config_table()}).on("submit","#generateFeed",function(){s(this).validate(),s(this).valid()&&s(".makeFeedResponse").show().html('<b style="color: darkblue;"><i class="dashicons dashicons-sos wpf_spin"></i> '.concat(c.form.generate,"</b>"))}).on("submit","#updatefeed",function(e,t){s(this).validate(),s(this).valid()&&s(".makeFeedResponse").show().html('<b style="color: darkblue;"><i class="dashicons dashicons-sos wpf_spin"></i> '.concat(t&&t.save?c.form.save:c.form.generate,"</b>"))}).on("change",".ftporsftp",function(){var e=s(this).val(),t=s(".ssh2_status");"sftp"===e?(t.show().css("color","dodgerblue").text(c.form.sftp_checking),i.post("get_ssh2_status",{_ajax_nonce:c.nonce,server:e}).then(function(e){"exists"===e?(t.css("color","#2CC185").text(c.form.sftp_available),setTimeout(function(){t.hide()},1500)):t.show().css("color","red").text(c.form.sftp_warning)}).fail(function(e){t.hide(),f.ajax_fail(e)})):t.hide()}).on("click",'[name="save_feed_config"]',function(e){e.preventDefault(),s("#updatefeed").trigger("submit",{save:!0})}).on("change","#provider",function(e){e.preventDefault();var t=s(this).val(),n=s("#feedType"),a=s("#providerPage"),r=s("#feed_merchant_info");a.html('<h3><span style="float:none;margin: -3px 0 0;" class="spinner is-active"></span> '+c.form.loading_tmpl+"</h3>"),r.find(".spinner").addClass("is-active"),n.disabled(!0),n.parent().find(".spinner").addClass("is-active"),r.find(".merchant-info-section .data").html(""),u.hasOwnProperty(t)?_.renderMerchantInfo(r,n,u[t]):i.send("woo_feed_get_merchant_info",{type:"GET",data:{nonce:c.nonce,provider:t}}).then(function(e){u[t]=e,_.renderMerchantInfo(r,n,e)}).fail(f.ajax_fail),p.hasOwnProperty(t)?_.renderMerchantTemplate(a,p[t]):i.post("get_feed_merchant",{_ajax_nonce:c.nonce,merchant:t}).then(function(e){p[t]=e,_.renderMerchantTemplate(a,e),"bing"===t&&(s("#delimiter option").removeAttr("selected"),s('#delimiter option[value="tab"]').attr("selected","selected"),s("#enclosure option").removeAttr("selected"),s('#enclosure option[value=" "]').attr("selected","selected")),"google_product_review"!==t&&s('.wf_attributes option[value="reviewer_name"]').hide()}).fail(f.ajax_fail)}).on("change",".woo_feed_status_input",function(){var e=s(this);i.post("update_feed_status",{_ajax_nonce:c.nonce,feedName:e.val(),status:e[0].checked?1:0})}),s(r).on("change",'[name="is_outOfStock"], [name="product_visibility"]',function(){var e=s(".out-of-stock-visibility");"n"===s('[name="is_outOfStock"]:checked').val()&&"1"===s('[name="product_visibility"]:checked').val()?e.show():e.hide()}).on("change",".attr_type",function(){var e=s(this),t=e.val(),n=e.closest("tr");"pattern"===t?(n.find(".wf_attr").hide(),n.find(".wf_attr").val(""),n.find(".wf_default").show()):(n.find(".wf_attr").show(),n.find(".wf_default").hide(),n.find(".wf_default").val(""))}).on("change",".wf_mattributes, .attr_type",function(){var e=s(this).closest("tr"),t=e.find(".wf_mattributes"),n=e.find(".attr_type"),a=e.find("td:eq(4)"),r=s("#provider").val();if(c.form.google_category.hasOwnProperty(t.val())&&"pattern"===n.val()&&f.in_array(r,c.form.google_category[t.val()])){if(0===a.find("select.selectize").length){a.find("input.wf_default").remove(),a.append('<span class="wf_default wf_attributes"><select name="default[]" class="selectize"></select></span>'),a.append('<span style="font-size:x-small;"><a style="color: red" href="http://webappick.helpscoutdocs.com/article/19-how-to-map-store-category-with-merchant-category" target="_blank">'.concat(c.learn_more,"</a></span>")),d||a.append('<span class="spinner is-active" style="margin: 0;"></span>');var o=a.find(".wf_attributes select");f.selectize(o,{preload:!0,placeholder:c.form.select_category,load:function(e,t){d?t(d):i.send("get_google_categories",{type:"GET",data:{_ajax_nonce:c.nonce,action:"get_google_categories",provider:r}}).then(function(e){t(d=e),a.find(".spinner").remove()}).fail(f.ajax_fail)}})}}else"current_category"!==t.val()&&0===a.find("input.wf_default").length&&(a.find("span").remove(),a.append('<input autocomplete="off" class="wf_default wf_attributes" type="text" name="default[]" value="">'),"pattern"!==n.val()&&a.find("input.wf_default").hide())}).on("change","#feedType,#provider",function(e){var t=s("#feedType").val(),n=s("#provider").val(),a=s(".itemWrapper"),r=s(".wf_csvtxt");""!==t&&f.in_array(n,c.form.item_wrapper_hidden)&&a.hide(),"feedType"===e.target.id&&("csv"===t||"txt"===t||"tsv"===t?(a.hide(),r.show(),"tsv"===t?s("#delimiter option:last").prop("selected","selected"):"csv"===t&&s("#delimiter option:first").prop("selected","selected")):"xml"===t&&(a.show(),r.hide()))}).trigger("change")})}(jQuery,window,document,wp.ajax,wpf_ajax_obj);
|
2 |
-
//# sourceMappingURL=woo-feed-admin.min.js.map
|
1 |
+
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}!function(s,a,r,i,c){s.fn.disabled=function(n){return s(this).each(function(){var e=s(this),t="disabled";void 0!==e.prop(t)?e.prop(t,void 0===n||!0===n):!0===n?e.addClass(t):e.removeClass(t)}),self},s.fn.isDisabled=function(){var e=s(this),t="disabled";return void 0!==e.prop(t)?e.prop(t):e.hasClass(t)};function e(e){s(e.currentTarget).removeClass(function(e,t){return(t.match(/\btooltipped-\S+/g)||[]).join(" ")}).removeClass("tooltipped").removeAttr("aria-label")}function o(e,t){s(e).addClass("tooltipped tooltipped-s").attr("aria-label",t)}function l(e,t){return s.extend(!0,{},e,t)}function t(){n=s(".toClipboard"),!ClipboardJS.isSupported()||/iPhone|iPad/i.test(navigator.userAgent)?n.find("img").hide(0):(n.each(function(){s(this).on("mouseleave",e).on("blur",e)}),new ClipboardJS(".toClipboard").on("error",function(e){var t,n;o(e.trigger,(t=e.action,n="cut"===t?"X":"C",/iPhone|iPad/i.test(navigator.userAgent)?"No support :(":/Mac/i.test(navigator.userAgent)?"Press ⌘-"+n+" to "+t:"Press Ctrl-"+n+" to "+t))}).on("success",function(e){o(e.trigger,"Copied!")}))}var n,d,f={in_array:function(e,t){try{return-1!==t.indexOf(e)}catch(e){return!1}},selectize_render_item:function(e,t){return'<div class="item wapk-selectize-item">'.concat(t(e.text),"</div>")},ajax_fail:function(e){console.warn(e),alert(e.hasOwnProperty("statusText")&&e.hasOwnProperty("status")?c.ajax.error+"\n"+e.statusText+" ("+e.status+")":e)},sortable:function(e,n,a,r){return(e||s(".sorted_table")).each(function(){var e=s(this),t=e.find("tbody > tr:eq(0) > td").length||a||9;e.wf_sortable(l({containerSelector:"table",itemPath:"> tbody",itemSelector:"tr",handle:"i.wf_sortedtable",placeholder:'<tr class="placeholder"><td colspan="'.concat(t,'"></td></tr>'),onDrop:function(e,t,n,a){e.removeClass(t.group.options.draggedClass).removeAttr("style"),s("body").removeClass(t.group.options.bodyClass),r&&"function"==typeof r&&r(e,t,n,a)}},n))})},selectize:function(e,t){return(e||s("select.selectize")).not(".selectized").each(function(){var e=s(this);e.selectize(l({create:e.data("create")||!1,plugins:e.data("plugins")?e.data("plugins").split(",").map(function(e){return e.trim()}):[],render:{item:f.selectize_render_item}},t))})},fancySelect:function(e,t){return(e||s("select.fancySelect")).not(".FancySelectInit").each(function(){s(this).fancySelect(l({maxItemShow:3},t))})},reindex_config_table:function(){s("#table-1").find("tbody tr").each(function(n,e){s(e).find("[name]").each(function(e,t){s(t).attr("name",s(t).attr("name").replace(/(\[\d\])/g,"[".concat(n,"]")))})})},common:function(){f.sortable(s(".sorted_table"),{},9,f.reindex_config_table),f.selectize(),f.fancySelect(s(".outputType"))}},_={form:null,init:function(){this.form=s(".generateFeed"),this.form.length&&(f.common(),s(r).trigger(new jQuery.Event("feedEditor.init",{target:this.form})))},renderMerchantInfo:function(n,a,r){function e(e){var t;r.hasOwnProperty(e)&&(n.find(".merchant-info-section."+e+" .data").html(r[e]),"feed_file_type"===e&&((t=r[e].split(",").map(function(e){return e.trim().toLowerCase()}).filter(function(e){return""!==e&&e!==c.na.toLowerCase()})).length?(a.find("option").removeAttr("selected").each(function(){var e=s(this);e.val()&&!f.in_array(e.val(),t)?e.disabled(!0):e.disabled(!1)}),1===t.length&&a.find('option[value="'+t[0]+'"]').attr("selected","selected")):a.find("option").disabled(!1)))}for(var t in r)e(t);n.find(".spinner").removeClass("is-active"),a.disabled(!1),a.trigger("change"),a.parent().find(".spinner").removeClass("is-active")},renderMerchantTemplate:function(n,a){function e(t){if(a.hasOwnProperty(t))if("tabs"===t)n.html(a[t]);else{var e=s('[name="'+t+'"]');e.length&&e.each(function(){var e=s(this);e.is("select")?e.find('[value="'+a[t]+'"]').prop("selected",!0):(e.is("[type=checkbox]")||e.is("[type=radio]"))&&e.val()===a[t]?e.prop("checked",!0):e.val(a[t])}).trigger("change")}}for(var t in a)e(t);_.init()}},u=[],p=[],h=function(){function e(){_classCallCheck(this,e),this._feed=c.generator.feed,this._limit=c.generator.limit,this._progress=0,this._timer=null,this._color=!1,this._total_batch=0,this._current_batch=0,this._product_ids=[],this._progress_per_batch=0,this._refresh=!0,this._regenerate=c.generator.regenerate,a.isRegenerating=!1,this._all_btn=s(".wpf_regenerate"),this._current_btn=s("#".concat(this._feed.replace("wf_config","wf_feed_"))),this._current_btn_label=""}return _createClass(e,[{key:"init",value:function(){var n=this;""!==this._feed&&this._regenerate&&!1===a.isRegenerating&&this.generate();var e=a.location.search;return"webappick-manage-feeds"===new URLSearchParams(e).get("page")&&s("body").addClass("woo-import-popup-body"),s(r).on("click",".woo-feed-campaign-close-button",function(e){e.preventDefault(),s(this).parent(".woo-feed-promotion").hide();var t=s(this).data("condition");1===t&&i.post("woo_feed_hide_promotion",{_ajax_nonce:c.nonce,condition:t}).then(function(e){n._log(e)}).fail(function(e){n._log(e),n._updateProgressStatus(e.message),n._color="red"})}),s(r).on("click",".wpf_regenerate",function(e){e.preventDefault(),n._current_btn=s(this),n._current_btn.hasClass("disabled")||!0===a.isRegenerating||(n._feed=n._current_btn.attr("id").replace("wf_feed_","wf_config"),""!==n._feed&&n.generate())}),this}},{key:"_block_button",value:function(){this._all_btn.length&&this._all_btn.addClass("disabled"),this._current_btn.length&&(this._current_btn.find("span").addClass("wpf_spin reverse_spin"),this._current_btn_label=this._current_btn.attr("title"),this._current_btn.attr("aria-label",c.regenerate).attr("title",c.regenerate))}},{key:"_unblock_button",value:function(){this._all_btn.length&&this._all_btn.removeClass("disabled"),this._current_btn.length&&(this._current_btn.find("span").removeClass("wpf_spin"),this._current_btn.find("span").removeClass("reverse_spin"),this._current_btn.attr("aria-label",this._current_btn_label).attr("title",this._current_btn_label))}},{key:"generate",value:function(){var t=this,n=this;a.isRegenerating=!0,this._block_button(),this._resetProgressBar(),this._progressBarActive(),this._log("Counting Total Products"),this._updateProgressStatus("Fetching products."),this._get_product_ids().then(function(e){t._progress=10,n._log({response:e}),e.success?(n._log("Total ".concat(e.total," Products found.")),n._product_ids=e.product,n._total_batch=t._product_ids.length,n._current_batch=0,n._progress_per_batch=(90-t._progress)/t._total_batch,n._process_batch(),n._updateProgressStatus("Processing Products...")):n._updateProgressStatus(e.data.message)}).fail(function(e){n._log(e),n._updateProgressStatus(e.message),n._color="red",setTimeout(function(){n._stopProgressBar(),n._unblock_button()},1500)})}},{key:"_get_product_ids",value:function(){return this._progress=5,i.post("get_product_information",{_ajax_nonce:c.nonce,feed:this._feed,limit:this._limit})}},{key:"_process_batch",value:function(){var t=this,e="Processing Batch ".concat(this._current_batch+1," of ").concat(this._total_batch);this._updateProgressStatus(e),this._log(e),i.post("make_batch_feed",{_ajax_nonce:c.nonce,feed:this._feed,products:this._product_ids[this._current_batch],loop:this._current_batch}).then(function(e){t._current_batch++,t._log("Batch ".concat(t._current_batch," Completed")),t._log(e),t._current_batch<t._total_batch&&(t._process_batch(),t._progress+=t._progress_per_batch),t._current_batch===t._total_batch&&t._save_feed_file()}).fail(function(e){t._log(e),t._updateProgressStatus(e.message),t._color="red",setTimeout(function(){t._stopProgressBar(),t._unblock_button()},1500)})}},{key:"_save_feed_file",value:function(){var t=this;this._log("Saving feed file"),this._updateProgressStatus("Saving feed file"),i.post("save_feed_file",{_ajax_nonce:c.nonce,feed:this._feed}).then(function(e){t._log(e),t._progress=100,t._refresh&&(a.location.href="".concat(c.pages.list.feed,"&link=").concat(e.url,"&cat=").concat(e.cat)),setTimeout(function(){t._stopProgressBar(),setTimeout(function(){t._resetProgressBar(!0),t._unblock_button()},3e3)},2500)}).fail(function(e){t._log(e),t._updateProgressStatus(e.message),t._color="red",setTimeout(function(){t._stopProgressBar(),t._unblock_button()},1500)})}},{key:"_log",value:function(e){return c.wpf_debug&&console.log(e),this}},{key:"_progressBarActive",value:function(e){var t=0<arguments.length&&void 0!==e?e:0,n=this;return this._toggleProgressBar(!0),this._timer=setInterval(function(){n._updateProgressBar()},t||1e3),this}},{key:"_stopProgressBar",value:function(){return clearInterval(this._timer),this}},{key:"_resetProgressBar",value:function(e){return this._toggleProgressBar(!1),this._updateProgressStatus(""),clearInterval(this._timer),this._color=!1,this._timer=null,this._progress=0,e&&this._updateProgressBar(),this}},{key:"_toggleProgressBar",value:function(e){var t=s("#feed_progress_table");return e?t.show():t.hide(),this}},{key:"_updateProgressStatus",value:function(e){return s(".feed-progress-status").text(e),this}},{key:"_updateProgressBar",value:function(){var e=s(".feed-progress-percentage"),t=s(".feed-progress-bar-fill"),n="".concat(Math.round(this._progress),"%");t.css({width:n}),e.text(n)}}]),e}();a.wf={helper:f,feedEditor:_,generator:h},s(a).on("load",function(){null!==s(location).attr("href").match(/webappick.*feed/g)&&s("#wpbody-content").addClass("woofeed-body-content");var e=a.location.search;new URLSearchParams(e).get("action");t(),postboxes.add_postbox_toggles(pagenow),(new h).init(),""!==c.generator.feed&&c.generator.regenerate,_.init(),f.common(),s(".wfmasterTooltip").hover(function(){var e=s(this),t=e.attr("wftitle");e.data("tipText",t).removeAttr("wftitle"),s('<p class="wftooltip"></p>').text(t).appendTo("body").fadeIn("slow")},function(){var e=s(this);e.attr("wftitle",e.data("tipText")),s(".wftooltip").remove()}).mousemove(function(e){s(".wftooltip").css({top:e.pageY+10,left:e.pageX+20})}),s(".generateFeed").validate(),s(r).on("click","[data-toggle_slide]",function(e){e.preventDefault(),s(s(this).data("toggle_slide")).slideToggle("fast")}).on("click","#wf_newRow",function(){var e=s("#table-1 tbody"),t=s("#feed_config_template").text().trim().replace(/__idx__/g,e.find("tr").length);e.append(t),f.fancySelect(s(".outputType"))}).on("click",".single-feed-delete",function(e){e.preventDefault(),confirm(c.form.del_confirm)&&(a.location.href=s(this).attr("val"))}).on("click",".wf_clean_cache_wrapper",function(e){e.preventDefault();var t=s(".woo-feed-clean-cache-nonce").val(),n=s(".woo-feed-cache-loader");n.show(),i.post("clear_cache_data",{_ajax_clean_nonce:t}).then(function(e){e.success&&(n.hide(),location.reload())}).fail(function(e){console.log("something wrong")})}).on("click","#woo-feed-copy-status-btn",function(e){e.preventDefault();var t=s("#woo-feed-copy-status-btn"),n=s("#woo-feed-status-area");t.val("Copied"),n.css("visibility","visible"),n.select(),r.execCommand("copy")}).on("change",".wf_attr.wf_attributes",function(e){e.preventDefault(),s(".fancy-picker-picked").trigger("click");var t,n,a=s(this).val(),r=s(this).parents("tr").find(".outputType"),o=s(this).parents("tr").find(".fancy-picker-content .fancy-picker-option"),i=s(this).parents("tr").find(".fancy-picker-data span");n=["price","current_price","sale_price","price_with_tax","current_price_with_tax","sale_price_with_tax"].includes(a)?(t="for_price","Price"):""!==a&&-1!==a.indexOf("wf_taxo")?(t="for_custom_taxo","parent_if_empty"):(t="for_all","Default"),o.removeClass("selected"),"for_custom_taxo"===t||"for_price"===t?o.each(function(e){n===s(this).text()&&(s(this).addClass("selected"),i.text(n),r.find("option").text(n),r.find("option").val(s(this).data("value")))}):o.each(function(e){"parent_if_empty"!==s(this).text()&&"for_all"===t&&(s(this).addClass("selected"),i.text(n),r.find("option").text(n),r.find("option").val(s(this).data("value")))})}).on("click","#doaction, #doaction2",function(){return confirm(c.form.del_confirm_multi)}).on("change",".dType",function(){var e=s(this),t=e.val(),n=e.closest("tr");"pattern"===t?(n.find(".value_attribute").hide(),n.find(".value_pattern").show()):"attribute"===t?(n.find(".value_attribute").show(),n.find(".value_pattern").hide()):"remove"===t&&(n.find(".value_attribute").hide(),n.find(".value_pattern").hide())}).on("click",".delRow",function(e){e.preventDefault(),s(this).closest("tr").remove(),f.reindex_config_table()}).on("submit","#generateFeed",function(){s(this).validate(),s(this).valid()&&s(".makeFeedResponse").show().html('<b style="color: darkblue;"><i class="dashicons dashicons-sos wpf_spin"></i> '.concat(c.form.generate,"</b>"))}).on("submit","#updatefeed",function(e,t){s(this).validate(),s(this).valid()&&s(".makeFeedResponse").show().html('<b style="color: darkblue;"><i class="dashicons dashicons-sos wpf_spin"></i> '.concat(t&&t.save?c.form.save:c.form.generate,"</b>"))}).on("change",".ftporsftp",function(){var e=s(this).val(),t=s(".ssh2_status");"sftp"===e?(t.show().css("color","dodgerblue").text(c.form.sftp_checking),i.post("get_ssh2_status",{_ajax_nonce:c.nonce,server:e}).then(function(e){"exists"===e?(t.css("color","#2CC185").text(c.form.sftp_available),setTimeout(function(){t.hide()},1500)):t.show().css("color","red").text(c.form.sftp_warning)}).fail(function(e){t.hide(),f.ajax_fail(e)})):t.hide()}).on("click",'[name="save_feed_config"]',function(e){e.preventDefault(),s("#updatefeed").trigger("submit",{save:!0})}).on("change","#provider",function(e){e.preventDefault();var t=s(this).val(),n=s("#feedType"),a=s("#providerPage"),r=s("#feed_merchant_info");a.html('<h3><span style="float:none;margin: -3px 0 0;" class="spinner is-active"></span> '+c.form.loading_tmpl+"</h3>"),r.find(".spinner").addClass("is-active"),n.disabled(!0),n.parent().find(".spinner").addClass("is-active"),r.find(".merchant-info-section .data").html(""),u.hasOwnProperty(t)?_.renderMerchantInfo(r,n,u[t]):i.send("woo_feed_get_merchant_info",{type:"GET",data:{nonce:c.nonce,provider:t}}).then(function(e){u[t]=e,_.renderMerchantInfo(r,n,e)}).fail(f.ajax_fail),p.hasOwnProperty(t)?_.renderMerchantTemplate(a,p[t]):i.post("get_feed_merchant",{_ajax_nonce:c.nonce,merchant:t}).then(function(e){p[t]=e,_.renderMerchantTemplate(a,e),"bing"===t&&(s("#delimiter option").removeAttr("selected"),s('#delimiter option[value="tab"]').attr("selected","selected"),s("#enclosure option").removeAttr("selected"),s('#enclosure option[value=" "]').attr("selected","selected")),"google_product_review"!==t&&s('.wf_attributes option[value="reviewer_name"]').hide()}).fail(f.ajax_fail)}).on("change",".woo_feed_status_input",function(){var e=s(this);i.post("update_feed_status",{_ajax_nonce:c.nonce,feedName:e.val(),status:e[0].checked?1:0})}),s(r).on("change",'[name="is_outOfStock"], [name="product_visibility"]',function(){var e=s(".out-of-stock-visibility");"n"===s('[name="is_outOfStock"]:checked').val()&&"1"===s('[name="product_visibility"]:checked').val()?e.show():e.hide()}).on("change",".attr_type",function(){var e=s(this),t=e.val(),n=e.closest("tr");"pattern"===t?(n.find(".wf_attr").hide(),n.find(".wf_attr").val(""),n.find(".wf_default").show()):(n.find(".wf_attr").show(),n.find(".wf_default").hide(),n.find(".wf_default").val(""))}).on("change",".wf_mattributes, .attr_type",function(){var e=s(this).closest("tr"),t=e.find(".wf_mattributes"),n=e.find(".attr_type"),a=e.find("td:eq(4)"),r=s("#provider").val();if(c.form.google_category.hasOwnProperty(t.val())&&"pattern"===n.val()&&f.in_array(r,c.form.google_category[t.val()])){if(0===a.find("select.selectize").length){a.find("input.wf_default").remove(),a.append('<span class="wf_default wf_attributes"><select name="default[]" class="selectize"></select></span>'),a.append('<span style="font-size:x-small;"><a style="color: red" href="http://webappick.helpscoutdocs.com/article/19-how-to-map-store-category-with-merchant-category" target="_blank">'.concat(c.learn_more,"</a></span>")),d||a.append('<span class="spinner is-active" style="margin: 0;"></span>');var o=a.find(".wf_attributes select");f.selectize(o,{preload:!0,placeholder:c.form.select_category,load:function(e,t){d?t(d):i.send("get_google_categories",{type:"GET",data:{_ajax_nonce:c.nonce,action:"get_google_categories",provider:r}}).then(function(e){t(d=e),a.find(".spinner").remove()}).fail(f.ajax_fail)}})}}else"current_category"!==t.val()&&0===a.find("input.wf_default").length&&(a.find("span").remove(),a.append('<input autocomplete="off" class="wf_default wf_attributes" type="text" name="default[]" value="">'),"pattern"!==n.val()&&a.find("input.wf_default").hide())}).on("change","#feedType,#provider",function(e){var t=s("#feedType").val(),n=s("#provider").val(),a=s(".itemWrapper"),r=s(".wf_csvtxt");""!==t&&f.in_array(n,c.form.item_wrapper_hidden)&&a.hide(),"feedType"===e.target.id&&("csv"===t||"txt"===t||"tsv"===t?(a.hide(),r.show(),"tsv"===t?s("#delimiter option:last").prop("selected","selected"):"csv"===t&&s("#delimiter option:first").prop("selected","selected")):"xml"===t&&(a.show(),r.hide()))}).trigger("change")})}(jQuery,window,document,wp.ajax,wpf_ajax_obj);
|
2 |
+
//# sourceMappingURL=woo-feed-admin.min.js.map
|
includes/classes/class-woo-feed-merchant.php
CHANGED
@@ -324,6 +324,7 @@ class Woo_Feed_Merchant {
|
|
324 |
'google' => esc_html__( 'Google Shopping', 'woo-feed' ),
|
325 |
'google_local' => esc_html__( 'Google Local Inventory Ads', 'woo-feed' ),
|
326 |
'google_local_inventory' => esc_html__( 'Google Local Product Inventory', 'woo-feed' ),
|
|
|
327 |
'google_shopping_action' => esc_html__( 'Google Shopping Action', 'woo-feed' ),
|
328 |
'google_promotions' => esc_html__( 'Google Promotions', 'woo-feed' ),
|
329 |
'google_dynamic_ads' => esc_html__( 'Google Dynamic Search Ads', 'woo-feed' ),
|
324 |
'google' => esc_html__( 'Google Shopping', 'woo-feed' ),
|
325 |
'google_local' => esc_html__( 'Google Local Inventory Ads', 'woo-feed' ),
|
326 |
'google_local_inventory' => esc_html__( 'Google Local Product Inventory', 'woo-feed' ),
|
327 |
+
'googlereview' => esc_html__( 'Google Product Review', 'woo-feed' ),
|
328 |
'google_shopping_action' => esc_html__( 'Google Shopping Action', 'woo-feed' ),
|
329 |
'google_promotions' => esc_html__( 'Google Promotions', 'woo-feed' ),
|
330 |
'google_dynamic_ads' => esc_html__( 'Google Dynamic Search Ads', 'woo-feed' ),
|
includes/classes/class-woo-feed-products-v3.php
CHANGED
@@ -580,7 +580,10 @@ class Woo_Feed_Products_v3
|
|
580 |
// Trim XML Element text & Encode for UTF-8
|
581 |
if ( ! empty( $attributeValue ) ) {
|
582 |
$attributeValue = trim( $attributeValue );
|
583 |
-
|
|
|
|
|
|
|
584 |
}
|
585 |
|
586 |
// Add closing XML node if value is empty
|
@@ -1414,7 +1417,7 @@ class Woo_Feed_Products_v3
|
|
1414 |
* @since 3.2.0
|
1415 |
*
|
1416 |
*/
|
1417 |
-
|
1418 |
|
1419 |
if ( method_exists($this, $attribute) ) {
|
1420 |
$output = call_user_func_array(array( $this, $attribute ), array( $product ));
|
580 |
// Trim XML Element text & Encode for UTF-8
|
581 |
if ( ! empty( $attributeValue ) ) {
|
582 |
$attributeValue = trim( $attributeValue );
|
583 |
+
|
584 |
+
if('custom'===$this->config['provider']){
|
585 |
+
$attributeValue = htmlentities( $attributeValue, ENT_XML1 | ENT_QUOTES, 'UTF-8' );
|
586 |
+
}
|
587 |
}
|
588 |
|
589 |
// Add closing XML node if value is empty
|
1417 |
* @since 3.2.0
|
1418 |
*
|
1419 |
*/
|
1420 |
+
public function getAttributeValueByType( $product, $attribute, $merchant_attribute='' ) {
|
1421 |
|
1422 |
if ( method_exists($this, $attribute) ) {
|
1423 |
$output = call_user_func_array(array( $this, $attribute ), array( $product ));
|
includes/classes/class-woo-feed-shipping.php
CHANGED
@@ -283,6 +283,10 @@ class Woo_Feed_Shipping {
|
|
283 |
* @return mixed
|
284 |
*/
|
285 |
public function get_lowest_shipping_price() {
|
|
|
|
|
|
|
|
|
286 |
return min( wp_list_pluck( $this->get_shipping(), 'price' ) );
|
287 |
}
|
288 |
|
283 |
* @return mixed
|
284 |
*/
|
285 |
public function get_lowest_shipping_price() {
|
286 |
+
if(empty($this->get_shipping())){
|
287 |
+
return '0';
|
288 |
+
}
|
289 |
+
|
290 |
return min( wp_list_pluck( $this->get_shipping(), 'price' ) );
|
291 |
}
|
292 |
|
includes/feeds/class-woo-feed-review.php
CHANGED
@@ -74,6 +74,24 @@ class Woo_Feed_Review {
|
|
74 |
*/
|
75 |
private $storeProducts;
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
/**
|
78 |
* Define the core functionality to generate feed.
|
79 |
*
|
@@ -85,12 +103,16 @@ class Woo_Feed_Review {
|
|
85 |
public function __construct( $feedRule ) {
|
86 |
$feedRule['itemWrapper'] = $this->feedWrapper;
|
87 |
$this->products = new Woo_Feed_Products_v3( $feedRule );
|
|
|
88 |
// When update via cron job then set productIds.
|
89 |
if ( ! isset( $feedRule['productIds'] ) ) {
|
90 |
-
$feedRule['productIds'] = $this->products->query_products();
|
|
|
91 |
}
|
92 |
-
|
93 |
-
$this->rules
|
|
|
|
|
94 |
}
|
95 |
|
96 |
|
@@ -123,7 +145,187 @@ class Woo_Feed_Review {
|
|
123 |
return $feed;
|
124 |
}
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
/**
|
129 |
* Make xml node
|
@@ -160,50 +362,6 @@ class Woo_Feed_Review {
|
|
160 |
return "$space<$attribute>$value</$attribute>";
|
161 |
}
|
162 |
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Make XML Feed Header
|
166 |
-
* @return string
|
167 |
-
*/
|
168 |
-
public function get_xml_feed_header() {
|
169 |
-
$output = '<?xml version="1.0" encoding="UTF-8" ?>
|
170 |
-
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd">
|
171 |
-
<publisher><name>' . html_entity_decode( get_option( 'blogname' ) ) . '</name></publisher>
|
172 |
-
<reviews>';
|
173 |
-
|
174 |
-
return $output;
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Make XML Feed
|
179 |
-
* @param array $items items.
|
180 |
-
* @return string
|
181 |
-
*/
|
182 |
-
public function get_xml_feed_body() {
|
183 |
-
$review_data = woo_feed_get_approved_reviews_data();
|
184 |
-
|
185 |
-
$feed = $this->create_xml_lines($review_data);
|
186 |
-
|
187 |
-
//$feed = '<reviewer_data></reviewer_data>';
|
188 |
-
//if ( $review_data ) {
|
189 |
-
//$this->create_xml_lines($review_data);
|
190 |
-
|
191 |
-
return $feed;
|
192 |
-
//}
|
193 |
-
|
194 |
-
}
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Make XML Feed Footer
|
198 |
-
* @return string
|
199 |
-
*/
|
200 |
-
public function get_xml_feed_footer() {
|
201 |
-
$footer = ' </reviews>
|
202 |
-
</feed>';
|
203 |
-
|
204 |
-
return $footer;
|
205 |
-
}
|
206 |
-
|
207 |
/**
|
208 |
* Make XML Feed Body
|
209 |
* @param array $data review product array
|
@@ -352,25 +510,4 @@ class Woo_Feed_Review {
|
|
352 |
return $output;
|
353 |
}
|
354 |
|
355 |
-
/**
|
356 |
-
* Short Products
|
357 |
-
* @return array
|
358 |
-
*/
|
359 |
-
public function short_products() {
|
360 |
-
if ( $this->products ) {
|
361 |
-
update_option( 'wpf_progress', esc_html__('Shorting Products', 'woo-feed' ), false );
|
362 |
-
sleep( 1 );
|
363 |
-
$array = array();
|
364 |
-
$ij = 0;
|
365 |
-
foreach ( $this->products as $key => $item ) {
|
366 |
-
$array[ $ij ] = $item;
|
367 |
-
unset( $this->products[ $key ] );
|
368 |
-
$ij ++;
|
369 |
-
}
|
370 |
-
|
371 |
-
return $this->products = $array;
|
372 |
-
}
|
373 |
-
|
374 |
-
return $this->products;
|
375 |
-
}
|
376 |
}
|
74 |
*/
|
75 |
private $storeProducts;
|
76 |
|
77 |
+
/**
|
78 |
+
* Product Ids
|
79 |
+
*
|
80 |
+
* @since 1.0.0
|
81 |
+
* @var array $ids
|
82 |
+
* @access public
|
83 |
+
*/
|
84 |
+
private $ids;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Review Data
|
88 |
+
*
|
89 |
+
* @since 1.0.0
|
90 |
+
* @var array $data
|
91 |
+
* @access public
|
92 |
+
*/
|
93 |
+
private $data;
|
94 |
+
|
95 |
/**
|
96 |
* Define the core functionality to generate feed.
|
97 |
*
|
103 |
public function __construct( $feedRule ) {
|
104 |
$feedRule['itemWrapper'] = $this->feedWrapper;
|
105 |
$this->products = new Woo_Feed_Products_v3( $feedRule );
|
106 |
+
|
107 |
// When update via cron job then set productIds.
|
108 |
if ( ! isset( $feedRule['productIds'] ) ) {
|
109 |
+
// $feedRule['productIds'] = $this->products->query_products();
|
110 |
+
$feedRule['productIds'] = $this->get_products_with_reviews();
|
111 |
}
|
112 |
+
|
113 |
+
$this->rules = $feedRule;
|
114 |
+
$this->ids = $feedRule['productIds'];
|
115 |
+
$this->data = $this->processReviewsData($feedRule);
|
116 |
}
|
117 |
|
118 |
|
145 |
return $feed;
|
146 |
}
|
147 |
|
148 |
+
public function get_products_with_reviews() {
|
149 |
+
$args = array(
|
150 |
+
'post_type' => 'product',
|
151 |
+
'fields' => 'ids',
|
152 |
+
'status' => 'approve',
|
153 |
+
'comment_count' => array(
|
154 |
+
'value' => 0,
|
155 |
+
'compare' => '>',
|
156 |
+
),
|
157 |
+
);
|
158 |
+
|
159 |
+
$ids = get_posts($args);
|
160 |
+
|
161 |
+
return $ids ? $ids : array();
|
162 |
+
}
|
163 |
+
|
164 |
+
public function sampleData() {
|
165 |
+
$data = array(
|
166 |
+
'filetype' => 'xml',
|
167 |
+
'reviews' => array(
|
168 |
+
array(
|
169 |
+
'review' => array(
|
170 |
+
'review_id' => '1',
|
171 |
+
'reviewer' => array(
|
172 |
+
'reviewer_id' => '11',
|
173 |
+
'name' => 'Anamul Haque 2',
|
174 |
+
),
|
175 |
+
'reviewer-link' => 'anamulhaque@gmail.com',
|
176 |
+
'products' => array(
|
177 |
+
'product' => array(
|
178 |
+
array(
|
179 |
+
'product-id' => '50',
|
180 |
+
'product-name' => 'Hoodie with logo',
|
181 |
+
'product-link' => 'http://www.chaldal.com/hoodie',
|
182 |
+
)
|
183 |
+
)
|
184 |
+
)
|
185 |
+
)
|
186 |
+
),
|
187 |
+
array(
|
188 |
+
'review' => array(
|
189 |
+
'review_id' => '2',
|
190 |
+
'reviewer' => array(
|
191 |
+
'reviewer_id' => '12',
|
192 |
+
'name' => 'Tanvir Hayder',
|
193 |
+
),
|
194 |
+
'reviewer-link' => 'tanvirhayder@gmail.com',
|
195 |
+
'products' => array(
|
196 |
+
'product' => array(
|
197 |
+
array(
|
198 |
+
'product-id' => '10',
|
199 |
+
'product-name' => 'Beanie',
|
200 |
+
'product-link' => 'http://www.chaldal.com/beanie',
|
201 |
+
),
|
202 |
+
)
|
203 |
+
)
|
204 |
+
)
|
205 |
+
),
|
206 |
+
)
|
207 |
+
);
|
208 |
+
|
209 |
+
return $data;
|
210 |
+
}
|
211 |
+
|
212 |
+
public function processReviewsData($config) {
|
213 |
+
$ids = $this->ids;
|
214 |
+
|
215 |
+
$feed = array();
|
216 |
+
$feed['version'] = '2.3';
|
217 |
+
$feed['aggregator']['name'] = 'review';
|
218 |
+
$feed['publisher']['name'] = 'CTX Feed – WooCommerce Product Feed Generator by Webappick';
|
219 |
+
$feed['reviews'] = array();
|
220 |
+
|
221 |
+
if( $ids && is_array($ids) ) {
|
222 |
+
foreach($ids as $id) {
|
223 |
+
$product = wc_get_product($id);
|
224 |
+
// error_log( print_r( $product, true ) );
|
225 |
+
|
226 |
+
$reviews = get_comments(
|
227 |
+
array(
|
228 |
+
'post_id' => $id,
|
229 |
+
'post_type' => 'product'
|
230 |
+
)
|
231 |
+
);
|
232 |
+
|
233 |
+
$review = array();
|
234 |
+
|
235 |
+
if( $reviews && is_array($reviews) ) {
|
236 |
+
foreach($reviews as $single_review) {
|
237 |
+
$review['review']['review_id'] = $single_review->comment_ID;
|
238 |
+
$review['review']['reviewer']['name'] = $single_review->comment_author;
|
239 |
+
$review['review']['reviewer']['reviewer_id'] = $single_review->user_id;
|
240 |
+
$review['review']['content'] = $single_review->comment_content;
|
241 |
+
$review['review']['review_timestamp'] = $single_review->comment_date_gmt;
|
242 |
+
$review['review']['review_url'] = $product->get_permalink();
|
243 |
+
$review['review']['products'] = array();
|
244 |
+
$review['review']['products']['product'] = array();
|
245 |
+
|
246 |
+
// Get Product Attribute values by type and assign to product array
|
247 |
+
foreach ( $config['attributes'] as $attr_key => $attribute ) {
|
248 |
+
$merchant_attribute = isset($config['mattributes'][ $attr_key ]) ? $config['mattributes'][ $attr_key ] : '';
|
249 |
+
|
250 |
+
// Add Prefix and Suffix into Output
|
251 |
+
$prefix = $config['prefix'][ $attr_key ];
|
252 |
+
$suffix = $config['suffix'][ $attr_key ];
|
253 |
+
$merchant = $config['provider'];
|
254 |
+
$feedType = $config['feedType'];
|
255 |
+
|
256 |
+
if ( 'pattern' == $config['type'][ $attr_key ] ) {
|
257 |
+
$attributeValue = $config['default'][ $attr_key ];
|
258 |
+
} else {
|
259 |
+
$attributeValue = $this->products->getAttributeValueByType($product, $attribute, $merchant_attribute);
|
260 |
+
}
|
261 |
+
|
262 |
+
//add prefix - suffix to attribute value
|
263 |
+
$attributeValue = $prefix . $attributeValue . $suffix;
|
264 |
+
|
265 |
+
if( "review_temp_gtin" === $merchant_attribute ) {
|
266 |
+
$review['review']['products']['product']['product_ids']['gtins']['gtin'] = $attributeValue;
|
267 |
+
} elseif( "review_temp_mpn" === $merchant_attribute ) {
|
268 |
+
$review['review']['products']['product']['product_ids']['mpns']['mpn'] = $attributeValue;
|
269 |
+
} elseif( "review_temp_sku" === $merchant_attribute ) {
|
270 |
+
$review['review']['products']['product']['product_ids']['skus']['sku'] = $attributeValue;
|
271 |
+
} elseif( "review_temp_brand" === $merchant_attribute ) {
|
272 |
+
$review['review']['products']['product']['product_ids']['brands']['brand'] = $attributeValue;
|
273 |
+
} else {
|
274 |
+
$review['review']['products']['product'][$merchant_attribute] = $attributeValue;
|
275 |
+
}
|
276 |
+
|
277 |
+
}
|
278 |
+
|
279 |
+
array_push($feed['reviews'], $review);
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
return $feed;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Convert an array to XML
|
290 |
+
*
|
291 |
+
* @param array $array array to convert
|
292 |
+
* @param mixed $xml xml object
|
293 |
+
*
|
294 |
+
*/
|
295 |
+
function woo_feed_array_to_xml($array, &$xml) {
|
296 |
+
foreach($array as $key => $value) {
|
297 |
+
if(is_array($value)) {
|
298 |
+
if(!is_numeric($key)){
|
299 |
+
$subnode = $xml->addChild("$key");
|
300 |
+
$this->woo_feed_array_to_xml($value, $subnode);
|
301 |
+
} else {
|
302 |
+
$this->woo_feed_array_to_xml($value, $xml);
|
303 |
+
}
|
304 |
+
} else {
|
305 |
+
$xml->addChild("$key","$value");
|
306 |
+
}
|
307 |
+
}
|
308 |
+
}
|
309 |
|
310 |
+
/**
|
311 |
+
* Make XML Feed
|
312 |
+
*
|
313 |
+
* @return string
|
314 |
+
*/
|
315 |
+
public function make_review_xml_feed() {
|
316 |
+
// create simpleXML object
|
317 |
+
$xml = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><feed xmlns:vc=\"http://www.w3.org/2007/XMLSchema-versioning\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd\"></feed>");
|
318 |
+
$this->woo_feed_array_to_xml($this->data, $xml);
|
319 |
+
$feedBody = $xml->asXML();
|
320 |
+
|
321 |
+
$data = new DOMDocument();
|
322 |
+
$data->preserveWhiteSpace = false;
|
323 |
+
$data->formatOutput = true;
|
324 |
+
$data->loadXML($feedBody);
|
325 |
+
$feedBody = $data->saveXML();
|
326 |
+
|
327 |
+
return $feedBody;
|
328 |
+
}
|
329 |
|
330 |
/**
|
331 |
* Make xml node
|
362 |
return "$space<$attribute>$value</$attribute>";
|
363 |
}
|
364 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
/**
|
366 |
* Make XML Feed Body
|
367 |
* @param array $data review product array
|
510 |
return $output;
|
511 |
}
|
512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
}
|
includes/helper.php
CHANGED
@@ -418,9 +418,7 @@ if ( ! function_exists( 'woo_feed_get_merchant_class' ) ) {
|
|
418 |
function woo_feed_get_merchant_class( $provider ) {
|
419 |
if ( in_array( $provider, [ 'google', 'google_shopping_action', 'google_local', 'google_local_inventory', 'adroll', 'smartly.io' ], true ) ) {
|
420 |
return 'Woo_Feed_Google';
|
421 |
-
} elseif ( '
|
422 |
-
return 'Woo_Feed_Review';
|
423 |
-
} elseif ( in_array( $provider, array( 'pinterest', 'pinterest_rss' ) ) ) {
|
424 |
return 'Woo_Feed_Pinterest';
|
425 |
} elseif ( 'facebook' === $provider ) {
|
426 |
return 'Woo_Feed_Facebook';
|
418 |
function woo_feed_get_merchant_class( $provider ) {
|
419 |
if ( in_array( $provider, [ 'google', 'google_shopping_action', 'google_local', 'google_local_inventory', 'adroll', 'smartly.io' ], true ) ) {
|
420 |
return 'Woo_Feed_Google';
|
421 |
+
} elseif ( in_array( $provider, array( 'pinterest', 'pinterest_rss' ) ) ) {
|
|
|
|
|
422 |
return 'Woo_Feed_Pinterest';
|
423 |
} elseif ( 'facebook' === $provider ) {
|
424 |
return 'Woo_Feed_Facebook';
|
woo-feed.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
* Plugin Name: CTX Feed
|
11 |
* Plugin URI: https://webappick.com/
|
12 |
* Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
|
13 |
-
* Version: 4.3.
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
@@ -39,7 +39,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
|
|
39 |
* @var string
|
40 |
* @since 3.1.6
|
41 |
*/
|
42 |
-
define( 'WOO_FEED_FREE_VERSION', '4.3.
|
43 |
}
|
44 |
|
45 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
@@ -232,8 +232,24 @@ if ( ! function_exists( 'woo_feed_get_product_information' ) ) {
|
|
232 |
}
|
233 |
try {
|
234 |
do_action( 'before_woo_feed_get_product_information', $getConfig );
|
235 |
-
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
do_action( 'after_woo_feed_get_product_information', $getConfig );
|
238 |
woo_feed_log_feed_process( $getConfig['filename'], sprintf( 'Total %d product found', is_array( $ids ) && ! empty( $ids ) ? count( $ids ) : 0 ) );
|
239 |
if ( is_array( $ids ) && ! empty( $ids ) ) {
|
@@ -346,7 +362,13 @@ if ( ! function_exists( 'woo_feed_make_batch_feed' ) ) {
|
|
346 |
if ( 0 === $offset ) {
|
347 |
woo_feed_unlink_tempFiles( $feedInfo, $feedName );
|
348 |
}
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
if ( $feed_data ) {
|
351 |
woo_feed_log_feed_process( $feedInfo['filename'], sprintf( 'Done Processing Loop %d.', ( $offset + 1 ) ) );
|
352 |
wp_send_json_success(
|
@@ -415,8 +437,9 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
|
|
415 |
|
416 |
// make file xml string
|
417 |
if ( isset( $info['provider'] ) && 'googlereview' === $info['provider'] ) {
|
418 |
-
|
419 |
-
|
|
|
420 |
|
421 |
} else {
|
422 |
if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
|
10 |
* Plugin Name: CTX Feed
|
11 |
* Plugin URI: https://webappick.com/
|
12 |
* Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
|
13 |
+
* Version: 4.3.61
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
39 |
* @var string
|
40 |
* @since 3.1.6
|
41 |
*/
|
42 |
+
define( 'WOO_FEED_FREE_VERSION', '4.3.61' );
|
43 |
}
|
44 |
|
45 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|
232 |
}
|
233 |
try {
|
234 |
do_action( 'before_woo_feed_get_product_information', $getConfig );
|
235 |
+
if( isset($getConfig['provider']) && 'googlereview' === $getConfig['provider'] ) {
|
236 |
+
$args = array(
|
237 |
+
'post_type' => 'product',
|
238 |
+
'fields' => 'ids',
|
239 |
+
'comment_count' => array(
|
240 |
+
'value' => 0,
|
241 |
+
'compare' => '>',
|
242 |
+
),
|
243 |
+
);
|
244 |
+
|
245 |
+
$ids = get_posts($args);
|
246 |
+
|
247 |
+
}else {
|
248 |
+
$products = new Woo_Feed_Products_v3( $getConfig );
|
249 |
+
$ids = $products->query_products();
|
250 |
+
}
|
251 |
+
|
252 |
+
|
253 |
do_action( 'after_woo_feed_get_product_information', $getConfig );
|
254 |
woo_feed_log_feed_process( $getConfig['filename'], sprintf( 'Total %d product found', is_array( $ids ) && ! empty( $ids ) ? count( $ids ) : 0 ) );
|
255 |
if ( is_array( $ids ) && ! empty( $ids ) ) {
|
362 |
if ( 0 === $offset ) {
|
363 |
woo_feed_unlink_tempFiles( $feedInfo, $feedName );
|
364 |
}
|
365 |
+
|
366 |
+
if( isset($feedInfo['provider']) && 'googlereview' === $feedInfo['provider'] ) {
|
367 |
+
$feed_data = true;
|
368 |
+
} else {
|
369 |
+
$feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
|
370 |
+
}
|
371 |
+
|
372 |
if ( $feed_data ) {
|
373 |
woo_feed_log_feed_process( $feedInfo['filename'], sprintf( 'Done Processing Loop %d.', ( $offset + 1 ) ) );
|
374 |
wp_send_json_success(
|
437 |
|
438 |
// make file xml string
|
439 |
if ( isset( $info['provider'] ) && 'googlereview' === $info['provider'] ) {
|
440 |
+
$reviewObj = new Woo_Feed_Review($info);
|
441 |
+
$feedBody = $reviewObj->make_review_xml_feed();
|
442 |
+
$string = $feedBody;
|
443 |
|
444 |
} else {
|
445 |
if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
|