Version Description
(2022-10-22) = * Fixed: Minor issues fixed.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 4.5.4 |
Comparing to | |
See all releases |
Code changes from version 4.5.3 to 4.5.4
- README.txt +4 -1
- V5/Filter/Filter.php +131 -31
- V5/Utility/Config.php +264 -193
- admin/js/woo-feed-admin-pro.min.js +1 -1
- woo-feed.php +1 -1
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: WooCommerce Product Feed, WooCommerce, Google Shopping, Google Merchant, F
|
|
5 |
Requires at least: 4.4
|
6 |
Tested Up To: 6.0
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 4.5.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -590,6 +590,9 @@ Using pro version:
|
|
590 |
|
591 |
== Changelog ==
|
592 |
|
|
|
|
|
|
|
593 |
= 4.5.3 (2022-09-22) =
|
594 |
* Fixed: Both Product Query Type issue fixed.
|
595 |
* Fixed: Minor bug fixing to config class.
|
5 |
Requires at least: 4.4
|
6 |
Tested Up To: 6.0
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 4.5.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
590 |
|
591 |
== Changelog ==
|
592 |
|
593 |
+
= 4.5.4 (2022-10-22) =
|
594 |
+
* Fixed: Minor issues fixed.
|
595 |
+
|
596 |
= 4.5.3 (2022-09-22) =
|
597 |
* Fixed: Both Product Query Type issue fixed.
|
598 |
* Fixed: Minor bug fixing to config class.
|
V5/Filter/Filter.php
CHANGED
@@ -1,91 +1,191 @@
|
|
1 |
-
<?php
|
|
|
2 |
namespace CTXFeed\V5\Filter;
|
|
|
3 |
use CTXFeed\V5\Utility\Config;
|
4 |
use WC_Product;
|
5 |
|
6 |
-
class Filter
|
|
|
7 |
/**
|
8 |
* @var WC_Product $product
|
9 |
*/
|
10 |
private $product;
|
|
|
|
|
|
|
11 |
private $config;
|
12 |
|
13 |
-
public function __construct(
|
|
|
14 |
$this->product = $product;
|
15 |
-
$this->config
|
16 |
}
|
17 |
|
18 |
/**
|
19 |
* @return bool
|
20 |
*/
|
21 |
-
public function exclude()
|
|
|
22 |
$exclude = false;
|
23 |
|
24 |
// Remove Out Of Stock Product.
|
25 |
-
|
26 |
-
$exclude = true;
|
27 |
-
}
|
28 |
|
29 |
// Remove On Backorder Product.
|
30 |
-
|
31 |
-
$exclude = true;
|
32 |
-
}
|
33 |
|
34 |
-
//
|
|
|
35 |
|
36 |
-
//
|
|
|
37 |
|
38 |
// Remove empty description product.
|
39 |
-
|
40 |
-
$exclude = true;
|
41 |
-
}
|
42 |
|
43 |
// Remove empty image product.
|
44 |
-
|
45 |
-
$exclude = true;
|
46 |
-
}
|
47 |
|
48 |
// Remove empty price product.
|
49 |
-
|
50 |
-
$exclude = true;
|
51 |
-
}
|
52 |
|
53 |
// Exclude for variation
|
54 |
-
if (
|
55 |
-
$exclude = $this->exclude_variation(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
|
|
|
|
57 |
|
|
|
58 |
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
$id = $this->product->get_id();
|
64 |
-
if (
|
65 |
$id = $this->product->get_parent_id();
|
66 |
}
|
67 |
|
68 |
// Remove products which are set to exclude.
|
69 |
$exclude_products = $this->config->get_products_to_exclude();
|
70 |
-
if (
|
71 |
$exclude = true;
|
72 |
}
|
73 |
|
74 |
// Only add products which are set to include.
|
75 |
$include_products = $this->config->get_products_to_include();
|
76 |
-
if (
|
77 |
$exclude = true;
|
78 |
}
|
79 |
|
80 |
// Remove categories which are set to exclude.
|
81 |
$exclude_categories = $this->config->get_categories_to_exclude();
|
82 |
-
if (
|
83 |
$exclude = true;
|
84 |
}
|
85 |
|
86 |
// Only add categories which are set to include.
|
87 |
$include_categories = $this->config->get_categories_to_include();
|
88 |
-
if (
|
89 |
$exclude = true;
|
90 |
}
|
91 |
|
1 |
+
<?php /** @noinspection ALL */
|
2 |
+
|
3 |
namespace CTXFeed\V5\Filter;
|
4 |
+
|
5 |
use CTXFeed\V5\Utility\Config;
|
6 |
use WC_Product;
|
7 |
|
8 |
+
class Filter
|
9 |
+
{
|
10 |
/**
|
11 |
* @var WC_Product $product
|
12 |
*/
|
13 |
private $product;
|
14 |
+
/**
|
15 |
+
* @var Config $config
|
16 |
+
*/
|
17 |
private $config;
|
18 |
|
19 |
+
public function __construct($product, $config)
|
20 |
+
{
|
21 |
$this->product = $product;
|
22 |
+
$this->config = $config;
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
* @return bool
|
27 |
*/
|
28 |
+
public function exclude()
|
29 |
+
{
|
30 |
$exclude = false;
|
31 |
|
32 |
// Remove Out Of Stock Product.
|
33 |
+
$exclude = $this->exclude_out_of_stock();
|
|
|
|
|
34 |
|
35 |
// Remove On Backorder Product.
|
36 |
+
$exclude = $this->exclude_back_order();
|
|
|
|
|
37 |
|
38 |
+
//Remove Hidden Product.
|
39 |
+
$exclude = $this->exclude_hidden_products();
|
40 |
|
41 |
+
//Remove empty title product.
|
42 |
+
$exclude = $this->exclude_empty_title_products();
|
43 |
|
44 |
// Remove empty description product.
|
45 |
+
$exclude = $this->exclude_empty_description_products();
|
|
|
|
|
46 |
|
47 |
// Remove empty image product.
|
48 |
+
$exclude = $this->exclude_empty_image_products();
|
|
|
|
|
49 |
|
50 |
// Remove empty price product.
|
51 |
+
$exclude = $this->exclude_empty_price_products();
|
|
|
|
|
52 |
|
53 |
// Exclude for variation
|
54 |
+
if ($this->product->is_type('variation')) {
|
55 |
+
$exclude = $this->exclude_variation($exclude);
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
return apply_filters('ctx_feed_filter_product', $exclude, $this->product, $this->config);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Remove out of stock products.
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
public function exclude_out_of_stock_products()
|
68 |
+
{
|
69 |
+
if ($this->config->remove_outofstock_product() && ($this->product->get_stock_status() === 'outofstock' || $this->product->get_stock_quantity() === 0)) {
|
70 |
+
return true;
|
71 |
}
|
72 |
+
return false;
|
73 |
+
}
|
74 |
|
75 |
+
//TODO Out of stock visibility.
|
76 |
|
77 |
+
/**
|
78 |
+
* Remove back order products.
|
79 |
+
*
|
80 |
+
* @return bool
|
81 |
+
*/
|
82 |
+
public function exclude_back_order_products()
|
83 |
+
{
|
84 |
+
if ($this->config->remove_backorder_product() && $this->product->get_stock_status() === 'onbackorder') {
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
return false;
|
88 |
}
|
89 |
|
90 |
+
/**
|
91 |
+
* Remove empty title products.
|
92 |
+
*
|
93 |
+
* @return bool
|
94 |
+
*/
|
95 |
+
public function exclude_empty_title_products()
|
96 |
+
{
|
97 |
+
if ($this->config->remove_empty_title() && empty($this->product->get_name())) {
|
98 |
+
return true;
|
99 |
+
}
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Remove hidden products.
|
105 |
+
*
|
106 |
+
* @return bool
|
107 |
+
*/
|
108 |
+
public function exclude_hidden_products()
|
109 |
+
{
|
110 |
+
if ($this->config->remove_hidden_products() && $this->product->get_catalog_visibility() === 'hidden') {
|
111 |
+
return true;
|
112 |
+
}
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Remove empty description products.
|
118 |
+
*
|
119 |
+
* @return bool
|
120 |
+
*/
|
121 |
+
public function exclude_empty_description_products()
|
122 |
+
{
|
123 |
+
if ($this->config->remove_empty_description() && empty($this->product->get_description())) {
|
124 |
+
return true;
|
125 |
+
}
|
126 |
+
return false;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Remove empty image products.
|
131 |
+
*
|
132 |
+
* @return bool
|
133 |
+
*/
|
134 |
+
public function exclude_empty_image_products()
|
135 |
+
{
|
136 |
+
if ($this->config->remove_empty_image() && empty($this->product->get_image('woocommerce_thumbnail', [], false))) {
|
137 |
+
return true;
|
138 |
+
}
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Return Empty Price products.
|
144 |
+
*
|
145 |
+
* @return bool
|
146 |
+
*/
|
147 |
+
public function exclude_empty_price_products()
|
148 |
+
{
|
149 |
+
if ($this->config->remove_empty_price() && empty($this->product->get_price())) {
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Exclude Variations.
|
157 |
+
*
|
158 |
+
* @param $exclude
|
159 |
+
* @return bool|mixed
|
160 |
+
*/
|
161 |
+
public function exclude_variation($exclude)
|
162 |
+
{
|
163 |
$id = $this->product->get_id();
|
164 |
+
if ($this->product->is_type('variation')) {
|
165 |
$id = $this->product->get_parent_id();
|
166 |
}
|
167 |
|
168 |
// Remove products which are set to exclude.
|
169 |
$exclude_products = $this->config->get_products_to_exclude();
|
170 |
+
if ($exclude_products && in_array($this->product->get_id(), $exclude_products, true)) {
|
171 |
$exclude = true;
|
172 |
}
|
173 |
|
174 |
// Only add products which are set to include.
|
175 |
$include_products = $this->config->get_products_to_include();
|
176 |
+
if ($include_products && !in_array($this->product->get_id(), $include_products, true)) {
|
177 |
$exclude = true;
|
178 |
}
|
179 |
|
180 |
// Remove categories which are set to exclude.
|
181 |
$exclude_categories = $this->config->get_categories_to_exclude();
|
182 |
+
if ($exclude_categories && has_term($exclude_categories, 'product_cat', $id)) {
|
183 |
$exclude = true;
|
184 |
}
|
185 |
|
186 |
// Only add categories which are set to include.
|
187 |
$include_categories = $this->config->get_categories_to_include();
|
188 |
+
if ($include_categories && !has_term($include_categories, 'product_cat', $id)) {
|
189 |
$exclude = true;
|
190 |
}
|
191 |
|
V5/Utility/Config.php
CHANGED
@@ -4,7 +4,8 @@ namespace CTXFeed\V5\Utility;
|
|
4 |
/**
|
5 |
* This class contain feed information.
|
6 |
*/
|
7 |
-
class Config
|
|
|
8 |
/**
|
9 |
* @var array|bool
|
10 |
*/
|
@@ -20,43 +21,49 @@ class Config {
|
|
20 |
private $context;
|
21 |
|
22 |
/**
|
23 |
-
* @param array
|
24 |
* @param string $context
|
25 |
*/
|
26 |
-
public function __construct(
|
|
|
27 |
|
28 |
$this->feedInfo = $feedInfo;
|
29 |
-
$this->context
|
30 |
-
$config
|
31 |
-
$this->set_config(
|
32 |
}
|
33 |
|
34 |
-
public function __isset(
|
35 |
-
|
|
|
36 |
return true;
|
37 |
}
|
38 |
|
39 |
return false;
|
40 |
}
|
41 |
|
42 |
-
public function __get(
|
43 |
-
|
|
|
44 |
}
|
45 |
|
46 |
-
public function __set(
|
47 |
-
|
|
|
48 |
}
|
49 |
|
50 |
-
public function __unset(
|
51 |
-
|
|
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
*
|
56 |
* @return array
|
57 |
*/
|
58 |
-
public function get_feed_rules()
|
59 |
-
|
|
|
60 |
}
|
61 |
|
62 |
/**
|
@@ -64,8 +71,9 @@ class Config {
|
|
64 |
*
|
65 |
* @return string
|
66 |
*/
|
67 |
-
public function get_feed_id()
|
68 |
-
|
|
|
69 |
return $this->config['feed_id'];
|
70 |
}
|
71 |
|
@@ -77,8 +85,9 @@ class Config {
|
|
77 |
*
|
78 |
* @return string
|
79 |
*/
|
80 |
-
public function get_feed_name()
|
81 |
-
|
|
|
82 |
return $this->config['filename'];
|
83 |
}
|
84 |
|
@@ -90,10 +99,11 @@ class Config {
|
|
90 |
*
|
91 |
* @return string
|
92 |
*/
|
93 |
-
public function get_feed_file_name(
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
97 |
return $fileInfo;
|
98 |
}
|
99 |
|
@@ -108,8 +118,9 @@ class Config {
|
|
108 |
*
|
109 |
* @return string
|
110 |
*/
|
111 |
-
public function get_feed_template()
|
112 |
-
|
|
|
113 |
return $this->config['provider'];
|
114 |
}
|
115 |
|
@@ -121,8 +132,9 @@ class Config {
|
|
121 |
*
|
122 |
* @return string
|
123 |
*/
|
124 |
-
public function get_feed_language()
|
125 |
-
|
|
|
126 |
return $this->config['feedLanguage'];
|
127 |
}
|
128 |
|
@@ -134,21 +146,22 @@ class Config {
|
|
134 |
*
|
135 |
* @return string
|
136 |
*/
|
137 |
-
public function get_feed_currency()
|
138 |
-
|
|
|
139 |
return $this->config['feedCurrency'];
|
140 |
}
|
141 |
|
142 |
$attributes = $this->config['attributes'];
|
143 |
-
$priceAttrs = [
|
144 |
-
foreach (
|
145 |
-
$key = array_search(
|
146 |
-
if (
|
147 |
break;
|
148 |
}
|
149 |
}
|
150 |
|
151 |
-
return isset(
|
152 |
}
|
153 |
|
154 |
/**
|
@@ -156,8 +169,9 @@ class Config {
|
|
156 |
*
|
157 |
* @return string
|
158 |
*/
|
159 |
-
public function get_feed_country()
|
160 |
-
|
|
|
161 |
return $this->config['feed_country'];
|
162 |
}
|
163 |
|
@@ -169,8 +183,9 @@ class Config {
|
|
169 |
*
|
170 |
* @return string
|
171 |
*/
|
172 |
-
public function get_feed_file_type()
|
173 |
-
|
|
|
174 |
return $this->config['feedType'];
|
175 |
}
|
176 |
|
@@ -182,15 +197,16 @@ class Config {
|
|
182 |
*
|
183 |
* @return string
|
184 |
*/
|
185 |
-
public function get_delimiter()
|
186 |
-
|
187 |
-
|
|
|
188 |
$this->config['delimiter'] = "\t";
|
189 |
|
190 |
return $this->config['delimiter'];
|
191 |
}
|
192 |
|
193 |
-
if (
|
194 |
$this->config['delimiter'] = "\s";
|
195 |
}
|
196 |
|
@@ -205,12 +221,13 @@ class Config {
|
|
205 |
*
|
206 |
* @return string
|
207 |
*/
|
208 |
-
public function get_enclosure()
|
209 |
-
|
|
|
210 |
'double',
|
211 |
'single'
|
212 |
-
]
|
213 |
-
return (
|
214 |
}
|
215 |
|
216 |
return false;
|
@@ -221,8 +238,9 @@ class Config {
|
|
221 |
*
|
222 |
* @return string
|
223 |
*/
|
224 |
-
public function get_feed_items_wrapper()
|
225 |
-
|
|
|
226 |
return $this->config['itemsWrapper'];
|
227 |
}
|
228 |
|
@@ -234,8 +252,9 @@ class Config {
|
|
234 |
*
|
235 |
* @return string
|
236 |
*/
|
237 |
-
public function get_feed_item_wrapper()
|
238 |
-
|
|
|
239 |
return $this->config['itemWrapper'];
|
240 |
}
|
241 |
|
@@ -247,8 +266,9 @@ class Config {
|
|
247 |
*
|
248 |
* @return string
|
249 |
*/
|
250 |
-
public function get_feed_extra_header()
|
251 |
-
|
|
|
252 |
return $this->config['extraHeader'];
|
253 |
}
|
254 |
|
@@ -260,8 +280,9 @@ class Config {
|
|
260 |
*
|
261 |
* @return string
|
262 |
*/
|
263 |
-
public function get_shipping_country()
|
264 |
-
|
|
|
265 |
return $this->config['shipping_country'];
|
266 |
}
|
267 |
|
@@ -273,8 +294,9 @@ class Config {
|
|
273 |
*
|
274 |
* @return string
|
275 |
*/
|
276 |
-
public function get_tax_country()
|
277 |
-
|
|
|
278 |
return $this->config['tax_country'];
|
279 |
}
|
280 |
|
@@ -286,8 +308,9 @@ class Config {
|
|
286 |
*
|
287 |
* @return array|bool
|
288 |
*/
|
289 |
-
public function get_string_replace()
|
290 |
-
|
|
|
291 |
return $this->config['str_replace'];
|
292 |
}
|
293 |
|
@@ -299,16 +322,17 @@ class Config {
|
|
299 |
*
|
300 |
* @return array|bool
|
301 |
*/
|
302 |
-
public function get_campaign_parameters()
|
303 |
-
|
|
|
304 |
return wp_parse_args(
|
305 |
$this->config['campaign_parameters'],
|
306 |
array(
|
307 |
-
'utm_source'
|
308 |
-
'utm_medium'
|
309 |
'utm_campaign' => '',
|
310 |
-
'utm_term'
|
311 |
-
'utm_content'
|
312 |
)
|
313 |
);
|
314 |
}
|
@@ -321,8 +345,9 @@ class Config {
|
|
321 |
*
|
322 |
* @return bool
|
323 |
*/
|
324 |
-
public function remove_backorder_product()
|
325 |
-
|
|
|
326 |
return 'y' === $this->config['is_backorder'];
|
327 |
}
|
328 |
|
@@ -334,8 +359,9 @@ class Config {
|
|
334 |
*
|
335 |
* @return bool
|
336 |
*/
|
337 |
-
public function remove_outofstock_product()
|
338 |
-
|
|
|
339 |
return 'y' === $this->config['is_outOfStock'];
|
340 |
}
|
341 |
|
@@ -347,8 +373,23 @@ class Config {
|
|
347 |
*
|
348 |
* @return bool
|
349 |
*/
|
350 |
-
public function
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
return 'y' === $this->config['is_emptyDescription'];
|
353 |
}
|
354 |
|
@@ -360,8 +401,9 @@ class Config {
|
|
360 |
*
|
361 |
* @return bool
|
362 |
*/
|
363 |
-
public function remove_empty_image()
|
364 |
-
|
|
|
365 |
return 'y' === $this->config['is_emptyImage'];
|
366 |
}
|
367 |
|
@@ -373,28 +415,39 @@ class Config {
|
|
373 |
*
|
374 |
* @return bool
|
375 |
*/
|
376 |
-
public function remove_empty_price()
|
377 |
-
|
|
|
378 |
return 'y' === $this->config['is_emptyPrice'];
|
379 |
}
|
380 |
|
381 |
return false;
|
382 |
}
|
383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
/**
|
385 |
* Get Number Format.
|
386 |
*
|
387 |
* @return bool|array
|
388 |
*/
|
389 |
-
public function get_number_format()
|
390 |
-
|
|
|
391 |
$number_format = [
|
392 |
-
'decimal_separator'
|
393 |
-
'thousand_separator' => apply_filters(
|
394 |
-
'decimals'
|
395 |
];
|
396 |
|
397 |
-
return apply_filters(
|
398 |
}
|
399 |
|
400 |
return false;
|
@@ -405,12 +458,13 @@ class Config {
|
|
405 |
*
|
406 |
* @return array|bool
|
407 |
*/
|
408 |
-
public function get_products_to_exclude()
|
|
|
409 |
|
410 |
-
if (
|
411 |
$mode = $this->config['filter_mode'];
|
412 |
-
if (
|
413 |
-
return explode(
|
414 |
}
|
415 |
}
|
416 |
|
@@ -422,12 +476,13 @@ class Config {
|
|
422 |
*
|
423 |
* @return array|bool
|
424 |
*/
|
425 |
-
public function get_products_to_include()
|
|
|
426 |
|
427 |
-
if (
|
428 |
$mode = $this->config['filter_mode'];
|
429 |
-
if (
|
430 |
-
return explode(
|
431 |
}
|
432 |
}
|
433 |
|
@@ -439,11 +494,12 @@ class Config {
|
|
439 |
*
|
440 |
* @return mixed
|
441 |
*/
|
442 |
-
public function get_categories_to_exclude()
|
|
|
443 |
|
444 |
-
if (
|
445 |
$mode = $this->config['filter_mode'];
|
446 |
-
if (
|
447 |
return $this->config['categories'];
|
448 |
}
|
449 |
}
|
@@ -456,11 +512,12 @@ class Config {
|
|
456 |
*
|
457 |
* @return mixed
|
458 |
*/
|
459 |
-
public function get_categories_to_include()
|
|
|
460 |
|
461 |
-
if (
|
462 |
$mode = $this->config['filter_mode'];
|
463 |
-
if (
|
464 |
return $this->config['categories'];
|
465 |
}
|
466 |
}
|
@@ -474,16 +531,17 @@ class Config {
|
|
474 |
*
|
475 |
* @return mixed
|
476 |
*/
|
477 |
-
public function get_post_status_to_include()
|
478 |
-
|
479 |
-
|
|
|
480 |
$mode = $this->config['filter_mode'];
|
481 |
-
if (
|
482 |
return $this->config['post_status'];
|
483 |
}
|
484 |
|
485 |
-
if (
|
486 |
-
return array_unique(array_merge(
|
487 |
}
|
488 |
}
|
489 |
|
@@ -495,10 +553,11 @@ class Config {
|
|
495 |
*
|
496 |
* @return string|bool
|
497 |
*/
|
498 |
-
public function get_vendors_to_include()
|
|
|
499 |
|
500 |
-
if (
|
501 |
-
return implode(
|
502 |
}
|
503 |
|
504 |
return false;
|
@@ -509,9 +568,10 @@ class Config {
|
|
509 |
*
|
510 |
* @return bool
|
511 |
*/
|
512 |
-
public function get_variations_to_include()
|
|
|
513 |
|
514 |
-
return isset(
|
515 |
}
|
516 |
|
517 |
/**
|
@@ -519,13 +579,14 @@ class Config {
|
|
519 |
*
|
520 |
* @return array|bool
|
521 |
*/
|
522 |
-
public function get_advance_filters()
|
523 |
-
|
|
|
524 |
return [
|
525 |
-
"fattribute"
|
526 |
-
"condition"
|
527 |
"filterCompare" => $this->config['filterCompare'],
|
528 |
-
"concatType"
|
529 |
];
|
530 |
}
|
531 |
|
@@ -537,21 +598,22 @@ class Config {
|
|
537 |
*
|
538 |
* @return array|bool
|
539 |
*/
|
540 |
-
public function get_ftp_config()
|
541 |
-
|
|
|
542 |
|
543 |
// if ( '0' === $this->config['ftpenabled'] ) {
|
544 |
// return false;
|
545 |
// }
|
546 |
|
547 |
return [
|
548 |
-
"type"
|
549 |
-
"host"
|
550 |
-
"port"
|
551 |
"username" => $this->config['ftpuser'],
|
552 |
"password" => $this->config['ftppassword'],
|
553 |
-
"path"
|
554 |
-
"mode"
|
555 |
];
|
556 |
}
|
557 |
|
@@ -563,12 +625,13 @@ class Config {
|
|
563 |
*
|
564 |
* @return array|bool
|
565 |
*/
|
566 |
-
public function get_variable_config()
|
567 |
-
|
|
|
568 |
return [
|
569 |
-
"is_variations"
|
570 |
-
"variable_price"
|
571 |
-
"variable_quantity" => isset(
|
572 |
];
|
573 |
}
|
574 |
|
@@ -580,8 +643,9 @@ class Config {
|
|
580 |
*
|
581 |
* @return mixed
|
582 |
*/
|
583 |
-
public function get_composite_price_type()
|
584 |
-
|
|
|
585 |
return $this->config['composite_price'];
|
586 |
}
|
587 |
|
@@ -593,7 +657,8 @@ class Config {
|
|
593 |
*
|
594 |
* @return array
|
595 |
*/
|
596 |
-
public function get_feed()
|
|
|
597 |
return $this->feedInfo;
|
598 |
}
|
599 |
|
@@ -602,7 +667,8 @@ class Config {
|
|
602 |
*
|
603 |
* @return array
|
604 |
*/
|
605 |
-
public function get_config()
|
|
|
606 |
return $this->config;
|
607 |
}
|
608 |
|
@@ -611,96 +677,98 @@ class Config {
|
|
611 |
*
|
612 |
* @return array
|
613 |
*/
|
614 |
-
private function set_config(
|
|
|
615 |
|
616 |
$defaults = array(
|
617 |
-
'provider'
|
618 |
-
'feed_country'
|
619 |
-
'filename'
|
620 |
-
'feedType'
|
621 |
-
'ftpenabled'
|
622 |
-
'ftporsftp'
|
623 |
-
'ftphost'
|
624 |
-
'ftpport'
|
625 |
-
'ftpuser'
|
626 |
-
'ftppassword'
|
627 |
-
'ftppath'
|
628 |
-
'ftpmode'
|
629 |
-
'is_variations'
|
630 |
-
'variable_price'
|
631 |
-
'variable_quantity'
|
632 |
-
'feedLanguage'
|
633 |
-
'feedCurrency'
|
634 |
-
'itemsWrapper'
|
635 |
-
'itemWrapper'
|
636 |
-
'delimiter'
|
637 |
-
'enclosure'
|
638 |
-
'extraHeader'
|
639 |
-
'vendors'
|
640 |
// Feed Config
|
641 |
-
'mattributes'
|
642 |
-
'prefix'
|
643 |
-
'type'
|
644 |
-
'attributes'
|
645 |
-
'default'
|
646 |
-
'suffix'
|
647 |
-
'output_type'
|
648 |
-
'limit'
|
649 |
// filters tab
|
650 |
-
'composite_price'
|
651 |
-
'product_ids'
|
652 |
-
'categories'
|
653 |
-
'post_status'
|
654 |
-
'filter_mode'
|
655 |
-
'campaign_parameters'
|
656 |
-
'is_outOfStock'
|
657 |
-
'is_backorder'
|
658 |
-
'is_emptyDescription'
|
659 |
-
'
|
660 |
-
'
|
661 |
-
'
|
662 |
-
'
|
663 |
-
'
|
|
|
664 |
// include hidden ? 1 yes 0 no
|
665 |
'outofstock_visibility' => 0,
|
666 |
// override wc global option for out-of-stock product hidden from catalog? 1 yes 0 no
|
667 |
-
'ptitle_show'
|
668 |
-
'decimal_separator'
|
669 |
-
'thousand_separator'
|
670 |
-
'decimals'
|
671 |
);
|
672 |
|
673 |
-
$this->config
|
674 |
$this->config['filter_mode'] = wp_parse_args(
|
675 |
$this->config['filter_mode'],
|
676 |
array(
|
677 |
'product_ids' => 'include',
|
678 |
-
'categories'
|
679 |
'post_status' => 'include',
|
680 |
)
|
681 |
);
|
682 |
|
683 |
-
if (
|
684 |
/**
|
685 |
* filter parsed rules for provider
|
686 |
*
|
687 |
-
* @param array
|
688 |
* @param string $context
|
689 |
*
|
690 |
* @since 3.3.7
|
691 |
*/
|
692 |
-
$this->config = apply_filters(
|
693 |
}
|
694 |
|
695 |
/**
|
696 |
* filter parsed rules
|
697 |
*
|
698 |
-
* @param array
|
699 |
* @param string $context
|
700 |
*
|
701 |
* @since 3.3.7 $provider parameter removed
|
702 |
*/
|
703 |
-
$this->config = apply_filters(
|
704 |
|
705 |
return $this->config;
|
706 |
}
|
@@ -710,8 +778,9 @@ class Config {
|
|
710 |
*
|
711 |
* @return array|bool
|
712 |
*/
|
713 |
-
public function get_feed_url()
|
714 |
-
|
|
|
715 |
return $this->feedInfo['url'];
|
716 |
}
|
717 |
|
@@ -723,16 +792,17 @@ class Config {
|
|
723 |
*
|
724 |
* @return string|bool
|
725 |
*/
|
726 |
-
public function get_feed_path()
|
|
|
727 |
$upload_dir = wp_get_upload_dir();
|
728 |
-
$url
|
729 |
-
$file_name
|
730 |
|
731 |
-
if (
|
732 |
return false;
|
733 |
}
|
734 |
|
735 |
-
return sprintf(
|
736 |
}
|
737 |
|
738 |
|
@@ -741,8 +811,9 @@ class Config {
|
|
741 |
*
|
742 |
* @return array|bool
|
743 |
*/
|
744 |
-
public function get_feed_status()
|
745 |
-
|
|
|
746 |
return $this->feedInfo['status'];
|
747 |
}
|
748 |
|
4 |
/**
|
5 |
* This class contain feed information.
|
6 |
*/
|
7 |
+
class Config
|
8 |
+
{
|
9 |
/**
|
10 |
* @var array|bool
|
11 |
*/
|
21 |
private $context;
|
22 |
|
23 |
/**
|
24 |
+
* @param array $feedInfo
|
25 |
* @param string $context
|
26 |
*/
|
27 |
+
public function __construct($feedInfo, $context = 'view')
|
28 |
+
{
|
29 |
|
30 |
$this->feedInfo = $feedInfo;
|
31 |
+
$this->context = $context;
|
32 |
+
$config = isset($this->feedInfo['feedrules']) ? $this->feedInfo['feedrules'] : $this->feedInfo;
|
33 |
+
$this->set_config($config);
|
34 |
}
|
35 |
|
36 |
+
public function __isset($name)
|
37 |
+
{
|
38 |
+
if (isset($this->config[$name])) {
|
39 |
return true;
|
40 |
}
|
41 |
|
42 |
return false;
|
43 |
}
|
44 |
|
45 |
+
public function __get($name)
|
46 |
+
{
|
47 |
+
return $this->config[$name];
|
48 |
}
|
49 |
|
50 |
+
public function __set($name, $value)
|
51 |
+
{
|
52 |
+
return $this->config[$name] = $value;
|
53 |
}
|
54 |
|
55 |
+
public function __unset($name)
|
56 |
+
{
|
57 |
+
unset($this->config[$name]);
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
*
|
62 |
* @return array
|
63 |
*/
|
64 |
+
public function get_feed_rules()
|
65 |
+
{
|
66 |
+
return isset($this->feedInfo['feedrules']) ? $this->feedInfo['feedrules'] : $this->feedInfo;
|
67 |
}
|
68 |
|
69 |
/**
|
71 |
*
|
72 |
* @return string
|
73 |
*/
|
74 |
+
public function get_feed_id()
|
75 |
+
{
|
76 |
+
if (isset($this->config['feed_id']) && !empty($this->config['feed_id'])) {
|
77 |
return $this->config['feed_id'];
|
78 |
}
|
79 |
|
85 |
*
|
86 |
* @return string
|
87 |
*/
|
88 |
+
public function get_feed_name()
|
89 |
+
{
|
90 |
+
if (isset($this->config['filename']) && !empty($this->config['filename'])) {
|
91 |
return $this->config['filename'];
|
92 |
}
|
93 |
|
99 |
*
|
100 |
* @return string
|
101 |
*/
|
102 |
+
public function get_feed_file_name($array = false)
|
103 |
+
{
|
104 |
+
if (isset($this->feedInfo['url']) && !empty($this->feedInfo['url'])) {
|
105 |
+
$fileInfo = pathinfo($this->feedInfo['url']);
|
106 |
+
if ($array) {
|
107 |
return $fileInfo;
|
108 |
}
|
109 |
|
118 |
*
|
119 |
* @return string
|
120 |
*/
|
121 |
+
public function get_feed_template()
|
122 |
+
{
|
123 |
+
if (isset($this->config['provider'])) {
|
124 |
return $this->config['provider'];
|
125 |
}
|
126 |
|
132 |
*
|
133 |
* @return string
|
134 |
*/
|
135 |
+
public function get_feed_language()
|
136 |
+
{
|
137 |
+
if (isset($this->config['feedLanguage']) && !empty($this->config['feedLanguage'])) {
|
138 |
return $this->config['feedLanguage'];
|
139 |
}
|
140 |
|
146 |
*
|
147 |
* @return string
|
148 |
*/
|
149 |
+
public function get_feed_currency()
|
150 |
+
{
|
151 |
+
if (isset($this->config['feedCurrency'])) {
|
152 |
return $this->config['feedCurrency'];
|
153 |
}
|
154 |
|
155 |
$attributes = $this->config['attributes'];
|
156 |
+
$priceAttrs = ['price', 'current_price', 'price_with_tax', 'current_price_with_tax'];
|
157 |
+
foreach ($priceAttrs as $price_attr) {
|
158 |
+
$key = array_search($price_attr, $attributes, true);
|
159 |
+
if ($key) {
|
160 |
break;
|
161 |
}
|
162 |
}
|
163 |
|
164 |
+
return isset($this->config['suffix'][$key]) ? $this->config['suffix'][$key] : get_woocommerce_currency();
|
165 |
}
|
166 |
|
167 |
/**
|
169 |
*
|
170 |
* @return string
|
171 |
*/
|
172 |
+
public function get_feed_country()
|
173 |
+
{
|
174 |
+
if (isset($this->config['feed_country']) && !empty($this->config['feed_country'])) {
|
175 |
return $this->config['feed_country'];
|
176 |
}
|
177 |
|
183 |
*
|
184 |
* @return string
|
185 |
*/
|
186 |
+
public function get_feed_file_type()
|
187 |
+
{
|
188 |
+
if (isset($this->config['feedType']) && !empty($this->config['feedType'])) {
|
189 |
return $this->config['feedType'];
|
190 |
}
|
191 |
|
197 |
*
|
198 |
* @return string
|
199 |
*/
|
200 |
+
public function get_delimiter()
|
201 |
+
{
|
202 |
+
if (isset($this->config['delimiter']) && $this->config['delimiter'] !== "") {
|
203 |
+
if ('tsv' === $this->get_feed_file_type()) {
|
204 |
$this->config['delimiter'] = "\t";
|
205 |
|
206 |
return $this->config['delimiter'];
|
207 |
}
|
208 |
|
209 |
+
if (' ' === $this->config['delimiter']) {
|
210 |
$this->config['delimiter'] = "\s";
|
211 |
}
|
212 |
|
221 |
*
|
222 |
* @return string
|
223 |
*/
|
224 |
+
public function get_enclosure()
|
225 |
+
{
|
226 |
+
if (isset($this->config['enclosure']) && !empty($this->config['enclosure']) && in_array($this->config['enclosure'], [
|
227 |
'double',
|
228 |
'single'
|
229 |
+
])) {
|
230 |
+
return ('double' === $this->config['enclosure']) ? '"' : "'";
|
231 |
}
|
232 |
|
233 |
return false;
|
238 |
*
|
239 |
* @return string
|
240 |
*/
|
241 |
+
public function get_feed_items_wrapper()
|
242 |
+
{
|
243 |
+
if (isset($this->config['itemsWrapper']) && !empty($this->config['itemsWrapper'])) {
|
244 |
return $this->config['itemsWrapper'];
|
245 |
}
|
246 |
|
252 |
*
|
253 |
* @return string
|
254 |
*/
|
255 |
+
public function get_feed_item_wrapper()
|
256 |
+
{
|
257 |
+
if (isset($this->config['itemWrapper']) && !empty($this->config['itemWrapper'])) {
|
258 |
return $this->config['itemWrapper'];
|
259 |
}
|
260 |
|
266 |
*
|
267 |
* @return string
|
268 |
*/
|
269 |
+
public function get_feed_extra_header()
|
270 |
+
{
|
271 |
+
if (isset($this->config['extraHeader']) && !empty($this->config['extraHeader'])) {
|
272 |
return $this->config['extraHeader'];
|
273 |
}
|
274 |
|
280 |
*
|
281 |
* @return string
|
282 |
*/
|
283 |
+
public function get_shipping_country()
|
284 |
+
{
|
285 |
+
if (isset($this->config['shipping_country']) && !empty($this->config['shipping_country'])) {
|
286 |
return $this->config['shipping_country'];
|
287 |
}
|
288 |
|
294 |
*
|
295 |
* @return string
|
296 |
*/
|
297 |
+
public function get_tax_country()
|
298 |
+
{
|
299 |
+
if (isset($this->config['tax_country']) && !empty($this->config['tax_country'])) {
|
300 |
return $this->config['tax_country'];
|
301 |
}
|
302 |
|
308 |
*
|
309 |
* @return array|bool
|
310 |
*/
|
311 |
+
public function get_string_replace()
|
312 |
+
{
|
313 |
+
if (!empty($this->config['str_replace'])) {
|
314 |
return $this->config['str_replace'];
|
315 |
}
|
316 |
|
322 |
*
|
323 |
* @return array|bool
|
324 |
*/
|
325 |
+
public function get_campaign_parameters()
|
326 |
+
{
|
327 |
+
if (isset($this->config['campaign_parameters']) && !empty($this->config['campaign_parameters'])) {
|
328 |
return wp_parse_args(
|
329 |
$this->config['campaign_parameters'],
|
330 |
array(
|
331 |
+
'utm_source' => '',
|
332 |
+
'utm_medium' => '',
|
333 |
'utm_campaign' => '',
|
334 |
+
'utm_term' => '',
|
335 |
+
'utm_content' => '',
|
336 |
)
|
337 |
);
|
338 |
}
|
345 |
*
|
346 |
* @return bool
|
347 |
*/
|
348 |
+
public function remove_backorder_product()
|
349 |
+
{
|
350 |
+
if (isset($this->config['is_backorder'])) {
|
351 |
return 'y' === $this->config['is_backorder'];
|
352 |
}
|
353 |
|
359 |
*
|
360 |
* @return bool
|
361 |
*/
|
362 |
+
public function remove_outofstock_product()
|
363 |
+
{
|
364 |
+
if (isset($this->config['is_outOfStock'])) {
|
365 |
return 'y' === $this->config['is_outOfStock'];
|
366 |
}
|
367 |
|
373 |
*
|
374 |
* @return bool
|
375 |
*/
|
376 |
+
public function remove_empty_title()
|
377 |
+
{
|
378 |
+
if (isset($this->config['is_emptyTitle'])) {
|
379 |
+
return 'y' === $this->config['is_emptyTitle'];
|
380 |
+
}
|
381 |
+
|
382 |
+
return false;
|
383 |
+
}
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Status to remove empty description products.
|
387 |
+
*
|
388 |
+
* @return bool
|
389 |
+
*/
|
390 |
+
public function remove_empty_description()
|
391 |
+
{
|
392 |
+
if (isset($this->config['is_emptyDescription'])) {
|
393 |
return 'y' === $this->config['is_emptyDescription'];
|
394 |
}
|
395 |
|
401 |
*
|
402 |
* @return bool
|
403 |
*/
|
404 |
+
public function remove_empty_image()
|
405 |
+
{
|
406 |
+
if (isset($this->config['is_emptyImage'])) {
|
407 |
return 'y' === $this->config['is_emptyImage'];
|
408 |
}
|
409 |
|
415 |
*
|
416 |
* @return bool
|
417 |
*/
|
418 |
+
public function remove_empty_price()
|
419 |
+
{
|
420 |
+
if (isset($this->config['is_emptyPrice'])) {
|
421 |
return 'y' === $this->config['is_emptyPrice'];
|
422 |
}
|
423 |
|
424 |
return false;
|
425 |
}
|
426 |
|
427 |
+
public function remove_hidden_products()
|
428 |
+
{
|
429 |
+
if (isset($this->config['product_visibility'])) {
|
430 |
+
return $this->config['product_visibility'];
|
431 |
+
}
|
432 |
+
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
|
436 |
/**
|
437 |
* Get Number Format.
|
438 |
*
|
439 |
* @return bool|array
|
440 |
*/
|
441 |
+
public function get_number_format()
|
442 |
+
{
|
443 |
+
if (isset($this->config['decimal_separator'])) {
|
444 |
$number_format = [
|
445 |
+
'decimal_separator' => apply_filters('ctx_feed_number_format_decimal_separator', $this->config['decimal_separator'], $this->config),
|
446 |
+
'thousand_separator' => apply_filters('ctx_feed_number_format_thousand_separator', $this->config['thousand_separator'], $this->config),
|
447 |
+
'decimals' => apply_filters('ctx_feed_number_format_decimals', $this->config['decimals'], $this->config),
|
448 |
];
|
449 |
|
450 |
+
return apply_filters('ctx_feed_number_format', $number_format, $this->config);
|
451 |
}
|
452 |
|
453 |
return false;
|
458 |
*
|
459 |
* @return array|bool
|
460 |
*/
|
461 |
+
public function get_products_to_exclude()
|
462 |
+
{
|
463 |
|
464 |
+
if (isset($this->config['filter_mode'])) {
|
465 |
$mode = $this->config['filter_mode'];
|
466 |
+
if ('exclude' === $mode['product_ids'] && !empty($this->config['product_ids'])) {
|
467 |
+
return explode(',', $this->config['product_ids']);
|
468 |
}
|
469 |
}
|
470 |
|
476 |
*
|
477 |
* @return array|bool
|
478 |
*/
|
479 |
+
public function get_products_to_include()
|
480 |
+
{
|
481 |
|
482 |
+
if (isset($this->config['filter_mode'])) {
|
483 |
$mode = $this->config['filter_mode'];
|
484 |
+
if ('include' === $mode['product_ids'] && !empty($this->config['product_ids'])) {
|
485 |
+
return explode(',', $this->config['product_ids']);
|
486 |
}
|
487 |
}
|
488 |
|
494 |
*
|
495 |
* @return mixed
|
496 |
*/
|
497 |
+
public function get_categories_to_exclude()
|
498 |
+
{
|
499 |
|
500 |
+
if (isset($this->config['filter_mode'])) {
|
501 |
$mode = $this->config['filter_mode'];
|
502 |
+
if ('exclude' === $mode['categories'] && !empty($this->config['categories'])) {
|
503 |
return $this->config['categories'];
|
504 |
}
|
505 |
}
|
512 |
*
|
513 |
* @return mixed
|
514 |
*/
|
515 |
+
public function get_categories_to_include()
|
516 |
+
{
|
517 |
|
518 |
+
if (isset($this->config['filter_mode'])) {
|
519 |
$mode = $this->config['filter_mode'];
|
520 |
+
if ('include' === $mode['categories'] && !empty($this->config['categories'])) {
|
521 |
return $this->config['categories'];
|
522 |
}
|
523 |
}
|
531 |
*
|
532 |
* @return mixed
|
533 |
*/
|
534 |
+
public function get_post_status_to_include()
|
535 |
+
{
|
536 |
+
$status = ['draft', 'pending', 'private', 'publish'];
|
537 |
+
if (isset($this->config['filter_mode'], $this->config['post_status']) && !empty($this->config['post_status'])) {
|
538 |
$mode = $this->config['filter_mode'];
|
539 |
+
if ('include' === $mode['post_status']) {
|
540 |
return $this->config['post_status'];
|
541 |
}
|
542 |
|
543 |
+
if ('exclude' === $mode['post_status']) {
|
544 |
+
return array_unique(array_merge(array_diff($status, $this->config['post_status']), array_diff($status, $this->config['post_status'])));
|
545 |
}
|
546 |
}
|
547 |
|
553 |
*
|
554 |
* @return string|bool
|
555 |
*/
|
556 |
+
public function get_vendors_to_include()
|
557 |
+
{
|
558 |
|
559 |
+
if (isset($this->config['vendors']) && !empty($this->config['vendors'])) {
|
560 |
+
return implode(',', $this->config['vendors']);
|
561 |
}
|
562 |
|
563 |
return false;
|
568 |
*
|
569 |
* @return bool
|
570 |
*/
|
571 |
+
public function get_variations_to_include()
|
572 |
+
{
|
573 |
|
574 |
+
return isset($this->config['is_variations']) && in_array($this->config['is_variations'], ['y', 'both']);
|
575 |
}
|
576 |
|
577 |
/**
|
579 |
*
|
580 |
* @return array|bool
|
581 |
*/
|
582 |
+
public function get_advance_filters()
|
583 |
+
{
|
584 |
+
if (isset($this->config['fattribute'])) {
|
585 |
return [
|
586 |
+
"fattribute" => $this->config['fattribute'],
|
587 |
+
"condition" => $this->config['condition'],
|
588 |
"filterCompare" => $this->config['filterCompare'],
|
589 |
+
"concatType" => $this->config['concatType'],
|
590 |
];
|
591 |
}
|
592 |
|
598 |
*
|
599 |
* @return array|bool
|
600 |
*/
|
601 |
+
public function get_ftp_config()
|
602 |
+
{
|
603 |
+
if (isset($this->config['ftpenabled']) && $this->config['ftpenabled']) {
|
604 |
|
605 |
// if ( '0' === $this->config['ftpenabled'] ) {
|
606 |
// return false;
|
607 |
// }
|
608 |
|
609 |
return [
|
610 |
+
"type" => $this->config['ftporsftp'],
|
611 |
+
"host" => $this->config['ftphost'],
|
612 |
+
"port" => $this->config['ftpport'],
|
613 |
"username" => $this->config['ftpuser'],
|
614 |
"password" => $this->config['ftppassword'],
|
615 |
+
"path" => $this->config['ftppath'],
|
616 |
+
"mode" => $this->config['ftpmode'],
|
617 |
];
|
618 |
}
|
619 |
|
625 |
*
|
626 |
* @return array|bool
|
627 |
*/
|
628 |
+
public function get_variable_config()
|
629 |
+
{
|
630 |
+
if (isset($this->config['is_variations'])) {
|
631 |
return [
|
632 |
+
"is_variations" => $this->config['is_variations'],
|
633 |
+
"variable_price" => isset($this->config['variable_price']) ? $this->config['variable_price'] : '',
|
634 |
+
"variable_quantity" => isset($this->config['variable_quantity']) ? $this->config['variable_quantity'] : '',
|
635 |
];
|
636 |
}
|
637 |
|
643 |
*
|
644 |
* @return mixed
|
645 |
*/
|
646 |
+
public function get_composite_price_type()
|
647 |
+
{
|
648 |
+
if (isset($this->config['composite_price'])) {
|
649 |
return $this->config['composite_price'];
|
650 |
}
|
651 |
|
657 |
*
|
658 |
* @return array
|
659 |
*/
|
660 |
+
public function get_feed()
|
661 |
+
{
|
662 |
return $this->feedInfo;
|
663 |
}
|
664 |
|
667 |
*
|
668 |
* @return array
|
669 |
*/
|
670 |
+
public function get_config()
|
671 |
+
{
|
672 |
return $this->config;
|
673 |
}
|
674 |
|
677 |
*
|
678 |
* @return array
|
679 |
*/
|
680 |
+
private function set_config($config)
|
681 |
+
{
|
682 |
|
683 |
$defaults = array(
|
684 |
+
'provider' => '',
|
685 |
+
'feed_country' => '',
|
686 |
+
'filename' => '',
|
687 |
+
'feedType' => '',
|
688 |
+
'ftpenabled' => 0,
|
689 |
+
'ftporsftp' => 'ftp',
|
690 |
+
'ftphost' => '',
|
691 |
+
'ftpport' => '21',
|
692 |
+
'ftpuser' => '',
|
693 |
+
'ftppassword' => '',
|
694 |
+
'ftppath' => '',
|
695 |
+
'ftpmode' => 'active',
|
696 |
+
'is_variations' => 'y', // Only Variations (All Variations)
|
697 |
+
'variable_price' => 'first',
|
698 |
+
'variable_quantity' => 'first',
|
699 |
+
'feedLanguage' => apply_filters('wpml_current_language', null),
|
700 |
+
'feedCurrency' => apply_filters('woocommerce_currency', get_option('woocommerce_currency')),
|
701 |
+
'itemsWrapper' => 'products',
|
702 |
+
'itemWrapper' => 'product',
|
703 |
+
'delimiter' => ',',
|
704 |
+
'enclosure' => 'double',
|
705 |
+
'extraHeader' => '',
|
706 |
+
'vendors' => array(),
|
707 |
// Feed Config
|
708 |
+
'mattributes' => array(), // merchant attributes
|
709 |
+
'prefix' => array(), // prefixes
|
710 |
+
'type' => array(), // value (attribute) types
|
711 |
+
'attributes' => array(), // product attribute mappings
|
712 |
+
'default' => array(), // default values (patterns) if value type set to pattern
|
713 |
+
'suffix' => array(), // suffixes
|
714 |
+
'output_type' => array(), // output type (output filter)
|
715 |
+
'limit' => array(), // limit or command
|
716 |
// filters tab
|
717 |
+
'composite_price' => 'all_product_price',
|
718 |
+
'product_ids' => '',
|
719 |
+
'categories' => array(),
|
720 |
+
'post_status' => array('publish'),
|
721 |
+
'filter_mode' => array(),
|
722 |
+
'campaign_parameters' => array(),
|
723 |
+
'is_outOfStock' => 'n',
|
724 |
+
'is_backorder' => 'n',
|
725 |
+
'is_emptyDescription' => 'n',
|
726 |
+
'is_emptyTitle' => 'n',
|
727 |
+
'is_emptyImage' => 'n',
|
728 |
+
'is_emptyPrice' => 'n',
|
729 |
+
'product_visibility' => 0,
|
730 |
+
'shipping_country' => '',
|
731 |
+
'tax_country' => '',
|
732 |
// include hidden ? 1 yes 0 no
|
733 |
'outofstock_visibility' => 0,
|
734 |
// override wc global option for out-of-stock product hidden from catalog? 1 yes 0 no
|
735 |
+
'ptitle_show' => '',
|
736 |
+
'decimal_separator' => apply_filters('wc_get_price_decimal_separator', get_option('woocommerce_price_decimal_sep')),
|
737 |
+
'thousand_separator' => stripslashes(apply_filters('wc_get_price_thousand_separator', get_option('woocommerce_price_thousand_sep'))),
|
738 |
+
'decimals' => absint(apply_filters('wc_get_price_decimals', get_option('woocommerce_price_num_decimals', 2))),
|
739 |
);
|
740 |
|
741 |
+
$this->config = wp_parse_args($config, $defaults);
|
742 |
$this->config['filter_mode'] = wp_parse_args(
|
743 |
$this->config['filter_mode'],
|
744 |
array(
|
745 |
'product_ids' => 'include',
|
746 |
+
'categories' => 'include',
|
747 |
'post_status' => 'include',
|
748 |
)
|
749 |
);
|
750 |
|
751 |
+
if (!empty($this->config['provider']) && is_string($this->config['provider'])) {
|
752 |
/**
|
753 |
* filter parsed rules for provider
|
754 |
*
|
755 |
+
* @param array $rules
|
756 |
* @param string $context
|
757 |
*
|
758 |
* @since 3.3.7
|
759 |
*/
|
760 |
+
$this->config = apply_filters("woo_feed_{$this->config['provider']}_parsed_rules", $this->config, $this->context);
|
761 |
}
|
762 |
|
763 |
/**
|
764 |
* filter parsed rules
|
765 |
*
|
766 |
+
* @param array $rules
|
767 |
* @param string $context
|
768 |
*
|
769 |
* @since 3.3.7 $provider parameter removed
|
770 |
*/
|
771 |
+
$this->config = apply_filters('woo_feed_parsed_rules', $this->config, $this->context);
|
772 |
|
773 |
return $this->config;
|
774 |
}
|
778 |
*
|
779 |
* @return array|bool
|
780 |
*/
|
781 |
+
public function get_feed_url()
|
782 |
+
{
|
783 |
+
if (isset($this->feedInfo['url'])) {
|
784 |
return $this->feedInfo['url'];
|
785 |
}
|
786 |
|
792 |
*
|
793 |
* @return string|bool
|
794 |
*/
|
795 |
+
public function get_feed_path()
|
796 |
+
{
|
797 |
$upload_dir = wp_get_upload_dir();
|
798 |
+
$url = $this->get_feed_url();
|
799 |
+
$file_name = basename($url);
|
800 |
|
801 |
+
if (!isset($this->config['provider']) && !isset($this->config['feedType'])) {
|
802 |
return false;
|
803 |
}
|
804 |
|
805 |
+
return sprintf('%s/woo-feed/%s/%s/%s', $upload_dir['basedir'], $this->config['provider'], $this->config['feedType'], $file_name);
|
806 |
}
|
807 |
|
808 |
|
811 |
*
|
812 |
* @return array|bool
|
813 |
*/
|
814 |
+
public function get_feed_status()
|
815 |
+
{
|
816 |
+
if (isset($this->feedInfo['status'])) {
|
817 |
return $this->feedInfo['status'];
|
818 |
}
|
819 |
|
admin/js/woo-feed-admin-pro.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
"use strict";!function(
|
2 |
//# sourceMappingURL=woo-feed-admin-pro.min.js.map
|
1 |
+
"use strict";!function(n,t,i,r,o){n(t).on("load",function(){var t=0,e=n("#wf_str_replace tbody");function a(t){var e=t.closest("tr").find(".woo_feed_dynamic_attr_condition_value");"between"===t.val()?e.attr("placeholder","Ex: 10,20"):e.attr("placeholder","")}n(i).on("change","#custom2_attribute",function(t){n("#custom2_attribute_value").val("{".concat(n(this).val().trim(),"}"))}).on("change","#is_variations",function(t){var e=n(this).val();"both"===e||"n"===e?n(".WFVariablePriceTR").show():n(".WFVariablePriceTR").hide()}).on("change","#wpf_ptitle",function(){var t=n(this)[0].selectize,e=n("textarea[name='ptitle_show']"),a=e.val().trim().split("|");a.push(n(this).val()),e.val(a.filter(function(t){return""!==t}).join("|")),t.clear(!0),t.refreshOptions(!1)}).on("click","#wf_new_str_replace",function(){0===t?t=e.find("tr").length:t++,e.append(n("#wf_str_replace_template").text().trim().replace(/__idx__/g,t))}).on("click",".wf-add-row",function(t){t.preventDefault();var t=n(this),e=parseInt(t.data("idx")||0)+1,a=(/^</.test(t.data("template"))?t.data("template"):n(t.data("template")).text()).trim();n(t.data("target")).append(a.trim().replace(/__idx__/g,e)),r.helper.selectize(),t.data("idx",e)}).on("submit","#attribute-mapping-form",function(t){if(!n(this).find('[name^="value["]').length)return alert(o.form.one_item_required),!1}).on("click","#wf_newFilter",function(){n("#table-advanced-filter tbody tr:eq(0)").show().clone().find("input").val("").end().find("select").val("").end().insertAfter("#table-advanced-filter tbody tr:last"),n(".fsrow:gt(2)").prop("disabled",!1),n(".wf_concat_advance:last").prop("value","OR"),n(".daRow:eq(0)").hide()}).on("click","#wf_newCon",function(){n("#table-1 tbody tr:first").show().clone().find("input").val("").end().insertAfter("#table-1 tbody tr:last"),n(".fsrow:gt(7)").prop("disabled",!1),n(".daRow:eq(0)").hide(),n("#table-1 tbody tr:last td select.woo_feed_dynamic_attr_condition_select").change(function(){a(n(this))})}).on("change keyup",".treegrid-parent",function(){var t=n(this).val(),e=n(this).attr("data-cat_id");n(".treegrid-parent-"+e).val(t)}),n(".woo_feed_dynamic_attr_condition_select").change(function(){a(n(this))}),0<n("#attribute-mapping-form").length&&r.helper.sortable()}),n(i).on("feedEditor.init",function(){r.helper.fancySelect(n("#wf_product_post_status, .filter_mode"),{maxItemShow:2})}).one("click",'label[for="wf-tab-content-filter"]',function(t){var e={action:"woo_feed_filter_count",nonce:wpf_ajax_obj.ajax.nonce};n.ajax({method:"GET",url:wpf_ajax_obj.wpf_ajax_url,data:e,success:function(t){var e;t.data.backorder&&(e=1===t.data.backorder?"product is":"products are",n("#wf-tab-content-filter table tr:nth-of-type(1)").find(".help").after('<div class="counter"><span class="dashicons dashicons-info-outline" aria-hidden="true"></span>'+t.data.backorder+" "+e+" on backorder.</div>")),t.data.outOfStock&&(e=1===t.data.outOfStock?"product is":"products are",n("#wf-tab-content-filter table tr:nth-of-type(2)").find(".help").after('<div class="counter"><span class="dashicons dashicons-info-outline" aria-hidden="true"></span>'+t.data.outOfStock+" "+e+" out of stock.</div>")),t.data.hidden&&(e=1===t.data.hidden?"product is":"products are",n("#wf-tab-content-filter table tr:nth-of-type(3)").find(".help").after('<div class="counter"><span class="dashicons dashicons-info-outline" aria-hidden="true"></span>'+t.data.hidden+" "+e+" hidden.</div>")),t.data.noDesc&&(e=1===t.data.noDesc?"product has":"products are",n("#wf-tab-content-filter table tr:nth-of-type(4)").find(".help").after('<div class="counter"><span class="dashicons dashicons-info-outline" aria-hidden="true"></span>'+t.data.noDesc+" "+e+" no description.</div>")),t.data.noImg&&(e=1===t.data.noImg?"product has":"products have",n("#wf-tab-content-filter table tr:nth-of-type(5)").find(".help").after('<div class="counter"><span class="dashicons dashicons-info-outline" aria-hidden="true"></span>'+t.data.noImg+" "+e+" no image.</div>")),t.data.noPrice&&(e=1===t.data.noPrice?"product has":"products have",n("#wf-tab-content-filter table tr:nth-of-type(6)").find(".help").after('<div class="counter"><span class="dashicons dashicons-info-outline" aria-hidden="true"></span>'+t.data.noPrice+" "+e+" no price.</div>"))}})}),n(i).ready(function(){var t;0<n("#feedCurrency").length&&n("#feedCurrency").on("change",function(){n(".wf_attr.wf_attributes").each(function(t,e){var a=n("#feedCurrency").val(),e=n(e).val();-1!==n.inArray(e,["price","current_price","sale_price","price_with_tax","current_price_with_tax","sale_price_with_tax"])&&n('input[name^="suffix"]').eq(parseInt(t)).val(" "+a)})}),0<n("#editor").length&&(t=i.getElementById("editor"),CodeMirror.fromTextArea(t,{lineNumbers:!0,mode:"xml",matchBrackets:!0}).setSize(null,620))})}(jQuery,window,document,wf,(wp.ajax,wpf_ajax_obj));
|
2 |
//# sourceMappingURL=woo-feed-admin-pro.min.js.map
|
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.5.
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
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.5.4
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|