Product Feed PRO for WooCommerce - Version 9.9.2

Version Description

Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.

Download this release

Release Info

Developer jorisverwater
Plugin Icon 128x128 Product Feed PRO for WooCommerce
Version 9.9.2
Comparing to
See all releases

Code changes from version 9.3.7 to 9.9.2

TODO.txt CHANGED
@@ -5,18 +5,19 @@ Tutorial / Blog posts:
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
 
7
  Priority issues:
 
 
8
  - License key input field needs to be a password field (asterixes)
 
9
  - Add a preview option so only 5-10 products are being generated
10
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
11
  - Google local product feed inventory in XML format (not just TXT like it is now)
12
  - Add support for Multisites
13
  - Add a filter on review score (and amount of reviews)
14
  - Make extra woosea fields available for front-end usage
15
- - Only update feed when changes to products have been made
16
  - Add header to extra fields on product edit pages
17
  - Add possibility to create OR rules
18
  - Add support for Google My Business product feeds
19
- - Build a better WP Cron check, current one is not good enough
20
  - AMAZON integration:
21
  - requires a professional seller account, 39 dollar a month, before being able to create a developer account
22
- - only than we can use their MWS service needed to connect our plugin
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
 
7
  Priority issues:
8
+ - Local product feed - store code should also work with an attribute and not just static values
9
+ - Add Pinterest Tag; https://help.pinterest.com/nl/business/article/install-the-pinterest-tag
10
  - License key input field needs to be a password field (asterixes)
11
+ - A seperate FB pixel per WPML website / language
12
  - Add a preview option so only 5-10 products are being generated
13
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
14
  - Google local product feed inventory in XML format (not just TXT like it is now)
15
  - Add support for Multisites
16
  - Add a filter on review score (and amount of reviews)
17
  - Make extra woosea fields available for front-end usage
 
18
  - Add header to extra fields on product edit pages
19
  - Add possibility to create OR rules
20
  - Add support for Google My Business product feeds
 
21
  - AMAZON integration:
22
  - requires a professional seller account, 39 dollar a month, before being able to create a developer account
23
+ - only then we can use their MWS service needed to connect our plugin
classes/channels/class-bing_shopping_promotions.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings for Bing Shopping Promotions feeds
4
+ */
5
+ class WooSEA_bing_shopping_promotions {
6
+ public $bing_attributes_promotions;
7
+
8
+ public static function get_channel_attributes() {
9
+ $sitename = get_option('blogname');
10
+
11
+ $bing_attributes_promotions = array(
12
+ "Feed fields" => array(
13
+ "promotion_id" => array(
14
+ "name" => "promotion_id",
15
+ "feed_name" => "promotion_id",
16
+ "format" => "required",
17
+ ),
18
+ "product_applicability" => array(
19
+ "name" => "product_applicability",
20
+ "feed_name" => "product_applicability",
21
+ "format" => "required",
22
+ ),
23
+ "offer_type" => array(
24
+ "name" => "offer_type",
25
+ "feed_name" => "offer_type",
26
+ "format" => "required",
27
+ ),
28
+ "long_title" => array(
29
+ "name" => "long_title",
30
+ "feed_name" => "long_title",
31
+ "format" => "required",
32
+ ),
33
+ "promotion_effective_dates" => array(
34
+ "name" => "promotion_effective_dates",
35
+ "feed_name" => "promotion_effective_dates",
36
+ "format" => "required",
37
+ ),
38
+ "redemption_channel" => array(
39
+ "name" => "redemption_channel",
40
+ "feed_name" => "redemption_channel",
41
+ "format" => "required",
42
+ ),
43
+ "promotional_display_dates" => array(
44
+ "name" => "promotional_display_dates",
45
+ "feed_name" => "promotional_display_dates",
46
+ "format" => "optional",
47
+ ),
48
+ "minimum_purchase_amount" => array(
49
+ "name" => "minimum_purchase_amount",
50
+ "feed_name" => "minimum_purchase_amount",
51
+ "format" => "optional",
52
+ ),
53
+ "generic_redemption_code" => array(
54
+ "name" => "generic_redemption_code",
55
+ "feed_name" => "generic_redemption_code",
56
+ "format" => "optional",
57
+ ),
58
+ ),
59
+ "Structured data attributes" => array(
60
+ "percent_off" => array(
61
+ "name" => "percent_off",
62
+ "feed_name" => "percent_off",
63
+ "format" => "optional",
64
+ ),
65
+ "money_off_amount" => array(
66
+ "name" => "percent_off_amount",
67
+ "feed_name" => "percent_off_amount",
68
+ "format" => "optional",
69
+ ),
70
+ "buy_this_quantity" => array(
71
+ "name" => "buy_this_quantity",
72
+ "feed_name" => "buy_this_quantity",
73
+ "format" => "optional",
74
+ ),
75
+ "get_this_quantity_discounted" => array(
76
+ "name" => "get_this_quantity_discounted",
77
+ "feed_name" => "get_this_quantity_discounted",
78
+ "format" => "optional",
79
+ ),
80
+ "free_shipping" => array(
81
+ "name" => "free_shipping",
82
+ "feed_name" => "free_shipping",
83
+ "format" => "optional",
84
+ ),
85
+ "free_gift_value" => array(
86
+ "name" => "free_gift_value",
87
+ "feed_name" => "free_gift_value",
88
+ "format" => "optional",
89
+ ),
90
+ "free_gift_description" => array(
91
+ "name" => "free_gift_description",
92
+ "feed_name" => "free_gift_description",
93
+ "format" => "optional",
94
+ ),
95
+ "free_gift_item_id" => array(
96
+ "name" => "free_gift_item_id",
97
+ "feed_name" => "free_gift_item_id",
98
+ "format" => "optional",
99
+ ),
100
+ ),
101
+ );
102
+ return $bing_attributes_promotions;
103
+ }
104
+ }
105
+ ?>
classes/channels/class-facebook_drm.php CHANGED
@@ -56,7 +56,7 @@ class WooSEA_facebook_drm {
56
  "name" => "title",
57
  "feed_name" => "g:title",
58
  "format" => "required",
59
- "woo_suggest" => "title",
60
  ),
61
  "price" => array(
62
  "name" => "price",
@@ -116,6 +116,12 @@ class WooSEA_facebook_drm {
116
  "format" => "required",
117
  "woo_suggest" => "categories",
118
  ),
 
 
 
 
 
 
119
  "fb_product_category" => array(
120
  "name" => "fb_product_category",
121
  "feed_name" => "g:fb_product_category",
56
  "name" => "title",
57
  "feed_name" => "g:title",
58
  "format" => "required",
59
+ "woo_suggest" => "mother_title",
60
  ),
61
  "price" => array(
62
  "name" => "price",
116
  "format" => "required",
117
  "woo_suggest" => "categories",
118
  ),
119
+ "product_type" => array(
120
+ "name" => "product_type",
121
+ "feed_name" => "g:product_type",
122
+ "format" => "required",
123
+ "woo_suggest" => "category_path",
124
+ ),
125
  "fb_product_category" => array(
126
  "name" => "fb_product_category",
127
  "feed_name" => "g:fb_product_category",
classes/channels/class-google_local_products.php CHANGED
@@ -12,8 +12,8 @@ class WooSEA_google_local_products {
12
  $google_local_products = array(
13
  "Local products fields" => array(
14
  "Itemid" => array(
15
- "name" => "Itemid",
16
- "feed_name" => "g:itemid",
17
  "format" => "required",
18
  "woo_suggest" => "id",
19
  ),
12
  $google_local_products = array(
13
  "Local products fields" => array(
14
  "Itemid" => array(
15
+ "name" => "Id",
16
+ "feed_name" => "g:id",
17
  "format" => "required",
18
  "woo_suggest" => "id",
19
  ),
classes/channels/class-google_shopping.php CHANGED
@@ -356,6 +356,11 @@ class WooSEA_google_shopping {
356
  "feed_name" => "g:max_handling_time",
357
  "format" => "optional",
358
  ),
 
 
 
 
 
359
  ),
360
  "Tax" => array(
361
  "Tax" => array(
356
  "feed_name" => "g:max_handling_time",
357
  "format" => "optional",
358
  ),
359
+ "Ships from country" => array(
360
+ "name" => "ships_from_country",
361
+ "feed_name" => "g:ships_from_country",
362
+ "format" => "optional",
363
+ ),
364
  ),
365
  "Tax" => array(
366
  "Tax" => array(
classes/channels/class-idealo.php ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings for Idealo feeds
4
+ */
5
+ class WooSEA_idealo {
6
+ public $idealo;
7
+
8
+ public static function get_channel_attributes() {
9
+
10
+ $sitename = get_option('blogname');
11
+
12
+ $idealo = array(
13
+ "Feed fields" => array(
14
+ "SKU" => array(
15
+ "name" => "SKU",
16
+ "feed_name" => "sku",
17
+ "format" => "required",
18
+ "woo_suggest" => "sku",
19
+ ),
20
+ "Brand" => array(
21
+ "name" => "brand",
22
+ "feed_name" => "brand",
23
+ "format" => "required",
24
+ ),
25
+ "Title" => array(
26
+ "name" => "title",
27
+ "feed_name" => "title",
28
+ "format" => "required",
29
+ "woo_suggest" => "title",
30
+ ),
31
+ "CategoryPath" => array(
32
+ "name" => "categoryPath",
33
+ "feed_name" => "categoryPath",
34
+ "format" => "required",
35
+ "woo_suggest" => "category_path",
36
+ ),
37
+ "url" => array(
38
+ "name" => "url",
39
+ "feed_name" => "url",
40
+ "format" => "required",
41
+ "woo_suggest" => "link",
42
+ ),
43
+ "hans" => array(
44
+ "name" => "hans",
45
+ "feed_name" => "hans",
46
+ "format" => "optional",
47
+ ),
48
+ "Description" => array(
49
+ "name" => "description",
50
+ "feed_name" => "description",
51
+ "format" => "required",
52
+ "woo_suggest" => "description",
53
+ ),
54
+ "ImageUrls" => array(
55
+ "name" => "imageUrls",
56
+ "feed_name" => "imageUrls",
57
+ "format" => "optional",
58
+ "woo_suggest" => "image",
59
+ ),
60
+ "eec" => array(
61
+ "name" => "eec",
62
+ "feed_name" => "eec",
63
+ "format" => "optional",
64
+ ),
65
+ "merchantName" => array(
66
+ "name" => "merchantName",
67
+ "feed_name" => "merchantName",
68
+ "format" => "optional",
69
+ ),
70
+ "merchantId" => array(
71
+ "name" => "merchantId",
72
+ "feed_name" => "merchanId",
73
+ "format" => "optional",
74
+ ),
75
+ "price" => array(
76
+ "name" => "price",
77
+ "feed_name" => "price",
78
+ "format" => "required",
79
+ "woo_suggest" => "price",
80
+ ),
81
+ "basePrice" => array(
82
+ "name" => "basePrice",
83
+ "feed_name" => "basePrice",
84
+ "format" => "optional",
85
+ ),
86
+ "formerPrice" => array(
87
+ "name" => "formerPrice",
88
+ "feed_name" => "formerPrice",
89
+ "format" => "optional",
90
+ ),
91
+ "voucherCode" => array(
92
+ "name" => "voucherCode",
93
+ "feed_name" => "voucherCode",
94
+ "format" => "optional",
95
+ ),
96
+ "deposit" => array(
97
+ "name" => "deposit",
98
+ "feed_name" => "deposit",
99
+ "format" => "optional",
100
+ ),
101
+ "deliveryTime" => array(
102
+ "name" => "deliveryTime",
103
+ "feed_name" => "deliveryTime",
104
+ "format" => "optional",
105
+ ),
106
+ "deliveryComment" => array(
107
+ "name" => "deliveryComment",
108
+ "feed_name" => "deliveryComment",
109
+ "format" => "optional",
110
+ ),
111
+ "maxOrderProcessingTime" => array(
112
+ "name" => "maxOrderProcessingTime",
113
+ "feed_name" => "maxOrderProcessingTime",
114
+ "format" => "optional",
115
+ ),
116
+ "freeReturnDays" => array(
117
+ "name" => "freeReturnDays",
118
+ "feed_name" => "freeReturnDays",
119
+ "format" => "optional",
120
+ ),
121
+ "checkout" => array(
122
+ "name" => "checkout",
123
+ "feed_name" => "checkout",
124
+ "format" => "required",
125
+ ),
126
+ "minimumPrice" => array(
127
+ "name" => "minimumPrice",
128
+ "feed_name" => "minimumPrice",
129
+ "format" => "required",
130
+ ),
131
+ "fullfillmentType" => array(
132
+ "name" => "fulfillmentType",
133
+ "feed_name" => "fulfillmentType",
134
+ "format" => "required",
135
+ ),
136
+ "checkoutLimitPerPeriod" => array(
137
+ "name" => "checkoutLimitPerPeriod",
138
+ "feed_name" => "checkoutLimitPerPeriod",
139
+ "format" => "required",
140
+ ),
141
+ "quantityPerOrder" => array(
142
+ "name" => "quantityPerOrder",
143
+ "feed_name" => "quantityPerOrder",
144
+ "format" => "optional",
145
+ ),
146
+ "twoManHandlingFee" => array(
147
+ "name" => "twoManHandlingFee",
148
+ "feed_name" => "twoManHandlingFee",
149
+ "format" => "optional",
150
+ ),
151
+ "disposalFee" => array(
152
+ "name" => "disposalFee",
153
+ "feed_name" => "disposalFee",
154
+ "format" => "optional",
155
+ ),
156
+ "eans" => array(
157
+ "name" => "eans",
158
+ "feed_name" => "eans",
159
+ "format" => "required",
160
+ ),
161
+ "packagingUnit" => array(
162
+ "name" => "packagingUnit",
163
+ "feed_name" => "packagingUnit",
164
+ "format" => "optional",
165
+ ),
166
+ "deliveryCost_ups" => array(
167
+ "name" => "deliveryCost_ups",
168
+ "feed_name" => "deliveryCost_ups",
169
+ "format" => "optional",
170
+ ),
171
+ "deliveryCost_fedex" => array(
172
+ "name" => "deliveryCost_fedex",
173
+ "feed_name" => "deliveryCost_fedex",
174
+ "format" => "optional",
175
+ ),
176
+ "deliveryCost_deutsche_post" => array(
177
+ "name" => "deliveryCost_deutsche_post",
178
+ "feed_name" => "deliveryCost_deutsche_post",
179
+ "format" => "optional",
180
+ ),
181
+ "deliveryCost_dhl" => array(
182
+ "name" => "deliveryCost_dhl",
183
+ "feed_name" => "deliveryCost_dhl",
184
+ "format" => "optional",
185
+ ),
186
+ "deliveryCost_dhl_go_green" => array(
187
+ "name" => "deliveryCost_dhl_go_green",
188
+ "feed_name" => "deliveryCost_dhl_go_green",
189
+ "format" => "optional",
190
+ ),
191
+ "deliveryCost_download" => array(
192
+ "name" => "deliveryCost_download",
193
+ "feed_name" => "deliveryCost_download",
194
+ "format" => "optional",
195
+ ),
196
+ "deliveryCost_dpd" => array(
197
+ "name" => "deliveryCost_dpd",
198
+ "feed_name" => "deliveryCost_dpd",
199
+ "format" => "optional",
200
+ ),
201
+ "deliveryCost_german_express_logistics" => array(
202
+ "name" => "deliveryCost_german_express_logistics",
203
+ "feed_name" => "deliveryCost_german_express_logistics",
204
+ "format" => "optional",
205
+ ),
206
+ "deliveryCost_gls" => array(
207
+ "name" => "deliveryCost_gls",
208
+ "feed_name" => "deliveryCost_gls",
209
+ "format" => "optional",
210
+ ),
211
+ "deliveryCost_gls_think_green" => array(
212
+ "name" => "deliveryCost_gls_think_green",
213
+ "feed_name" => "deliveryCost_gls_think_green",
214
+ "format" => "optional",
215
+ ),
216
+ "deliveryCost_hermes" => array(
217
+ "name" => "deliveryCost_hermes",
218
+ "feed_name" => "deliveryCost_hermes",
219
+ "format" => "optional",
220
+ ),
221
+ "deliveryCost_pick_point" => array(
222
+ "name" => "deliveryCost_pick_points",
223
+ "feed_name" => "deliveryCost_pick_point",
224
+ "format" => "optional",
225
+ ),
226
+ "deliveryCost_spedition" => array(
227
+ "name" => "deliveryCost_spedition",
228
+ "feed_name" => "deliveryCost_spedition",
229
+ "format" => "optional",
230
+ ),
231
+ "deliveryCost_tnt" => array(
232
+ "name" => "deliveryCost_tnt",
233
+ "feed_name" => "deliveryCost_tnt",
234
+ "format" => "optional",
235
+ ),
236
+ "deliveryCost_trans_o_flex" => array(
237
+ "name" => "deliveryCost_trans_o_flex",
238
+ "feed_name" => "deliveryCost_trand_o_flex",
239
+ "format" => "optional",
240
+ ),
241
+ "paymentCosts_credit_card" => array(
242
+ "name" => "paymentCosts_credit_card",
243
+ "feed_name" => "paymentCosts_credit_card",
244
+ "format" => "optional",
245
+ ),
246
+ "paymentCosts_cash_in_advance" => array(
247
+ "name" => "paymentCosts_cash_in_advance",
248
+ "feed_name" => "paymentCosts_cash_in_advance",
249
+ "format" => "optional",
250
+ ),
251
+ "paymentCosts_cash_on_delivery" => array(
252
+ "name" => "paymentCosts_cash_on_delivery",
253
+ "feed_name" => "paymentCosts_cash_on_delivery",
254
+ "format" => "optional",
255
+ ),
256
+ "paymentCosts_paypal" => array(
257
+ "name" => "paymentCosts_paypal",
258
+ "feed_name" => "paymentCosts_paypal",
259
+ "format" => "optional",
260
+ ),
261
+ "paymentCosts_giropay" => array(
262
+ "name" => "paymentCosts_giropay",
263
+ "feed_name" => "paymentCosts_giropay",
264
+ "format" => "optional",
265
+ ),
266
+ "paymentCosts_direct_debit" => array(
267
+ "name" => "paymentCosts_direct_debit",
268
+ "feed_name" => "paymentCosts_direct_debit",
269
+ "format" => "optional",
270
+ ),
271
+ "paymentCosts_google_checkout" => array(
272
+ "name" => "paymentCosts_google_checkout",
273
+ "feed_name" => "paymentCosts_google_checkout",
274
+ "format" => "optional",
275
+ ),
276
+ "paymentCosts_invoice" => array(
277
+ "name" => "paymentCosts_invoice",
278
+ "feed_name" => "paymentCosts_invoice",
279
+ "format" => "optional",
280
+ ),
281
+ "paymentCosts_postal_order" => array(
282
+ "name" => "paymentCosts_postal_order",
283
+ "feed_name" => "paymentCosts_postal_order",
284
+ "format" => "optional",
285
+ ),
286
+ "paymentCosts_paysafecard" => array(
287
+ "name" => "paymentCosts_paysafecard",
288
+ "feed_name" => "paymentCosts_paysafecard",
289
+ "format" => "optional",
290
+ ),
291
+ "paymentCosts_sofortueberweisung" => array(
292
+ "name" => "paymentCosts_sofortueberweisung",
293
+ "feed_name" => "paymentCosts_sofortueberweisung",
294
+ "format" => "optional",
295
+ ),
296
+ "paymentCosts_amazon_payment" => array(
297
+ "name" => "paymentCosts_amazon_payment",
298
+ "feed_name" => "paymentCosts_amazon_payment",
299
+ "format" => "optional",
300
+ ),
301
+ "paymentCosts_electronical_payment_standard" => array(
302
+ "name" => "paymentCosts_electronical_payment_standard",
303
+ "feed_name" => "paymentCosts_electronical_payment_standard",
304
+ "format" => "optional",
305
+ ),
306
+ "paymentCosts_ecotax" => array(
307
+ "name" => "paymentCosts_ecotax",
308
+ "feed_name" => "paymentCosts_ecotax",
309
+ "format" => "optional",
310
+ ),
311
+ "used" => array(
312
+ "name" => "used",
313
+ "feed_name" => "used",
314
+ "format" => "optional",
315
+ ),
316
+ "download" => array(
317
+ "name" => "download",
318
+ "feed_name" => "download",
319
+ "format" => "optional",
320
+ ),
321
+ "replica" => array(
322
+ "name" => "replica",
323
+ "feed_name" => "replica",
324
+ "format" => "optional",
325
+ ),
326
+ "size" => array(
327
+ "name" => "size",
328
+ "feed_name" => "size",
329
+ "format" => "optional",
330
+ ),
331
+ "colour" => array(
332
+ "name" => "colour",
333
+ "feed_name" => "colour",
334
+ "format" => "optional",
335
+ ),
336
+ "gender" => array(
337
+ "name" => "gender",
338
+ "feed_name" => "gender",
339
+ "format" => "optional",
340
+ ),
341
+ "material" => array(
342
+ "name" => "material",
343
+ "feed_name" => "material",
344
+ "format" => "optional",
345
+ ),
346
+ "oens" => array(
347
+ "name" => "oens",
348
+ "feed_name" => "oens",
349
+ "format" => "optional",
350
+ ),
351
+ "kbas" => array(
352
+ "name" => "kbas",
353
+ "feed_name" => "kbas",
354
+ "format" => "optional",
355
+ ),
356
+ "diopter" => array(
357
+ "name" => "diopter",
358
+ "feed_name" => "diopter",
359
+ "format" => "optional",
360
+ ),
361
+ "baseCurve" => array(
362
+ "name" => "baseCurve",
363
+ "feed_name" => "baseCurve",
364
+ "format" => "optional",
365
+ ),
366
+ "diameter" => array(
367
+ "name" => "diameter",
368
+ "feed_name" => "diameter",
369
+ "format" => "optional",
370
+ ),
371
+ "cylinder" => array(
372
+ "name" => "cylinder",
373
+ "feed_name" => "cylinder",
374
+ "format" => "optional",
375
+ ),
376
+ "axis" => array(
377
+ "name" => "axis",
378
+ "feed_name" => "axis",
379
+ "format" => "optional",
380
+ ),
381
+ "addition" => array(
382
+ "name" => "addition",
383
+ "feed_name" => "addition",
384
+ "format" => "optional",
385
+ ),
386
+ "pzns" => array(
387
+ "name" => "pzns",
388
+ "feed_name" => "pzns",
389
+ "format" => "optional",
390
+ ),
391
+ "quantity" => array(
392
+ "name" => "quantity",
393
+ "feed_name" => "quantity",
394
+ "format" => "optional",
395
+ ),
396
+ "fuelEfficiency" => array(
397
+ "name" => "fuelEfficiency",
398
+ "feed_name" => "fuelEfficiency",
399
+ "format" => "optional",
400
+ ),
401
+ "wetGrip" => array(
402
+ "name" => "wetGrip",
403
+ "feed_name" => "wetGrip",
404
+ "format" => "optional",
405
+ ),
406
+ "externalRollingNoise" => array(
407
+ "name" => "externalRollingNoise",
408
+ "feed_name" => "externalRollingNoise",
409
+ "format" => "optional",
410
+ ),
411
+ "rollingNoiseClass" => array(
412
+ "name" => "rollingNoiseClass",
413
+ "feed_name" => "rollingNoiseClass",
414
+ "format" => "optional",
415
+ ),
416
+ "alcoholicContent" => array(
417
+ "name" => "alcoholicContent",
418
+ "feed_name" => "alcoholicConent",
419
+ "format" => "optional",
420
+ ),
421
+ "allergenInformation" => array(
422
+ "name" => "allergenInformation",
423
+ "feed_name" => "allergenInformation",
424
+ "format" => "optional",
425
+ ),
426
+ "countryOfOrigin" => array(
427
+ "name" => "countryOfOrigin",
428
+ "feed_name" => "countryOfOrigin",
429
+ "format" => "optional",
430
+ ),
431
+ "bottler" => array(
432
+ "name" => "bottler",
433
+ "feed_name" => "bottler",
434
+ "format" => "optional",
435
+ ),
436
+ "importer" => array(
437
+ "name" => "importer",
438
+ "feed_name" => "importer",
439
+ "format" => "optional",
440
+ ),
441
+ ),
442
+ );
443
+ return $idealo;
444
+ }
445
+ }
446
+ ?>
classes/class-activate.php CHANGED
@@ -64,7 +64,14 @@ class WooSEA_Activation {
64
  "fields" => "google_shopping",
65
  "taxonomy" => "google_shopping",
66
  "utm_source" => "Bing Shopping",
67
- "type" => "Advertising" ),
 
 
 
 
 
 
 
68
  "Facebook Catalog Feed / Instagram" => array (
69
  "channel_hash" => md5("Facebook Remarketing"),
70
  "name" => "Facebook Catalog Feed / Instagram",
@@ -90,7 +97,7 @@ class WooSEA_Activation {
90
  "channel_hash" => md5("Snapchat Product Catalog"),
91
  "name" => "Snapchat Product Catalog",
92
  "fields" => "snapchat",
93
- "taxonomy" => "none",
94
  "utm_source" => "snapchat",
95
  "type" => "Advertising" ),
96
  ),
@@ -740,7 +747,7 @@ class WooSEA_Activation {
740
  "Idealo.de" => array (
741
  "channel_hash" => md5("Idealo.de"),
742
  "name" => "Idealo.de",
743
- "fields" => "customfeed",
744
  "taxonomy" => "none",
745
  "utm_source" => "Idealo.de",
746
  "type" => "Comparison shopping engine" ),
@@ -1112,6 +1119,13 @@ class WooSEA_Activation {
1112
  "taxonomy" => "none",
1113
  "utm_source" => "Tweakers.nl",
1114
  "type" => "Comparison shopping engine" ),
 
 
 
 
 
 
 
1115
  "Fashionchick.nl" => array (
1116
  "channel_hash" => md5("Fashionchick.nl"),
1117
  "name" => "Fashionchick.nl",
64
  "fields" => "google_shopping",
65
  "taxonomy" => "google_shopping",
66
  "utm_source" => "Bing Shopping",
67
+ "type" => "Advertising" ),
68
+ "Bing Shopping Promotions" => array (
69
+ "channel_hash" => md5("Bing Shopping Promotions"),
70
+ "name" => "Bing Shopping Promotions",
71
+ "fields" => "google_shopping_promotions",
72
+ "taxonomy" => "google_shopping_promotions",
73
+ "utm_source" => "Bing Shopping Promotions",
74
+ "type" => "Advertising" ),
75
  "Facebook Catalog Feed / Instagram" => array (
76
  "channel_hash" => md5("Facebook Remarketing"),
77
  "name" => "Facebook Catalog Feed / Instagram",
97
  "channel_hash" => md5("Snapchat Product Catalog"),
98
  "name" => "Snapchat Product Catalog",
99
  "fields" => "snapchat",
100
+ "taxonomy" => "google_shopping",
101
  "utm_source" => "snapchat",
102
  "type" => "Advertising" ),
103
  ),
747
  "Idealo.de" => array (
748
  "channel_hash" => md5("Idealo.de"),
749
  "name" => "Idealo.de",
750
+ "fields" => "idealo",
751
  "taxonomy" => "none",
752
  "utm_source" => "Idealo.de",
753
  "type" => "Comparison shopping engine" ),
1119
  "taxonomy" => "none",
1120
  "utm_source" => "Tweakers.nl",
1121
  "type" => "Comparison shopping engine" ),
1122
+ "Boetiek.nl" => array (
1123
+ "channel_hash" => md5("Boetiek.nl"),
1124
+ "name" => "Boetiek.nl",
1125
+ "fields" => "boetiek",
1126
+ "taxonomy" => "none",
1127
+ "utm_source" => "Boetiek.nl",
1128
+ "type" => "Comparison shopping engine" ),
1129
  "Fashionchick.nl" => array (
1130
  "channel_hash" => md5("Fashionchick.nl"),
1131
  "name" => "Fashionchick.nl",
classes/class-attributes.php CHANGED
@@ -48,7 +48,7 @@ private function get_dynamic_attributes(){
48
  global $wpdb;
49
  $list = array();
50
 
51
- $no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","yst_prominent_words","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
52
  $taxonomies = get_taxonomies();
53
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
54
 
@@ -205,13 +205,17 @@ public function get_mapping_attributes_dropdown() {
205
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
206
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
207
  "title" => "Product name",
208
- "mother_title" => "Product name parent product",
209
  "title_hyphen" => "Product name hyphen",
 
 
210
  "title_lc" => "Product name lowercase",
 
211
  "description" => "Product description",
212
  "short_description" => "Product short description",
213
  "raw_description" => "Unfiltered product description",
214
  "raw_short_description" => "Unfiltered product short description",
 
 
215
  "price" => "Price",
216
  "regular_price" => "Regular price",
217
  "sale_price" => "Sale price",
@@ -247,9 +251,10 @@ public function get_mapping_attributes_dropdown() {
247
  "category_path" => "Category path",
248
  "category_path_short" => "Category path short",
249
  "category_path_skroutz" => "Category path Skroutz",
250
- "one_category" => "Primary category",
251
  "condition" => "Condition",
252
- "availability" => "Availability",
 
253
  "quantity" => "Quantity [Stock]",
254
  "product_type" => "Product Type",
255
  "content_type" => "Content Type",
@@ -267,7 +272,8 @@ public function get_mapping_attributes_dropdown() {
267
  "length" => "Length",
268
  "shipping" => "Shipping",
269
  "shipping_price" => "Shipping cost",
270
- "shipping_label" => "Shipping label",
 
271
  "visibility" => "Visibility",
272
  "rating_total" => "Total rating",
273
  "rating_average" => "Average rating",
@@ -350,9 +356,10 @@ public function get_mapping_attributes_dropdown() {
350
 
351
  foreach ($custom_attributes as $key => $value) {
352
  if (!preg_match("/pyre|sbg|fusion/i",$value)){
353
- if (strpos($value, 0, 1) !== "_") {
 
354
  $dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
355
- }
356
  }
357
  }
358
 
@@ -398,15 +405,19 @@ public function get_mapping_attributes_dropdown() {
398
  "parent_sku" => "SKU parent variable product",
399
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
400
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
401
- "title" => "Product name",
402
- "mother_title" => "Product name parent product",
403
- "title_hyphen" => "Product name hyphen",
 
404
  "title_lc" => "Product name lowercase",
 
405
  "description" => "Product description",
406
  "short_description" => "Product short description",
407
  "raw_description" => "Unfiltered product description",
408
  "raw_short_description" => "Unfiltered product short description",
409
- "link" => "Link",
 
 
410
  "variable_link" => "Product variable link",
411
  "add_to_cart_link" => "Add to cart link",
412
  "image" => "Main image",
@@ -429,10 +440,11 @@ public function get_mapping_attributes_dropdown() {
429
  "category_path" => "Category path",
430
  "category_path_short" => "Category path short",
431
  "category_path_skroutz" => "Category path Skroutz",
432
- "one_category" => "Primary category",
433
  "condition" => "Condition",
434
  "availability" => "Availability",
435
- "quantity" => "Quantity [Stock]",
 
436
  "price" => "Price",
437
  "regular_price" => "Regular price",
438
  "sale_price" => "Sale price",
@@ -464,7 +476,8 @@ public function get_mapping_attributes_dropdown() {
464
  "length" => "Length",
465
  "shipping" => "Shipping",
466
  "shipping_price" => "Shipping cost",
467
- "shipping_label" => "Shipping label",
 
468
  "visibility" => "Visibility",
469
  "rating_total" => "Total rating",
470
  "rating_average" => "Average rating",
48
  global $wpdb;
49
  $list = array();
50
 
51
+ $no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
52
  $taxonomies = get_taxonomies();
53
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
54
 
205
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
206
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
207
  "title" => "Product name",
 
208
  "title_hyphen" => "Product name hyphen",
209
+ "mother_title" => "Product name parent product",
210
+ "mother_title_hyphen" => "Product name parent product hyphen",
211
  "title_lc" => "Product name lowercase",
212
+ "title_lcw" => "Product name uppercase first characters",
213
  "description" => "Product description",
214
  "short_description" => "Product short description",
215
  "raw_description" => "Unfiltered product description",
216
  "raw_short_description" => "Unfiltered product short description",
217
+ "mother_description" => "Product description parent product",
218
+ "mother_short_description" => "Product short description parent product",
219
  "price" => "Price",
220
  "regular_price" => "Regular price",
221
  "sale_price" => "Sale price",
251
  "category_path" => "Category path",
252
  "category_path_short" => "Category path short",
253
  "category_path_skroutz" => "Category path Skroutz",
254
+ "one_category" => "Yoast primary category",
255
  "condition" => "Condition",
256
+ "availability" => "Availability",
257
+ "stock_status" => "Stock Status WooCommerce",
258
  "quantity" => "Quantity [Stock]",
259
  "product_type" => "Product Type",
260
  "content_type" => "Content Type",
272
  "length" => "Length",
273
  "shipping" => "Shipping",
274
  "shipping_price" => "Shipping cost",
275
+ "shipping_label" => "Shipping class slug",
276
+ "shipping_label_name" => "Shipping class name",
277
  "visibility" => "Visibility",
278
  "rating_total" => "Total rating",
279
  "rating_average" => "Average rating",
356
 
357
  foreach ($custom_attributes as $key => $value) {
358
  if (!preg_match("/pyre|sbg|fusion/i",$value)){
359
+ $value = ltrim($value);
360
+ if (!empty($value)){
361
  $dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
362
+ }
363
  }
364
  }
365
 
405
  "parent_sku" => "SKU parent variable product",
406
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
407
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
408
+ "title" => "Product name",
409
+ "title_hyphen" => "Product name hyphen",
410
+ "mother_title" => "Product name parent product",
411
+ "mother_title_hyphen" => "Product name parent product hyphen",
412
  "title_lc" => "Product name lowercase",
413
+ "title_lcw" => "Product name uppercase first characters",
414
  "description" => "Product description",
415
  "short_description" => "Product short description",
416
  "raw_description" => "Unfiltered product description",
417
  "raw_short_description" => "Unfiltered product short description",
418
+ "mother_description" => "Product description parent product",
419
+ "mother_short_description" => "Product short description parent product",
420
+ "link" => "Link",
421
  "variable_link" => "Product variable link",
422
  "add_to_cart_link" => "Add to cart link",
423
  "image" => "Main image",
440
  "category_path" => "Category path",
441
  "category_path_short" => "Category path short",
442
  "category_path_skroutz" => "Category path Skroutz",
443
+ "one_category" => "Yoast primary category",
444
  "condition" => "Condition",
445
  "availability" => "Availability",
446
+ "stock_status" => "Stock Status WooCommerce",
447
+ "quantity" => "Quantity [Stock]",
448
  "price" => "Price",
449
  "regular_price" => "Regular price",
450
  "sale_price" => "Sale price",
476
  "length" => "Length",
477
  "shipping" => "Shipping",
478
  "shipping_price" => "Shipping cost",
479
+ "shipping_label" => "Shipping class slug",
480
+ "shipping_label_name" => "Shipping class name",
481
  "visibility" => "Visibility",
482
  "rating_total" => "Total rating",
483
  "rating_average" => "Average rating",
classes/class-get-products.php CHANGED
@@ -26,7 +26,6 @@ class WooSEA_Get_Products {
26
  return "<![CDATA[ $string ]]>";
27
  }
28
 
29
-
30
  /**
31
  * Check if a plugin is active
32
  */
@@ -57,6 +56,11 @@ class WooSEA_Get_Products {
57
  * Get all approved product review comments for Google's Product Review Feeds
58
  */
59
  public function woosea_get_reviews ( $product_data, $product ) {
 
 
 
 
 
60
  $approved_reviews = array();
61
  $prod_id = $product_data['id'];
62
 
@@ -73,54 +77,61 @@ class WooSEA_Get_Products {
73
 
74
  // Loop through all product reviews for this specific products (ternary operators)
75
  foreach($reviews as $review_raw){
76
- $review = array();
77
- $review['review_reviewer_image'] = empty($product_data['reviewer_image']) ? '' : $product_data['reviewer_image'];
78
- $review['review_ratings'] = get_comment_meta( $review_raw->comment_ID, 'rating', true);
79
- $review['review_id'] = $review_raw->comment_ID;
80
-
81
- // Names need to be anonomyzed
82
- $name_pieces = explode(" ", $review_raw->comment_author);
83
- $nr_name_pieces = count($name_pieces);
84
- $cnt = 0;
85
- $name = "";
86
- foreach($name_pieces as $n_piece){
87
- if($cnt > 0){
88
- $n_piece = substr($n_piece, 0, 1);
89
- }
90
- $name .= $n_piece." ";
91
- $cnt++;
92
- }
93
 
94
- // Remove strange charachters from reviewer name
95
- $review['reviewer_name'] = $this->rip_tags(trim(ucfirst($name)));
96
- $review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
97
- $review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
98
- $review['reviewer_name'] = str_replace("&#xa0;", "", $review['reviewer_name']);
99
- $review['reviewer_name'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
100
-
101
- $review['reviewer_id'] = $review_raw->user_id;
102
- $review['review_timestamp'] = $review_raw->comment_date;
103
-
104
- // Remove strange characters from review title
105
- $review['title'] = empty($product_data['title']) ? '' : $product_data['title'];
106
- $review['title'] = $this->rip_tags($review['title']);
107
- $review['title'] = html_entity_decode((str_replace("\r", "", $review['title'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
108
- $review['title'] = preg_replace( '/\[(.*?)\]/', ' ', $review['title'] );
109
- $review['title'] = str_replace("&#xa0;", "", $review['title']);
110
- $review['title'] = $this->woosea_utf8_for_xml( $review['title'] );
111
-
112
- // Remove strange charchters from review content
113
- $review['content'] = $review_raw->comment_content;
114
- $review['content'] = $this->rip_tags($review['content']);
115
- $review['content'] = html_entity_decode((str_replace("\r", "", $review['content'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
116
- $review['content'] = preg_replace( '/\[(.*?)\]/', ' ', $review['content'] );
117
- $review['content'] = str_replace("&#xa0;", "", $review['content']);
118
- $review['content'] = $this->woosea_utf8_for_xml( $review['content'] );
119
-
120
- $review['review_product_name'] = $product_data['title'];
121
- $review['review_url'] = $product_data['link'];
122
- $review['review_product_url'] = $product_data['link'];
123
- array_push($approved_reviews, $review);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
125
  $review_count = $product->get_review_count();
126
  $review_average = $product->get_average_rating();
@@ -174,7 +185,7 @@ class WooSEA_Get_Products {
174
  if($feed_config['fields'] == "google_drm"){
175
  $utm_part .= "&$key=$value";
176
  } else {
177
- $utm_part .= "&amp;$key=$value";
178
  }
179
  }
180
 
@@ -200,7 +211,7 @@ class WooSEA_Get_Products {
200
  if($parentId > 0){
201
  # Even though variation products always have parameters in the URL we still need to check and make sure they are there
202
  if(strpos($link, '?') !== false){
203
- $utm_part = "&amp;".ltrim($utm_part, '&amp;');
204
  } else {
205
  $utm_part = "?".ltrim($utm_part, '&amp;');
206
  }
@@ -324,7 +335,7 @@ class WooSEA_Get_Products {
324
  /**
325
  * Get category path (needed for Prisjakt)
326
  */
327
- public function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxonomy, $nicename = false, $visited = array() ) {
328
  // Only add Home to the beginning of the chain when we start buildin the chain
329
  if(empty($visited)){
330
  $chain = 'Home';
@@ -363,6 +374,15 @@ class WooSEA_Get_Products {
363
  return $chain;
364
  }
365
 
 
 
 
 
 
 
 
 
 
366
  /**
367
  * Get all configured shipping zones
368
  */
@@ -712,6 +732,8 @@ class WooSEA_Get_Products {
712
  $shipping_methods = $zone['shipping_methods'];
713
 
714
  foreach ($shipping_methods as $k => $v){
 
 
715
 
716
  if($v->enabled == "yes"){
717
  if(empty($zone_details['country'])){
@@ -755,21 +777,21 @@ class WooSEA_Get_Products {
755
  }
756
 
757
  // WooCommerce Table Rate Bolder Elements
758
- if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
759
- // Set shipping cost
760
- $shipping_cost = 0;
761
- if(!empty($product_id)){
762
- // Add product to cart
763
- if ((isset($product_id)) AND ($product_id > 0)){
764
- $quantity = 1;
765
- if(!empty($code_from_config)){
766
- defined( 'WC_ABSPATH' ) || exit;
767
-
768
- // Load cart functions which are loaded only on the front-end.
769
- include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
770
- include_once WC_ABSPATH . 'includes/class-wc-cart.php';
771
-
772
- // if ( is_null( WC()->cart ) ) {
773
  wc_load_cart();
774
 
775
  WC()->customer->set_shipping_country( $code_from_config );
@@ -787,17 +809,73 @@ class WooSEA_Get_Products {
787
  // Read cart and get schipping costs
788
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
789
  $total_cost = WC()->cart->get_total();
790
- $shipping_cost = WC()->cart->get_shipping_total();
 
 
791
  $shipping_cost = wc_format_localized_price($shipping_cost);
792
-
793
- }
794
  // Make sure to empty the cart again
795
  WC()->cart->empty_cart();
796
- // }
797
- }
798
- }
799
- }
800
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
801
 
802
  // CLASS SHIPPING COSTS
803
  if((isset($v->instance_settings[$class_cost_id])) AND ($class_cost_id != "no_class_cost")){
@@ -931,6 +1009,16 @@ class WooSEA_Get_Products {
931
  unset($shipping_cost);
932
  }
933
  }
 
 
 
 
 
 
 
 
 
 
934
  }
935
 
936
  if(isset($zone_details)){
@@ -957,12 +1045,9 @@ class WooSEA_Get_Products {
957
  $zone_details['price'] = trim($shipping_cost);
958
  }
959
  } else {
960
- // $shipping_cost = 0;
961
  if(isset($shipping_cost)){
962
  $zone_details['price'] = trim($currency." ".$shipping_cost);
963
  }
964
- //unset($zone_details);
965
- //unset($shipping_cost);
966
  }
967
  }
968
  }
@@ -992,12 +1077,19 @@ class WooSEA_Get_Products {
992
 
993
  // Remove other shipping classes when free shipping is relevant
994
  $free_check = "yes";
995
- //$free_check = get_option ('free_shipping');
996
 
997
  if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
998
  foreach($shipping_arr as $k => $v) {
999
  if(!in_array($free_check, $v)){
1000
- unset($shipping_arr[$k]);
 
 
 
 
 
 
 
 
1001
  }
1002
  }
1003
  }
@@ -1005,8 +1097,6 @@ class WooSEA_Get_Products {
1005
  // Fix empty services
1006
  foreach($shipping_arr as $k => $v){
1007
  if(empty($v['service'])){
1008
- // $lalala = get_option( 'woocommerce_default_country' );
1009
- // $shipping_arr[$k]['country'] = get_option( 'woocommerce_default_country' );
1010
  unset($shipping_arr[$k]);
1011
  }
1012
  }
@@ -1145,16 +1235,19 @@ class WooSEA_Get_Products {
1145
  } elseif (preg_match("/g:product_detail/i",$k)){
1146
  if(!empty($v)){
1147
  $product_detail_split = explode("#", $v);
1148
- $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1149
- $name = str_replace("_", " ", $product_detail_split[0]);
1150
-
1151
- $section_name = explode(":", $name);
1152
- $section_name_start = ucfirst($section_name[0]);
1153
- $name = ucfirst(trim($section_name[1]));
1154
-
1155
- $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1156
- $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1157
- $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
 
 
 
1158
  }
1159
  } elseif ($k == "g:installment"){
1160
  if(!empty($v)){
@@ -1355,187 +1448,193 @@ class WooSEA_Get_Products {
1355
 
1356
  // For Google Product review template
1357
  if (($feed_config['name'] == "Google Product Review") AND (empty($xml->channel))) {
1358
- $product = $xml->addChild('reviews');
 
 
1359
 
1360
- foreach ($products as $key => $value){
1361
 
1362
- $expl = "||";
1363
- if(strpos($value['reviews'], $expl)) {
1364
- $review_data = explode("||", $value['reviews']);
1365
- foreach($review_data as $rk => $rv){
1366
 
1367
- $review_comp = explode(":::", $rv);
1368
- $nr_reviews = count($review_comp);
1369
 
1370
- if($nr_reviews > 1){
1371
- $productz = $xml->reviews->addChild('review');
1372
 
1373
- foreach($review_comp as $rck => $rcv){
1374
- $nodes = explode("##", $rcv);
1375
- $nodes = str_replace("::", "", $nodes);
1376
 
1377
- if($nodes[0] == "REVIEW_RATINGS"){
1378
- // Do nothing
1379
- } elseif($nodes[0] == "REVIEW_URL"){
1380
- $rev_url = $productz->addChild(strtolower($nodes[0]), htmlspecialchars($nodes[1]));
1381
- $rev_url->addAttribute('type', 'singleton');
1382
- } elseif(($nodes[0] == "REVIEWER_NAME") OR ($nodes[0] == "REVIEWER_ID")){
1383
- if(isset($productz->reviewer)){
1384
- if($nodes[0] == "REVIEWER_NAME"){
1385
- $name = $nodes[1];
1386
- if(empty($name)){
1387
- $reviewer->addChild('name','Anonymous');
1388
- $reviewer->name->addAttribute('is_anonymous', 'true');
 
 
 
1389
  } else {
1390
- $reviewer->addChild('name',$name);
 
 
1391
  }
1392
  } else {
1393
- $reviewer->addChild('reviewer_id',$nodes[1]);
1394
- }
1395
- } else {
1396
- $reviewer = $productz->addChild('reviewer');
1397
- if($nodes[0] == "REVIEWER_NAME"){
1398
- $name = $nodes[1];
1399
- if(empty($name)){
1400
- $reviewer->addChild('name','Anonymous');
1401
- $reviewer->name->addAttribute('is_anonymous', 'true');
1402
  } else {
1403
- $reviewer->addChild('name',$name);
 
 
1404
  }
1405
- } else {
1406
- $reviewer->addChild('reviewer_id',$nodes[1]);
1407
  }
1408
- }
1409
- } else {
1410
- if(isset($nodes[1])){
1411
- $content = html_entity_decode($nodes[1]);
1412
- $content = htmlspecialchars($content);
1413
- $rev = $productz->addChild(strtolower($nodes[0]), $content);
1414
  }
1415
  }
1416
- }
1417
 
1418
- foreach($review_comp as $rck => $rcv){
1419
- $nodes = explode("##", $rcv);
1420
- $nodes = str_replace("::", "", $nodes);
1421
 
1422
- if($nodes[0] == "REVIEW_RATINGS"){
1423
- $rev = $productz->addChild('ratings');
1424
- $over = $productz->ratings->addChild('overall', $nodes[1]);
1425
- $over->addAttribute('min', '1');
1426
- $over->addAttribute('max', '5');
 
1427
  }
1428
- }
1429
-
1430
 
1431
- $yo = $productz->addChild('products');
1432
- $po = $yo->addChild('product');
1433
 
1434
- $identifiers = array("gtin","mpn","sku","brand");
1435
 
1436
- // Start determining order of product_ids in the Google review feed
1437
- $proper_order = array("product_name","gtin","mpn","sku","brand","product_url","review_url","reviews");
1438
- $order_sorted = array();
1439
- foreach ($proper_order as &$order_value){
1440
- if(isset($value[$order_value])){
1441
- $order_sorted[$order_value] = $value[$order_value];
 
1442
  }
1443
- }
1444
- // End
1445
-
1446
- foreach($order_sorted as $k => $v) {
1447
- if(($k != "product_name") AND ($k != "product_url")){
1448
- if(!in_array($k, $identifiers)){
1449
- if(($k != "reviews") AND ($k != "review_url")){
1450
- $v = str_replace("&", "and", $v);
1451
- $poa = $po->addChild($k,htmlspecialchars($v));
1452
- }
1453
- } else {
1454
- if(isset($po->product_ids)){
1455
- if ($k == "gtin"){
1456
- $poig = $poi->addChild('gtins');
1457
- $poig->$k = $v;
1458
- } elseif ($k == "mpn"){
1459
- $poim = $poi->addChild('mpns');
1460
- $poim->$k = $v;
1461
- } elseif ($k == "sku"){
1462
- $poix = $poi->addChild('skus');
1463
- $poix->$k = $v;
1464
- } elseif($k == "brand"){
1465
- $poib = $poi->addChild('brands');
1466
- $poib->$k = $v;
1467
- } else {
1468
- // Do nothing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1469
  }
1470
- } else {
1471
- $poi = $po->addChild('product_ids');
1472
- if ($k == "gtin"){
1473
- $poig = $poi->addChild('gtins');
1474
- $poig->$k = $v;
1475
- } elseif ($k == "mpn"){
1476
- $poim = $poi->addChild('mpns');
1477
- $poim->$k = $v;
1478
- } elseif ($k == "sku"){
1479
- $poix = $poi->addChild('skus');
1480
- $poix->$k = $v;
1481
- } elseif($k == "brand"){
1482
- $poib = $poi->addChild('brands');
1483
- $poib->$k = $v;
1484
- } else {
1485
- // Do nothing
1486
- }
1487
- }
1488
- }
1489
- }
1490
- }
1491
 
1492
- // foreach for product name and product url as order seems to mather to Google
1493
- foreach($value as $k => $v) {
1494
- if(($k == "product_name") OR ($k == "product_url")){
1495
- if(!in_array($k, $identifiers)){
1496
- if(($k != "reviews") AND ($k != "review_url")){
1497
- $v = str_replace("&", "and", $v);
1498
- $poa = $po->addChild($k,htmlspecialchars($v));
1499
- }
1500
- } else {
1501
- if(isset($po->product_ids)){
1502
- if ($k == "gtin"){
1503
- $poig = $poi->addChild('gtins');
1504
- $poig->$k = $v;
1505
- } elseif ($k == "mpn"){
1506
- $poim = $poi->addChild('mpns');
1507
- $poim->$k = $v;
1508
- } elseif($k == "sku"){
1509
- $poix = $poi->addChild('skus');
1510
- $poix->$k = $v;
1511
- } elseif($k == "brand"){
1512
- $poib = $poi->addChild('brands');
1513
- $poib->$k = $v;
1514
- } else {
1515
- // Do nothing
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1516
  }
1517
- } else {
1518
- $poi = $po->addChild('product_ids');
1519
- if ($k == "gtin"){
1520
- $poig = $poi->addChild('gtins');
1521
- $poig->$k = $v;
1522
- } elseif ($k == "mpn"){
1523
- $poim = $poi->addChild('mpns');
1524
- $poim->$k = $v;
1525
- } elseif ($k == "sku"){
1526
- $poix = $poi->addChild('skus');
1527
- $poix->$k = $v;
1528
- } elseif($k == "brand"){
1529
- $poib = $poi->addChild('brands');
1530
- $poib->$k = $v;
1531
- } else {
1532
- // Do nothing
1533
- }
1534
- }
1535
- }
1536
- }
1537
- }
1538
- }
1539
  }
1540
  }
1541
  }
@@ -1993,7 +2092,7 @@ class WooSEA_Get_Products {
1993
  $xml_piece = "";
1994
 
1995
  // Get taxonomies
1996
- $no_taxonomies = array("element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","yst_prominent_words","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
1997
  $taxonomies = get_taxonomies();
1998
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
1999
 
@@ -2325,6 +2424,10 @@ class WooSEA_Get_Products {
2325
  $product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
2326
  $product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
2327
 
 
 
 
 
2328
  /**
2329
  * Check of we need to add Google Analytics UTM parameters
2330
  */
@@ -2350,6 +2453,8 @@ class WooSEA_Get_Products {
2350
  if(empty($product_data['condition']) || $product_data['condition'] == "Array"){
2351
  $product_data['condition'] = "New";
2352
  }
 
 
2353
  $product_data['availability'] = $this->get_stock( $this->childID );
2354
 
2355
  /**
@@ -2358,6 +2463,7 @@ class WooSEA_Get_Products {
2358
  * Therefor, we need to check the stock_status and overwrite te availability value
2359
  */
2360
  $stock_status = $product->get_stock_status();
 
2361
  if ($stock_status == "outofstock"){
2362
  $product_data['availability'] = "out of stock";
2363
  } elseif ($stock_status == "onbackorder") {
@@ -2439,6 +2545,10 @@ class WooSEA_Get_Products {
2439
  }
2440
 
2441
  $product_data['shipping_label'] = $product->get_shipping_class();
 
 
 
 
2442
 
2443
  // Get product prices
2444
  $product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
@@ -2449,9 +2559,11 @@ class WooSEA_Get_Products {
2449
  $product_data['regular_price'] = wc_format_decimal($product_data['regular_price'],2);
2450
 
2451
  // Untouched raw system pricing - DO NOT CHANGE THESE
2452
- $product_data['system_net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
2453
- $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2454
- $product_data['system_regular_price'] = round($product->get_regular_price(),2);
 
 
2455
  $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2456
 
2457
  $product_data['system_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
@@ -2485,6 +2597,7 @@ class WooSEA_Get_Products {
2485
  if($product->get_type() == "bundle"){
2486
  if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
2487
  $product_data['price'] = get_post_meta($product_data['id'], '_price', true);
 
2488
  if(is_numeric($tax_rates[1]['rate'])){
2489
  $product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2490
  $product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
@@ -2570,8 +2683,10 @@ class WooSEA_Get_Products {
2570
  $product_data['net_sale_price'] = "";
2571
  }
2572
  }
2573
- $product_data['net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
2574
-
 
 
2575
  $price = wc_get_price_including_tax($product,array('price'=> $product->get_price()));
2576
  if($product_data['sale_price'] > 0){
2577
  $price = $product_data['sale_price'];
@@ -2582,6 +2697,7 @@ class WooSEA_Get_Products {
2582
  $discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $product_data['sale_price'], 'discounted_price', true, true);
2583
  if($discount !== false){
2584
  $product_data['sale_price'] = $discount;
 
2585
  $price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
2586
  if($price_incl_tax == "yes"){
2587
  $product_data['price_forced'] = $product_data['price']*($fullrate/100);
@@ -2697,12 +2813,18 @@ class WooSEA_Get_Products {
2697
  $product_data['sale_price'] = wc_format_localized_price($product_data['sale_price']);
2698
  if($product->get_price()){
2699
  $product_data['price_forced'] = wc_format_localized_price($product_data['price_forced']);
 
 
2700
  }
2701
  if($product->get_regular_price()){
2702
  $product_data['regular_price_forced'] = wc_format_localized_price($product_data['regular_price_forced']);
 
 
2703
  }
2704
  if($product->get_sale_price()){
2705
  $product_data['sale_price_forced'] = wc_format_localized_price($product_data['sale_price_forced']);
 
 
2706
  }
2707
  $product_data['net_price'] = wc_format_localized_price($product_data['net_price']);
2708
 
@@ -2722,9 +2844,12 @@ class WooSEA_Get_Products {
2722
  $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
2723
 
2724
  // Add rounded price options
2725
- $product_data['rounded_price'] = round($product_data['price']);
2726
- $product_data['rounded_regular_price'] = round($product_data['regular_price']);
2727
- $product_data['rounded_sale_price'] = round($product_data['sale_price']);
 
 
 
2728
 
2729
  // Calculate discount percentage
2730
  if($product_data['sale_price'] > 0){
@@ -2742,7 +2867,7 @@ class WooSEA_Get_Products {
2742
  }
2743
  }
2744
 
2745
- if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi")){
2746
  $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
2747
  $shipping_str = $product_data['shipping'];
2748
  }
@@ -2838,7 +2963,7 @@ class WooSEA_Get_Products {
2838
 
2839
  foreach($diff_taxonomies as $taxo){
2840
  $term_value = get_the_terms($product_data['id'], $taxo);
2841
- $product_data[$taxo] = "";
2842
 
2843
  if(is_array($term_value)){
2844
  // Do not add variation values to the feed when they are out of stock
@@ -2848,7 +2973,7 @@ class WooSEA_Get_Products {
2848
  $variations = $product_skroutz->get_available_variations();
2849
  $variations_id = wp_list_pluck( $variations, 'variation_id' );
2850
  $skroutz_att_array = array();
2851
-
2852
  foreach($variations_id as $var_id){
2853
  $stock_value = get_post_meta( $var_id, "_stock_status", true );
2854
  if($stock_value == "instock"){
@@ -2862,7 +2987,6 @@ class WooSEA_Get_Products {
2862
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
2863
  }
2864
  }
2865
-
2866
  foreach($skroutz_att_array as $skrtz_value){
2867
  $product_data[$taxo] .= ",". $skrtz_value;
2868
  }
@@ -2977,7 +3101,7 @@ class WooSEA_Get_Products {
2977
  $data = $wpdb->get_results($sql);
2978
  if (count($data)) {
2979
  foreach ($data as $key => $value) {
2980
- $value_display = str_replace("_", " ",$value->name);
2981
  if (preg_match("/_product_attributes/i",$value->name)){
2982
  $product_attr = unserialize($value->type);
2983
  if(!empty($product_attr)){
@@ -2995,14 +3119,14 @@ class WooSEA_Get_Products {
2995
 
2996
  /**
2997
  * Get Product Attributes for Single products
 
2998
  */
2999
- if (($product->is_type('simple')) OR ($product->is_type('external')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product->is_type('auction') OR ($product->is_type('subscription')))){
3000
  $single_attributes = $product->get_attributes();
3001
-
3002
  foreach ($single_attributes as $attribute){
3003
- $attr_name = strtolower($attribute->get_name());
3004
- $attr_value = $product->get_attribute($attr_name);
3005
- $product_data[$attr_name] = $attr_value;
3006
  }
3007
  }
3008
 
@@ -3028,9 +3152,9 @@ class WooSEA_Get_Products {
3028
  $product_variations = new WC_Product_Variation( $product_data['id'] );
3029
  $variations = $product_variations->get_variation_attributes();
3030
 
3031
- // For Skroutz apparal products we can only append colours to the product name
3032
  // When a product has both a size and color attribute we assume its an apparal product
3033
- if($project_config['fields'] == "skroutz"){
3034
  $size_found = "no";
3035
  $color_found = "no";
3036
 
@@ -3106,23 +3230,27 @@ class WooSEA_Get_Products {
3106
  }
3107
  }
3108
 
3109
-
3110
-
3111
  if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
3112
-
3113
  // Determine the default variation product
3114
  if( ($product_data['item_group_id'] > 0) AND (is_object(wc_get_product( $product_data['item_group_id']))) AND (($product_data['product_type'] == "variation") OR ($product_data['product_type'] == "subscription_variation"))){
3115
- $mother_product = wc_get_product($product_data['item_group_id']);
3116
- $def_attributes = $mother_product->get_default_attributes();
 
3117
 
3118
  if(isset($project_config['lowest_price_variations'])){
3119
-
3120
  // Determine lowest priced variation
3121
  $variation_min_price = $mother_product->get_variation_price('min');
3122
  $variation_min_price = wc_format_decimal($variation_min_price,2);
3123
  $variation_min_price = wc_format_localized_price($variation_min_price);
3124
-
3125
- if($product_data['system_net_price'] == $variation_min_price){
 
 
 
 
 
 
3126
  $variation_pass = "true";
3127
  } else {
3128
  $variation_pass = "false";
@@ -3260,19 +3388,21 @@ class WooSEA_Get_Products {
3260
  /**
3261
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
3262
  */
 
 
3263
  foreach($diff_taxonomies as $taxo){
3264
  $term_value = get_the_terms($product_data['item_group_id'], $taxo);
3265
  unset($product_data[$taxo]);
3266
  if(is_array($term_value)){
3267
  foreach($term_value as $term){
3268
  if(empty($product_data[$taxo])){
3269
- $product_data[$taxo] = $term->name;
3270
  } else {
3271
- $product_data[$taxo] .= " ".$term->name;
3272
  }
3273
  }
3274
  }
3275
- }
3276
 
3277
  /**
3278
  * Add product tags to the product data array
@@ -3292,6 +3422,7 @@ class WooSEA_Get_Products {
3292
 
3293
  // Add attribute values to the variation product names to make them unique
3294
  $product_data['title_hyphen'] = $product_data['title']." - ";
 
3295
 
3296
  foreach($variations as $kk => $vv){
3297
  $custom_key = $kk;
@@ -3440,6 +3571,8 @@ class WooSEA_Get_Products {
3440
  * we will add CDATA brackets to the title and description attributes
3441
  */
3442
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
 
 
3443
  //$product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3444
  //$product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
3445
 
@@ -3448,6 +3581,17 @@ class WooSEA_Get_Products {
3448
  */
3449
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3450
 
 
 
 
 
 
 
 
 
 
 
 
3451
  /**
3452
  * Check if individual products need to be excluded
3453
  */
@@ -3513,16 +3657,19 @@ class WooSEA_Get_Products {
3513
  // For these channels parent products are allowed
3514
  $allowed_channel_parents = array(
3515
  "skroutz",
 
3516
  "google_dsa",
3517
  "google_product_review",
3518
  );
3519
 
3520
- if (!in_array($project_config['fields'], $allowed_channel_parents)){
3521
- if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
3522
- $product_data = array();
3523
- $product_data = null;
3524
- }
3525
- }
 
 
3526
 
3527
  /**
3528
  * Remove variation products that are not THE default variation product
@@ -3535,7 +3682,7 @@ class WooSEA_Get_Products {
3535
  /**
3536
  * And item_group_id is not allowed for simple products, prevent users from adding this to the feedd
3537
  */
3538
- if($product->is_type('simple') OR ($product->is_type('auction'))){
3539
  unset($product_data['item_group_id']);
3540
  }
3541
 
@@ -3549,6 +3696,51 @@ class WooSEA_Get_Products {
3549
  }
3550
  }
3551
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3552
  /**
3553
  * When product has passed the filter rules it can continue with the rest
3554
  */
@@ -3582,7 +3774,7 @@ class WooSEA_Get_Products {
3582
  }
3583
  } else {
3584
  if((strlen($attr_value['mapfrom'])) AND (array_key_exists($attr_value['mapfrom'], $product_data))){
3585
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
3586
  $attr_line = "'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
3587
  } else {
3588
  $attr_line = "'".$attr_value['prefix']. "".$product_data[$attr_value['mapfrom']]."" .$attr_value['suffix']."'";
@@ -3654,7 +3846,7 @@ class WooSEA_Get_Products {
3654
  }
3655
  } else {
3656
  if(strlen($product_data[$attr_value['mapfrom']])){
3657
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
3658
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3659
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3660
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
@@ -3874,7 +4066,7 @@ class WooSEA_Get_Products {
3874
  }
3875
  } else {
3876
  if(strlen($product_data[$attr_value['mapfrom']])){
3877
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
3878
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3879
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3880
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
@@ -4404,479 +4596,482 @@ class WooSEA_Get_Products {
4404
  return $product_data;
4405
  }
4406
 
4407
- /**
4408
- * Execute project rules
4409
- */
4410
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
4411
- $aantal_prods = count($product_data);
4412
- if($aantal_prods > 0){
4413
 
4414
- foreach ($project_rules2 as $pr_key => $pr_array){
4415
 
4416
- foreach ($product_data as $pd_key => $pd_value){
4417
 
4418
- // Check is there is a rule on specific attributes
4419
- if($pd_key == $pr_array['attribute']){
4420
 
4421
- // This is because for data manipulation the than attribute is empty
4422
- if(!array_key_exists('than_attribute', $pr_array)){
4423
- $pr_array['than_attribute'] = $pd_key;
4424
- }
4425
 
4426
  // Check if a rule has been set for Google categories
4427
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
4428
-
4429
- $pr_array['than_attribute'] = "categories";
4430
  $category_id = explode("-", $pr_array['newvalue']);
4431
  $pr_array['newvalue'] = $category_id[0];
4432
- $product_data['categories'] = $pr_array['newvalue'];
4433
- }
4434
 
4435
- // Make sure that rules on numerics are on true numerics
4436
- if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
4437
- $pd_value = strtr($pd_value, ',', '.');
4438
- }
4439
 
4440
 
4441
- // Make sure the price or sale price is numeric
4442
- if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
4443
- settype($pd_value, "double");
4444
- }
4445
 
4446
- if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
4447
 
4448
- // Rules for numeric values
4449
- switch ($pr_array['condition']) {
4450
- case($pr_array['condition'] = "contains"):
4451
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4452
- $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
4453
- }
4454
- break;
4455
- case($pr_array['condition'] = "containsnot"):
4456
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4457
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4458
- }
4459
- break;
4460
- case($pr_array['condition'] = "="):
4461
- if (($pd_value == $pr_array['criteria'])){
4462
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4463
- }
4464
- break;
4465
- case($pr_array['condition'] = "!="):
4466
- if (($pd_value != $pr_array['criteria'])){
4467
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4468
- }
4469
- break;
4470
- case($pr_array['condition'] = ">"):
4471
- if (($pd_value > $pr_array['criteria'])){
4472
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4473
- }
4474
- break;
4475
- case($pr_array['condition'] = ">="):
4476
- if (($pd_value >= $pr_array['criteria'])){
4477
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4478
- }
4479
- break;
4480
- case($pr_array['condition'] = "<"):
4481
- if (($pd_value < $pr_array['criteria'])){
4482
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4483
- }
4484
- break;
4485
- case($pr_array['condition'] = "=<"):
4486
- if (($pd_value <= $pr_array['criteria'])){
4487
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4488
- }
4489
- break;
4490
- case($pr_array['condition'] = "empty"):
4491
- if(empty($product_data[$pr_array['attribute']])){
4492
- if ((strlen($pd_value) < 1)){
4493
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4494
- } else {
4495
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4496
- }
4497
- }
4498
- break;
4499
- case($pr_array['condition'] = "multiply"):
4500
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4501
- $convert_back = "false";
4502
- $pos = strpos($pd_value, ',');
4503
- if($pos !== false){
4504
- $convert_back = "true";
4505
- }
4506
- $pd_value = strtr($pd_value, ',', '.');
4507
- $newvalue = $pd_value*$pr_array['criteria'];
4508
- $newvalue = round($newvalue, 2);
4509
- if($convert_back == "true"){
4510
- $newvalue = strtr($newvalue, '.',',');
4511
- }
4512
- $product_data[$pr_array['attribute']] = $newvalue;
4513
- break;
4514
- case($pr_array['condition'] = "divide"):
4515
- $newvalue = ($pd_value / $pr_array['criteria']);
4516
- $newvalue = round($newvalue, 2);
4517
- $newvalue = strtr($newvalue, '.',',');
4518
- $product_data[$pr_array['attribute']] = $newvalue;
4519
- break;
4520
- case($pr_array['condition'] = "plus"):
4521
- $newvalue = ($pd_value + $pr_array['criteria']);
4522
- $product_data[$pr_array['attribute']] = $newvalue;
4523
- break;
4524
- case($pr_array['condition'] = "minus"):
4525
- $newvalue = ($pd_value - $pr_array['criteria']);
4526
- $product_data[$pr_array['attribute']] = $newvalue;
4527
- break;
4528
- case($pr_array['condition'] = "findreplace"):
4529
- if (strpos($pd_value, $pr_array['criteria']) !== false){
4530
  // Make sure that a new value has been set
4531
- if(!empty($pr_array['newvalue'])){
4532
- // Find and replace only work on same attribute field, otherwise create a contains rule
4533
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4534
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4535
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4536
  }
4537
- }
4538
- }
4539
- break;
4540
- default:
4541
- break;
4542
- }
4543
- } elseif (is_array($pd_value)) {
4544
-
4545
- // For now only shipping details are in an array
4546
- foreach ($pd_value as $k => $v){
4547
- if(is_array($v)){
4548
- foreach ($v as $kk => $vv){
4549
- // Only shipping detail rule can be on price for now
4550
- if($kk == "price"){
4551
- switch ($pr_array['condition']) {
4552
- case($pr_array['condition'] = "contains"):
4553
- if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
4554
- $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
4555
- $product_data[$pr_array['than_attribute']] = $pd_value;
4556
- }
4557
- break;
4558
- case($pr_array['condition'] = "containsnot"):
4559
- if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
4560
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4561
- $product_data[$pr_array['than_attribute']] = $pd_value;
4562
- }
4563
- break;
4564
- case($pr_array['condition'] = "="):
4565
- if (($vv == $pr_array['criteria'])){
4566
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4567
- $product_data[$pr_array['than_attribute']] = $pd_value;
4568
- }
4569
- break;
4570
- case($pr_array['condition'] = "!="):
4571
- if (($vv != $pr_array['criteria'])){
4572
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4573
- $product_data[$pr_array['than_attribute']] = $pd_value;
4574
- }
4575
- break;
4576
- case($pr_array['condition'] = ">"):
4577
- if (($vv > $pr_array['criteria'])){
4578
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4579
- $product_data[$pr_array['than_attribute']] = $pd_value;
4580
- }
4581
- break;
4582
- case($pr_array['condition'] = ">="):
4583
- if (($vv >= $pr_array['criteria'])){
4584
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4585
- $product_data[$pr_array['than_attribute']] = $pd_value;
4586
- }
4587
- break;
4588
- case($pr_array['condition'] = "<"):
4589
- if (($vv < $pr_array['criteria'])){
4590
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4591
- $product_data[$pr_array['than_attribute']] = $pd_value;
4592
- }
4593
- break;
4594
- case($pr_array['condition'] = "=<"):
4595
- if (($vv <= $pr_array['criteria'])){
4596
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4597
- $product_data[$pr_array['than_attribute']] = $pd_value;
4598
- }
4599
- break;
4600
- case($pr_array['condition'] = "empty"):
4601
- if ((strlen($vv) < 1)){
4602
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4603
- $product_data[$pr_array['than_attribute']] = $pd_value;
4604
- }
4605
- break;
4606
- case($pr_array['condition'] = "multiply"):
4607
- // Only shipping array
4608
- if(is_array($pd_value)){
4609
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4610
- foreach ($pd_value as $ship_a_key => $shipping_arr){
4611
- foreach($shipping_arr as $ship_key => $ship_value){
4612
- if($ship_key == "price"){
4613
- $ship_pieces = explode(" ", $ship_value);
4614
- $pd_value = strtr($ship_pieces[1], ',', '.');
4615
- $newvalue = $pd_value*$pr_array['criteria'];
4616
- $newvalue = round($newvalue, 2);
4617
- $newvalue = strtr($newvalue, '.',',');
4618
- $newvalue = $ship_pieces[0]." ".$newvalue;
4619
- $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4620
- }
4621
- }
4622
- }
4623
- }
4624
- break;
4625
- default:
4626
- break;
4627
- }
4628
- }
4629
- }
4630
- } else {
4631
- // Rules on product tags
4632
- foreach ($pd_value as $k => $v){
4633
-
4634
- // Rules for string values
4635
- if (!array_key_exists('cs', $pr_array)){
4636
- $v = strtolower($v);
4637
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
4638
- }
4639
-
4640
- switch ($pr_array['condition']) {
4641
- case($pr_array['condition'] = "contains"):
4642
- if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
4643
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4644
- }
4645
- break;
4646
- case($pr_array['condition'] = "containsnot"):
4647
- if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
4648
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4649
- }
4650
- break;
4651
- case($pr_array['condition'] = "="):
4652
- if (($v == $pr_array['criteria'])){
4653
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4654
- }
4655
- break;
4656
- case($pr_array['condition'] = "!="):
4657
- if (($v != $pr_array['criteria'])){
4658
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4659
- }
4660
- break;
4661
- case($pr_array['condition'] = ">"):
4662
- if (($v > $pr_array['criteria'])){
4663
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4664
- }
4665
- break;
4666
- case($pr_array['condition'] = ">="):
4667
- if (($v >= $pr_array['criteria'])){
4668
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4669
- }
4670
- break;
4671
- case($pr_array['condition'] = "<"):
4672
- if (($v < $pr_array['criteria'])){
4673
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4674
- }
4675
- break;
4676
- case($pr_array['condition'] = "=<"):
4677
- if (($v <= $pr_array['criteria'])){
4678
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4679
- }
4680
- break;
4681
- case($pr_array['condition'] = "empty"):
4682
- if ((strlen($v) < 1)){
4683
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4684
- }
4685
- break;
4686
- case($pr_array['condition'] = "multiply"):
4687
- // Only shipping array
4688
- if(is_array($v)){
4689
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4690
- foreach ($v as $ship_a_key => $shipping_arr){
4691
- foreach($shipping_arr as $ship_key => $ship_value){
4692
- if($ship_key == "price"){
4693
- $ship_pieces = explode(" ", $ship_value);
4694
- $pd_value = strtr($ship_pieces[1], ',', '.');
4695
- $newvalue = $pd_value*$pr_array['criteria'];
4696
- $newvalue = round($newvalue, 2);
4697
- $newvalue = strtr($newvalue, '.',',');
4698
- $newvalue = $ship_pieces[0]." ".$newvalue;
4699
- $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4700
- }
4701
- }
4702
- }
4703
- }
4704
- break;
4705
- default:
4706
- break;
4707
- }
4708
- }
4709
- }
4710
- }
4711
- } else {
4712
- // Rules for string values
4713
- if (!array_key_exists('cs', $pr_array)){
4714
- $pd_value = strtolower($pd_value);
4715
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
4716
- }
4717
-
4718
- switch ($pr_array['condition']) {
4719
- case($pr_array['condition'] = "contains"):
4720
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4721
- // Specifically for shipping price rules
4722
- if(!empty($product_data[$pr_array['than_attribute']])){
4723
- if(is_array($product_data[$pr_array['than_attribute']])){
4724
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4725
- for ($x = 0; $x <= $arr_size; $x++) {
4726
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4727
- }
4728
- } else {
4729
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4730
- }
4731
- } else {
4732
- // This attribute value is empty for this product
4733
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4734
- }
4735
- }
4736
- break;
4737
- case($pr_array['condition'] = "containsnot"):
4738
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4739
- // Specifically for shipping price rules
4740
- if(is_array($product_data[$pr_array['than_attribute']])){
4741
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4742
- for ($x = 0; $x <= $arr_size; $x++) {
4743
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4744
- }
4745
- } else {
4746
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4747
- }
4748
- }
4749
- break;
4750
- case($pr_array['condition'] = "="):
4751
- if (($pr_array['criteria'] == "$pd_value")){
4752
- // Specifically for shipping price rules
4753
- if(is_array($product_data[$pr_array['than_attribute']])){
4754
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4755
- for ($x = 0; $x <= $arr_size; $x++) {
4756
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4757
- }
4758
- } else {
4759
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4760
- }
4761
- }
4762
- $ship = $product_data['shipping'];
4763
- break;
4764
- case($pr_array['condition'] = "!="):
4765
- if (($pr_array['criteria'] != "$pd_value")){
4766
- // Specifically for shipping price rules
4767
- if(is_array($product_data[$pr_array['than_attribute']])){
4768
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4769
- for ($x = 0; $x <= $arr_size; $x++) {
4770
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4771
- }
4772
- } else {
4773
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4774
- }
4775
- }
4776
- break;
4777
- case($pr_array['condition'] = ">"):
4778
- // Use a lexical order on relational string operators
4779
- if (($pd_value > $pr_array['criteria'])){
4780
- // Specifically for shipping price rules
4781
- if(is_array($product_data[$pr_array['than_attribute']])){
4782
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4783
- for ($x = 0; $x <= $arr_size; $x++) {
4784
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4785
- }
4786
- } else {
4787
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4788
- }
4789
- }
4790
- break;
4791
- case($pr_array['condition'] = ">="):
4792
- // Use a lexical order on relational string operators
4793
- if (($pd_value >= $pr_array['criteria'])){
4794
- // Specifically for shipping price rules
4795
- if(is_array($product_data[$pr_array['than_attribute']])){
4796
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4797
- for ($x = 0; $x <= $arr_size; $x++) {
4798
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4799
- }
4800
- } else {
4801
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4802
- }
4803
- }
4804
- break;
4805
- case($pr_array['condition'] = "<"):
4806
- // Use a lexical order on relational string operators
4807
- if (($pd_value < $pr_array['criteria'])){
4808
- // Specifically for shipping price rules
4809
- if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
4810
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4811
- for ($x = 0; $x <= $arr_size; $x++) {
4812
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4813
- }
4814
- } else {
4815
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4816
- }
4817
- }
4818
- break;
4819
- case($pr_array['condition'] = "=<"):
4820
- // Use a lexical order on relational string operators
4821
- if (($pd_value <= $pr_array['criteria'])){
4822
- // Specifically for shipping price rules
4823
- if(is_array($product_data[$pr_array['than_attribute']])){
4824
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4825
- for ($x = 0; $x <= $arr_size; $x++) {
4826
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4827
- }
4828
- } else {
4829
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4830
- }
4831
- }
4832
- break;
4833
 
4834
- case($pr_array['condition'] = "empty"):
4835
- if(empty($product_data[$pr_array['attribute']])){
4836
- if(empty($product_data[$pr_array['than_attribute']])){
4837
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4838
- } else {
4839
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4840
- }
4841
- }
4842
- break;
4843
- case($pr_array['condition'] = "replace"):
4844
- $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
4845
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4846
  case($pr_array['condition'] = "findreplace"):
4847
  if (strpos($pd_value, $pr_array['criteria']) !== false){
4848
- // Make sure that a new value has been set
4849
- if(!empty($pr_array['newvalue'])){
4850
- // Find and replace only work on same attribute field, otherwise create a contains rule
4851
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4852
- $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4853
- $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4854
- }
4855
- }
4856
- }
 
4857
  break;
4858
- default:
4859
- break;
4860
- }
4861
- }
4862
- } else {
4863
- // When a rule has been set on an attribute that is not in product_data
4864
- // Add the newvalue to product_data
4865
- if (!array_key_exists($pr_array['attribute'], $product_data)){
4866
- if(!empty($pr_array['newvalue'])){
4867
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4868
- } else {
4869
- if(array_key_exists($pr_array['than_attribute'], $product_data)){
4870
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4871
- }
4872
- }
4873
- }
4874
- }
4875
- }
4876
- }
4877
- }
4878
- return $product_data;
4879
- }
4880
 
4881
  /**
4882
  * Function to exclude products based on individual product exclusions
@@ -4899,525 +5094,530 @@ class WooSEA_Get_Products {
4899
  }
4900
  }
4901
 
4902
- /**
4903
- * Execute project filters (include / exclude)
4904
- */
 
4905
  private function woocommerce_sea_filters( $project_rules, $product_data ){
4906
- $allowed = 1;
4907
 
4908
- // Check if product was already excluded from the feed
4909
- $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
4910
 
4911
- if( $product_excluded == "Yes"){
4912
- $allowed = 0;
4913
- }
4914
 
4915
- foreach ($project_rules as $pr_key => $pr_array){
4916
 
4917
- if($pr_array['attribute'] == "categories"){
4918
- $pr_array['attribute'] = "raw_categories";
4919
- }
4920
 
4921
- //if(array_key_exists($pr_array['attribute'], $product_data)){
4922
 
4923
- if(!array_key_exists($pr_array['attribute'], $product_data)) {
4924
- $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
4925
- }
4926
 
4927
- foreach ($product_data as $pd_key => $pd_value){
4928
- // Check is there is a rule on specific attributes
 
4929
 
4930
- if(in_array($pd_key, $pr_array, TRUE)){
 
 
 
4931
 
4932
- if($pd_key == "price"){
4933
- //$pd_value = @number_format($pd_value,2);
4934
- $pd_value = wc_format_decimal($pd_value);
4935
- }
4936
-
4937
- if (is_numeric($pd_value)){
4938
- $old_value = $pd_value;
4939
- if($pd_key == "price"){
4940
- $pd_value = @number_format($pd_value,2);
4941
- }
4942
-
4943
- // Rules for numeric values
4944
- switch ($pr_array['condition']) {
4945
- case($pr_array['condition'] = "contains"):
4946
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
4947
- $allowed = 0;
4948
- } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
4949
- $allowed = 0;
4950
- }
4951
- break;
4952
- case($pr_array['condition'] = "containsnot"):
4953
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
4954
- $allowed = 0;
4955
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
4956
- $allowed = 0;
4957
- }
4958
- break;
4959
  case($pr_array['condition'] = "="):
4960
- if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4961
- $allowed = 0;
4962
- } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4963
- $allowed = 0;
4964
- }
4965
- break;
4966
- case($pr_array['condition'] = "!="):
4967
- if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4968
- if($allowed <> 0){
4969
- $allowed = 1;
4970
- }
4971
- } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4972
- $allowed = 0;
4973
- }
4974
- break;
4975
- case($pr_array['condition'] = ">"):
4976
- if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4977
- $allowed = 0;
4978
- } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4979
- $allowed = 0;
4980
- }
4981
- break;
4982
- case($pr_array['condition'] = ">="):
4983
- if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4984
- $allowed = 0;
4985
- } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4986
- $allowed = 0;
4987
- }
4988
- break;
4989
- case($pr_array['condition'] = "<"):
4990
- if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4991
- $allowed = 0;
4992
- } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4993
- $allowed = 0;
4994
- }
4995
- break;
4996
- case($pr_array['condition'] = "=<"):
4997
- if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4998
- $allowed = 0;
4999
- } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5000
- $allowed = 0;
5001
  }
5002
- break;
5003
- case($pr_array['condition'] = "empty"):
5004
- if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5005
- $allowed = 0;
5006
- } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5007
- $allowed = 0;
5008
- }
5009
- break;
5010
- default:
5011
- break;
5012
- }
5013
- } elseif (is_array($pd_value)){
5014
- // Tis can either be a shipping or product_tag array
5015
- if($pr_array['attribute'] == "product_tag"){
5016
- $in_tag_array = "not";
5017
-
5018
- foreach($pd_value as $pt_key => $pt_value){
5019
- // Rules for string values
5020
- if (!array_key_exists('cs', $pr_array)){
5021
- $pt_value = strtolower($pt_value);
5022
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
5023
- }
5024
-
5025
- if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5026
- $in_tag_array = "yes";
5027
- }
5028
- }
5029
-
5030
- if($in_tag_array == "yes"){
5031
- //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5032
- $v = $pr_array['criteria'];
5033
-
5034
- switch ($pr_array['condition']) {
5035
- case($pr_array['condition'] = "contains"):
5036
- if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5037
- if($pr_array['than'] == "include_only"){
5038
- if($allowed <> 0){
5039
- $allowed = 1;
5040
- }
5041
- } else {
5042
- $allowed = 0;
5043
- }
5044
- } else {
5045
- $allowed = 0;
5046
- }
5047
- break;
5048
- case($pr_array['condition'] = "containsnot"):
5049
- if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5050
- if($pr_array['than'] == "include_only"){
5051
- if($allowed <> 0){
5052
- $allowed = 1;
5053
- }
5054
- } else {
5055
- $allowed = 0;
5056
- }
5057
- } else {
5058
- $allowed = 0;
5059
- }
5060
- break;
5061
- case($pr_array['condition'] = "="):
5062
- if (($v == $pr_array['criteria'])){
5063
- if($pr_array['than'] == "include_only"){
5064
- if($allowed <> 0){
5065
- $allowed = 1;
5066
- }
5067
- } else {
5068
- $allowed = 0;
5069
- }
5070
- } else {
5071
- $allowed = 0;
5072
- }
5073
- break;
5074
- case($pr_array['condition'] = "!="):
5075
- if (($v != $pr_array['criteria'])){
5076
- if($pr_array['than'] == "include_only"){
5077
- if($allowed <> 0){
5078
- $allowed = 1;
5079
- }
5080
- } else {
5081
- $allowed = 0;
5082
- }
5083
- }
5084
- break;
5085
- case($pr_array['condition'] = ">"):
5086
- if (($v > $pr_array['criteria'])){
5087
- if($pr_array['than'] == "include_only"){
5088
- if($allowed <> 0){
5089
- $allowed = 1;
5090
- }
5091
- } else {
5092
- $allowed = 0;
5093
- }
5094
- }
5095
- break;
5096
- case($pr_array['condition'] = ">="):
5097
- if (($v >= $pr_array['criteria'])){
5098
- if($pr_array['than'] == "include_only"){
5099
- if($allowed <> 0){
5100
- $allowed = 1;
5101
- }
5102
- } else {
5103
- $allowed = 0;
5104
- }
5105
- }
5106
- break;
5107
- case($pr_array['condition'] = "<"):
5108
- if (($v < $pr_array['criteria'])){
5109
- if($pr_array['than'] == "include_only"){
5110
- if($allowed <> 0){
5111
- $allowed = 1;
5112
- }
5113
- } else {
5114
- $allowed = 0;
5115
- }
5116
- }
5117
- break;
5118
- case($pr_array['condition'] = "=<"):
5119
- if (($v <= $pr_array['criteria'])){
5120
- if($pr_array['than'] == "include_only"){
5121
- if($allowed <> 0){
5122
- $allowed = 1;
5123
- }
5124
- } else {
5125
- $allowed = 0;
5126
- }
5127
- }
5128
- break;
5129
- case($pr_array['condition'] = "empty"):
5130
- if (strlen($v) < 1){
5131
- if($pr_array['than'] == "include_only"){
5132
- if($allowed <> 0){
5133
- $allowed = 1;
5134
- }
5135
- } else {
5136
- $allowed = 0;
5137
- }
5138
- }
5139
- break;
5140
- default:
5141
- break;
5142
- }
5143
- } else {
5144
- switch ($pr_array['condition']) {
5145
- case($pr_array['condition'] = "contains"):
5146
- if($pr_array['than'] == "include_only"){
5147
- $allowed = 0;
5148
- } else {
5149
- if($allowed <> 0){
5150
- $allowed = 1;
5151
- }
5152
- }
5153
- break;
5154
- case($pr_array['condition'] = "containsnot"):
5155
- if($pr_array['than'] == "include_only"){
5156
- if($allowed <> 0){
5157
- $allowed = 1;
5158
- }
5159
- } else {
5160
- $allowed = 0;
5161
- }
5162
- break;
5163
- case($pr_array['condition'] = "="):
5164
- if($pr_array['than'] == "include_only"){
5165
- $allowed = 0;
5166
- } else {
5167
- if($allowed <> 0){
5168
- $allowed = 1;
5169
- }
5170
- }
5171
- break;
5172
- case($pr_array['condition'] = "!="):
5173
- if($pr_array['than'] == "include_only"){
5174
- if($allowed <> 0){
5175
- $allowed = 1;
5176
- }
5177
- } else {
5178
- $allowed = 0;
5179
- }
5180
- break;
5181
- case($pr_array['condition'] = ">"):
5182
- if($pr_array['than'] == "include_only"){
5183
- $allowed = 0;
5184
- } else {
5185
- $allowed = 0;
5186
- }
5187
- break;
5188
- case($pr_array['condition'] = ">="):
5189
- if($pr_array['than'] == "include_only"){
5190
- $allowed = 0;
5191
- } else {
5192
- $allowed = 0;
5193
- }
5194
- break;
5195
- case($pr_array['condition'] = "<"):
5196
- if($pr_array['than'] == "include_only"){
5197
- $allowed = 0;
5198
- } else {
5199
- $allowed = 0;
5200
- }
5201
- break;
5202
- case($pr_array['condition'] = "=<"):
5203
- if($pr_array['than'] == "include_only"){
5204
- $allowed = 0;
5205
- } else {
5206
- $allowed = 0;
5207
- }
5208
- break;
5209
- case($pr_array['condition'] = "empty"):
5210
- if($pr_array['than'] == "include_only"){
5211
- if($allowed <> 0){
5212
- $allowed = 1;
5213
- }
5214
- } else {
5215
- $allowed = 0;
5216
- }
5217
- break;
5218
- default:
5219
- break;
5220
- }
5221
- }
5222
- } else {
5223
- // For now only shipping details are in an array
5224
- foreach ($pd_value as $k => $v){
5225
- foreach ($v as $kk => $vv){
5226
- // Only shipping detail rule can be on price for now
5227
- if($kk == "price"){
5228
- switch ($pr_array['condition']) {
5229
- case($pr_array['condition'] = "contains"):
5230
- if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5231
- $allowed = 0;
5232
- }
5233
- break;
5234
- case($pr_array['condition'] = "containsnot"):
5235
- if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5236
- $allowed = 0;
5237
- }
5238
- break;
5239
- case($pr_array['condition'] = "="):
5240
- if (($vv == $pr_array['criteria'])){
5241
- $allowed = 0;
5242
- }
5243
- break;
5244
- case($pr_array['condition'] = "!="):
5245
- if (($vv != $pr_array['criteria'])){
5246
- $allowed = 0;
5247
- }
5248
- break;
5249
- case($pr_array['condition'] = ">"):
5250
- if (($vv > $pr_array['criteria'])){
5251
- $allowed = 0;
5252
- }
5253
- break;
5254
- case($pr_array['condition'] = ">="):
5255
- if (($vv >= $pr_array['criteria'])){
5256
- $allowed = 0;
5257
- }
5258
- break;
5259
- case($pr_array['condition'] = "<"):
5260
- if (($vv < $pr_array['criteria'])){
5261
- $allowed = 0;
5262
- }
5263
- break;
5264
- case($pr_array['condition'] = "=<"):
5265
- if (($vv <= $pr_array['criteria'])){
5266
- $allowed = 0;
5267
- }
5268
- break;
5269
- case($pr_array['condition'] = "empty"):
5270
- if (strlen($vv) < 1){
5271
- $allowed = 0;
5272
- }
5273
- break;
5274
- default:
5275
- break;
5276
- }
5277
- }
5278
- }
5279
- }
5280
- }
5281
- } else {
5282
- // Filters for string values
5283
- // If case-sensitve is off than lowercase both the criteria and attribute value
5284
- if (array_key_exists('cs', $pr_array)){
5285
- if ($pr_array['cs'] != "on"){
5286
- $pd_value = strtolower($pd_value);
5287
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
5288
- }
5289
- }
5290
- $pos = strpos($pd_value, '&amp;');
5291
- $pos_slash = strpos($pr_array['criteria'], '\\');
5292
- if($pos !== false){
5293
- $pd_value = str_replace("&amp;","&",$pd_value);
5294
- }
5295
- if($pos_slash !== false){
5296
- $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5297
- }
5298
 
5299
- switch ($pr_array['condition']) {
5300
- case($pr_array['condition'] = "contains"):
5301
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5302
- $allowed = 0;
5303
- } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5304
- $allowed = 0;
5305
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5306
- if($allowed <> 0){
5307
- $allowed = 1;
5308
- }
5309
- }
5310
- break;
5311
- case($pr_array['condition'] = "containsnot"):
5312
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5313
- $allowed = 0;
5314
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5315
- $allowed = 0;
5316
- }
5317
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5318
  case($pr_array['condition'] = "="):
5319
- if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5320
- $allowed = 0;
5321
- } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
5322
- $found = strpos($pd_value,$pr_array['criteria']);
5323
- if ($found !== false) {
5324
- //for category mapping check if its an array
5325
- if($pr_array['attribute'] == "raw_categories"){
5326
- $raw_cats_arr = explode("||",$pd_value);
5327
- if(is_array($raw_cats_arr)){
5328
- if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
5329
- if($allowed <> 0){
5330
- $allowed = 1;
5331
- }
5332
- } else {
5333
- $allowed = 0;
5334
- }
5335
- }
5336
- } else {
5337
- if($allowed <> 0){
5338
- $allowed = 1;
5339
- }
5340
- }
5341
- } else {
5342
- $allowed = 0;
5343
- }
5344
- } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5345
- if($allowed <> 0){
5346
- $allowed = 1;
5347
- }
5348
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5349
- $allowed = 0;
5350
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5351
- $allowed = 1;
5352
- }
5353
- break;
5354
- case($pr_array['condition'] = "!="):
5355
- if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5356
- if($allowed <> 0){
5357
- $allowed = 1;
5358
- }
5359
- } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5360
- $allowed = 0;
5361
- } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
5362
- $allowed = 0;
5363
- }
5364
- break;
5365
- case($pr_array['condition'] = ">"):
5366
- // Use a lexical order on relational string operators
5367
- if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5368
  $allowed = 0;
5369
- } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5370
- $allowed = 0;
5371
- }
5372
- break;
5373
- case($pr_array['condition'] = ">="):
5374
- // Use a lexical order on relational string operators
5375
- if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5376
- $allowed = 0;
5377
- } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5378
- $allowed = 0;
5379
- }
5380
- break;
5381
- case($pr_array['condition'] = "<"):
5382
- // Use a lexical order on relational string operators
5383
- if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5384
- $allowed = 0;
5385
- } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5386
- $allowed = 0;
5387
- }
5388
- break;
5389
- case($pr_array['condition'] = "=<"):
5390
- // Use a lexical order on relational string operators
5391
- if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5392
- $allowed = 0;
5393
- } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5394
- $allowed = 0;
5395
- }
5396
- break;
5397
- case($pr_array['condition'] = "empty"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5398
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5399
- $allowed = 0;
5400
- } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
5401
- if($allowed <> 0){
5402
- $allowed = 1;
5403
- }
5404
- } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
5405
- $allowed = 0;
5406
- }
5407
- break;
5408
- default:
5409
- break;
5410
- }
5411
- }
5412
- }
5413
- }
5414
- }
5415
 
5416
- if ($allowed < 1){
5417
- $product_data = array();
5418
- $product_data = null;
5419
- } else {
5420
- return $product_data;
5421
- }
5422
- }
5423
  }
26
  return "<![CDATA[ $string ]]>";
27
  }
28
 
 
29
  /**
30
  * Check if a plugin is active
31
  */
56
  * Get all approved product review comments for Google's Product Review Feeds
57
  */
58
  public function woosea_get_reviews ( $product_data, $product ) {
59
+ // Rwviews for the parent variable product itself can be skipped, the review is added for the variation
60
+ if($product_data['product_type'] == "variable"){
61
+ return;
62
+ }
63
+
64
  $approved_reviews = array();
65
  $prod_id = $product_data['id'];
66
 
77
 
78
  // Loop through all product reviews for this specific products (ternary operators)
79
  foreach($reviews as $review_raw){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
+ // Only reviews that are approved will make it to the feed
82
+ if($review_raw->comment_approved == 1){
83
+
84
+ $review = array();
85
+ $review['review_reviewer_image'] = empty($product_data['reviewer_image']) ? '' : $product_data['reviewer_image'];
86
+ $review['review_ratings'] = get_comment_meta( $review_raw->comment_ID, 'rating', true);
87
+ $review['review_id'] = $review_raw->comment_ID;
88
+
89
+ // Names need to be anonomyzed
90
+ $name_pieces = explode(" ", $review_raw->comment_author);
91
+ $nr_name_pieces = count($name_pieces);
92
+ $cnt = 0;
93
+ $name = "";
94
+ foreach($name_pieces as $n_piece){
95
+ $n_piece = str_replace("&amp;", "", $n_piece);
96
+
97
+ if($cnt > 0){
98
+ $n_piece = ucfirst(substr($n_piece, 0, 1));
99
+ }
100
+ $name .= $n_piece." ";
101
+ $cnt++;
102
+ }
103
+
104
+ // Remove strange charachters from reviewer name
105
+ $review['reviewer_name'] = $this->rip_tags(trim(ucfirst($name)));
106
+ $review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
107
+ $review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
108
+ $review['reviewer_name'] = str_replace("&#xa0;", "", $review['reviewer_name']);
109
+ $review['reviewer_name'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
110
+
111
+ $review['reviewer_id'] = $review_raw->user_id;
112
+ $review['review_timestamp'] = $review_raw->comment_date;
113
+
114
+ // Remove strange characters from review title
115
+ $review['title'] = empty($product_data['title']) ? '' : $product_data['title'];
116
+ $review['title'] = $this->rip_tags($review['title']);
117
+ $review['title'] = html_entity_decode((str_replace("\r", "", $review['title'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
118
+ $review['title'] = preg_replace( '/\[(.*?)\]/', ' ', $review['title'] );
119
+ $review['title'] = str_replace("&#xa0;", "", $review['title']);
120
+ $review['title'] = $this->woosea_utf8_for_xml( $review['title'] );
121
+
122
+ // Remove strange charchters from review content
123
+ $review['content'] = $review_raw->comment_content;
124
+ $review['content'] = $this->rip_tags($review['content']);
125
+ $review['content'] = html_entity_decode((str_replace("\r", "", $review['content'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
126
+ $review['content'] = preg_replace( '/\[(.*?)\]/', ' ', $review['content'] );
127
+ $review['content'] = str_replace("&#xa0;", "", $review['content']);
128
+ $review['content'] = $this->woosea_utf8_for_xml( $review['content'] );
129
+
130
+ $review['review_product_name'] = $product_data['title'];
131
+ $review['review_url'] = $product_data['link'];
132
+ $review['review_product_url'] = $product_data['link'];
133
+ array_push($approved_reviews, $review);
134
+ }
135
  }
136
  $review_count = $product->get_review_count();
137
  $review_average = $product->get_average_rating();
185
  if($feed_config['fields'] == "google_drm"){
186
  $utm_part .= "&$key=$value";
187
  } else {
188
+ $utm_part .= "&$key=$value";
189
  }
190
  }
191
 
211
  if($parentId > 0){
212
  # Even though variation products always have parameters in the URL we still need to check and make sure they are there
213
  if(strpos($link, '?') !== false){
214
+ $utm_part = "&".ltrim($utm_part, '&amp;');
215
  } else {
216
  $utm_part = "?".ltrim($utm_part, '&amp;');
217
  }
335
  /**
336
  * Get category path (needed for Prisjakt)
337
  */
338
+ public function woosea_get_term_parents( $id, $taxonomy, string $link = null, $project_taxonomy, $nicename = false, $visited = array() ) {
339
  // Only add Home to the beginning of the chain when we start buildin the chain
340
  if(empty($visited)){
341
  $chain = 'Home';
374
  return $chain;
375
  }
376
 
377
+ /**
378
+ * Create a floatval for prices
379
+ */
380
+ public function woosea_floatvalue($val){
381
+ $val = str_replace(",",".",$val);
382
+ $val = preg_replace('/\.(?=.*\.)/', '', $val);
383
+ return floatval($val);
384
+ }
385
+
386
  /**
387
  * Get all configured shipping zones
388
  */
732
  $shipping_methods = $zone['shipping_methods'];
733
 
734
  foreach ($shipping_methods as $k => $v){
735
+ $method = $v->method_title;
736
+ $shipping_rate_id = $v->instance_id;
737
 
738
  if($v->enabled == "yes"){
739
  if(empty($zone_details['country'])){
777
  }
778
 
779
  // WooCommerce Table Rate Bolder Elements
780
+ if($method == "Table Rate"){
781
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
782
+ // Set shipping cost
783
+ $shipping_cost = 0;
784
+ if(!empty($product_id)){
785
+ // Add product to cart
786
+ if ((isset($product_id)) AND ($product_id > 0)){
787
+ $quantity = 1;
788
+ if(!empty($code_from_config)){
789
+ defined( 'WC_ABSPATH' ) || exit;
790
+
791
+ // Load cart functions which are loaded only on the front-end.
792
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
793
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
794
+
795
  wc_load_cart();
796
 
797
  WC()->customer->set_shipping_country( $code_from_config );
809
  // Read cart and get schipping costs
810
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
811
  $total_cost = WC()->cart->get_total();
812
+ $shipping_cost = WC()->cart->get_shipping_total();
813
+ $shipping_tax = WC()->cart->get_shipping_tax();
814
+ $shipping_cost = ($shipping_cost+$shipping_tax);
815
  $shipping_cost = wc_format_localized_price($shipping_cost);
816
+ }
 
817
  // Make sure to empty the cart again
818
  WC()->cart->empty_cart();
819
+ }
820
+ }
821
+ }
822
+ }
823
+ }
824
+
825
+ // Official WooCommerce Table Rate plugin
826
+ if($method == "Table rates"){
827
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
828
+ // Set shipping cost
829
+ $shipping_cost = 0;
830
+ if(!empty($product_id)){
831
+ // Add product to cart
832
+ if ((isset($product_id)) AND ($product_id > 0)){
833
+ $quantity = 1;
834
+ if(!empty($code_from_config)){
835
+ defined( 'WC_ABSPATH' ) || exit;
836
+
837
+ // Load cart functions which are loaded only on the front-end.
838
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
839
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
840
+
841
+ wc_load_cart();
842
+
843
+ WC()->shipping()->reset_shipping();
844
+ WC()->customer->set_shipping_country( $code_from_config );
845
+
846
+ if(isset($zone_details['region'])){
847
+ WC()->customer->set_shipping_state(wc_clean( $zone_details['region'] ));
848
+ }
849
+
850
+ if(isset($zone_details['postal_code'])){
851
+ WC()->customer->set_shipping_postcode(wc_clean( $zone_details['postal_code'] ));
852
+ }
853
+ WC()->cart->add_to_cart( $product_id, $quantity );
854
+
855
+ // Read cart and get schipping costs
856
+ foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
857
+ // Loop though shipping packages
858
+ foreach ( WC()->shipping->get_packages() as $key => $package ) {
859
+ // Loop through Shipping rates
860
+ foreach($package['rates'] as $rate_id => $rate ){
861
+
862
+ if($rate->instance_id == $shipping_rate_id){
863
+ $shipping_cost = $rate->cost;
864
+ }
865
+ }
866
+ }
867
+ $shipping_tax = WC()->cart->get_shipping_tax();
868
+ $shipping_cost = ($shipping_cost+$shipping_tax);
869
+ $shipping_cost = wc_format_localized_price($shipping_cost);
870
+ }
871
+
872
+ // Make sure to empty the cart again
873
+ WC()->cart->empty_cart();
874
+ }
875
+ }
876
+ }
877
+ }
878
+ }
879
 
880
  // CLASS SHIPPING COSTS
881
  if((isset($v->instance_settings[$class_cost_id])) AND ($class_cost_id != "no_class_cost")){
1009
  unset($shipping_cost);
1010
  }
1011
  }
1012
+
1013
+ // User do not want to have free shipping in their feed
1014
+ $remove_free_shipping = "no";
1015
+ $remove_free_shipping = get_option ('remove_free_shipping');
1016
+
1017
+ if($remove_free_shipping == "yes"){
1018
+ unset($zone_details['service']);
1019
+ unset($zone_details['price']);
1020
+ unset($shipping_cost);
1021
+ }
1022
  }
1023
 
1024
  if(isset($zone_details)){
1045
  $zone_details['price'] = trim($shipping_cost);
1046
  }
1047
  } else {
 
1048
  if(isset($shipping_cost)){
1049
  $zone_details['price'] = trim($currency." ".$shipping_cost);
1050
  }
 
 
1051
  }
1052
  }
1053
  }
1077
 
1078
  // Remove other shipping classes when free shipping is relevant
1079
  $free_check = "yes";
 
1080
 
1081
  if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
1082
  foreach($shipping_arr as $k => $v) {
1083
  if(!in_array($free_check, $v)){
1084
+
1085
+ // User do not want to have free shipping in their feed
1086
+ // Only remove the other shipping classes when free shipping is not being removed
1087
+ $remove_free_shipping = "no";
1088
+ $remove_free_shipping = get_option ('remove_free_shipping');
1089
+
1090
+ if($remove_free_shipping == "no"){
1091
+ unset($shipping_arr[$k]);
1092
+ }
1093
  }
1094
  }
1095
  }
1097
  // Fix empty services
1098
  foreach($shipping_arr as $k => $v){
1099
  if(empty($v['service'])){
 
 
1100
  unset($shipping_arr[$k]);
1101
  }
1102
  }
1235
  } elseif (preg_match("/g:product_detail/i",$k)){
1236
  if(!empty($v)){
1237
  $product_detail_split = explode("#", $v);
1238
+ $detail_complete = count($product_detail_split);
1239
+ if($detail_complete == 2){
1240
+ $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1241
+ $name = str_replace("_", " ", $product_detail_split[0]);
1242
+
1243
+ $section_name = explode(":", $name);
1244
+ $section_name_start = ucfirst($section_name[0]);
1245
+ $name = ucfirst(trim($section_name[1]));
1246
+
1247
+ $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1248
+ $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1249
+ $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
1250
+ }
1251
  }
1252
  } elseif ($k == "g:installment"){
1253
  if(!empty($v)){
1448
 
1449
  // For Google Product review template
1450
  if (($feed_config['name'] == "Google Product Review") AND (empty($xml->channel))) {
1451
+
1452
+ if(!is_bool($xml)){
1453
+ $product = $xml->addChild('reviews');
1454
 
1455
+ foreach ($products as $key => $value){
1456
 
1457
+ $expl = "||";
1458
+ if(strpos($value['reviews'], $expl)) {
1459
+ $review_data = explode("||", $value['reviews']);
1460
+ foreach($review_data as $rk => $rv){
1461
 
1462
+ $review_comp = explode(":::", $rv);
1463
+ $nr_reviews = count($review_comp);
1464
 
1465
+ if($nr_reviews > 1){
1466
+ $productz = $xml->reviews->addChild('review');
1467
 
1468
+ foreach($review_comp as $rck => $rcv){
1469
+ $nodes = explode("##", $rcv);
1470
+ $nodes = str_replace("::", "", $nodes);
1471
 
1472
+ if($nodes[0] == "REVIEW_RATINGS"){
1473
+ // Do nothing
1474
+ } elseif($nodes[0] == "REVIEW_URL"){
1475
+ $rev_url = $productz->addChild(strtolower($nodes[0]), htmlspecialchars($nodes[1]));
1476
+ $rev_url->addAttribute('type', 'singleton');
1477
+ } elseif(($nodes[0] == "REVIEWER_NAME") OR ($nodes[0] == "REVIEWER_ID")){
1478
+ if(isset($productz->reviewer)){
1479
+ if($nodes[0] == "REVIEWER_NAME"){
1480
+ $name = $nodes[1];
1481
+ if(empty($name)){
1482
+ $reviewer->addChild('name','Anonymous');
1483
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1484
+ } else {
1485
+ $reviewer->addChild('name',$name);
1486
+ }
1487
  } else {
1488
+ if(is_numeric($nodes[1])){
1489
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1490
+ }
1491
  }
1492
  } else {
1493
+ $reviewer = $productz->addChild('reviewer');
1494
+ if($nodes[0] == "REVIEWER_NAME"){
1495
+ $name = $nodes[1];
1496
+ if(empty($name)){
1497
+ $reviewer->addChild('name','Anonymous');
1498
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1499
+ } else {
1500
+ $reviewer->addChild('name',$name);
1501
+ }
1502
  } else {
1503
+ if(is_numeric($nodes[1])){
1504
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1505
+ }
1506
  }
 
 
1507
  }
1508
+ } else {
1509
+ if(isset($nodes[1])){
1510
+ $content = html_entity_decode($nodes[1]);
1511
+ $content = htmlspecialchars($content);
1512
+ $rev = $productz->addChild(strtolower($nodes[0]), $content);
1513
+ }
1514
  }
1515
  }
 
1516
 
1517
+ foreach($review_comp as $rck => $rcv){
1518
+ $nodes = explode("##", $rcv);
1519
+ $nodes = str_replace("::", "", $nodes);
1520
 
1521
+ if($nodes[0] == "REVIEW_RATINGS"){
1522
+ $rev = $productz->addChild('ratings');
1523
+ $over = $productz->ratings->addChild('overall', $nodes[1]);
1524
+ $over->addAttribute('min', '1');
1525
+ $over->addAttribute('max', '5');
1526
+ }
1527
  }
 
 
1528
 
1529
+ $yo = $productz->addChild('products');
1530
+ $po = $yo->addChild('product');
1531
 
1532
+ $identifiers = array("gtin","mpn","sku","brand");
1533
 
1534
+ // Start determining order of product_ids in the Google review feed
1535
+ $proper_order = array("product_name","gtin","mpn","sku","brand","product_url","review_url","reviews");
1536
+ $order_sorted = array();
1537
+ foreach ($proper_order as &$order_value){
1538
+ if(isset($value[$order_value])){
1539
+ $order_sorted[$order_value] = $value[$order_value];
1540
+ }
1541
  }
1542
+ // End
1543
+
1544
+ foreach($order_sorted as $k => $v) {
1545
+ if(($k != "product_name") AND ($k != "product_url")){
1546
+ if(!in_array($k, $identifiers)){
1547
+ if(($k != "reviews") AND ($k != "review_url")){
1548
+ $v = str_replace("&", "and", $v);
1549
+ $poa = $po->addChild($k,htmlspecialchars($v));
1550
+ }
1551
+ } else {
1552
+ if(isset($po->product_ids)){
1553
+ if ($k == "gtin"){
1554
+ $poig = $poi->addChild('gtins');
1555
+ $poig->$k = $v;
1556
+ } elseif ($k == "mpn"){
1557
+ $poim = $poi->addChild('mpns');
1558
+ $poim->$k = $v;
1559
+ } elseif ($k == "sku"){
1560
+ $poix = $poi->addChild('skus');
1561
+ $poix->$k = $v;
1562
+ } elseif($k == "brand"){
1563
+ $poib = $poi->addChild('brands');
1564
+ $poib->$k = $v;
1565
+ } else {
1566
+ // Do nothing
1567
+ }
1568
+ } else {
1569
+ $poi = $po->addChild('product_ids');
1570
+ if ($k == "gtin"){
1571
+ $poig = $poi->addChild('gtins');
1572
+ $poig->$k = $v;
1573
+ } elseif ($k == "mpn"){
1574
+ $poim = $poi->addChild('mpns');
1575
+ $poim->$k = $v;
1576
+ } elseif ($k == "sku"){
1577
+ $poix = $poi->addChild('skus');
1578
+ $poix->$k = $v;
1579
+ } elseif($k == "brand"){
1580
+ $poib = $poi->addChild('brands');
1581
+ $poib->$k = $v;
1582
+ } else {
1583
+ // Do nothing
1584
+ }
1585
  }
1586
+ }
1587
+ }
1588
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1589
 
1590
+ // foreach for product name and product url as order seems to mather to Google
1591
+ foreach($value as $k => $v) {
1592
+ if(($k == "product_name") OR ($k == "product_url")){
1593
+ if(!in_array($k, $identifiers)){
1594
+ if(($k != "reviews") AND ($k != "review_url")){
1595
+ $v = str_replace("&", "and", $v);
1596
+ $poa = $po->addChild($k,htmlspecialchars($v));
1597
+ }
1598
+ } else {
1599
+ if(isset($po->product_ids)){
1600
+ if ($k == "gtin"){
1601
+ $poig = $poi->addChild('gtins');
1602
+ $poig->$k = $v;
1603
+ } elseif ($k == "mpn"){
1604
+ $poim = $poi->addChild('mpns');
1605
+ $poim->$k = $v;
1606
+ } elseif($k == "sku"){
1607
+ $poix = $poi->addChild('skus');
1608
+ $poix->$k = $v;
1609
+ } elseif($k == "brand"){
1610
+ $poib = $poi->addChild('brands');
1611
+ $poib->$k = $v;
1612
+ } else {
1613
+ // Do nothing
1614
+ }
1615
+ } else {
1616
+ $poi = $po->addChild('product_ids');
1617
+ if ($k == "gtin"){
1618
+ $poig = $poi->addChild('gtins');
1619
+ $poig->$k = $v;
1620
+ } elseif ($k == "mpn"){
1621
+ $poim = $poi->addChild('mpns');
1622
+ $poim->$k = $v;
1623
+ } elseif ($k == "sku"){
1624
+ $poix = $poi->addChild('skus');
1625
+ $poix->$k = $v;
1626
+ } elseif($k == "brand"){
1627
+ $poib = $poi->addChild('brands');
1628
+ $poib->$k = $v;
1629
+ } else {
1630
+ // Do nothing
1631
+ }
1632
  }
1633
+ }
1634
+ }
1635
+ }
1636
+ }
1637
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1638
  }
1639
  }
1640
  }
2092
  $xml_piece = "";
2093
 
2094
  // Get taxonomies
2095
+ $no_taxonomies = array("element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
2096
  $taxonomies = get_taxonomies();
2097
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
2098
 
2424
  $product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
2425
  $product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
2426
 
2427
+ // Parent variable description
2428
+ $product_data['mother_description'] = $product_data['description'];
2429
+ $product_data['mother_short_description'] = $product_data['short_description'];
2430
+
2431
  /**
2432
  * Check of we need to add Google Analytics UTM parameters
2433
  */
2453
  if(empty($product_data['condition']) || $product_data['condition'] == "Array"){
2454
  $product_data['condition'] = "New";
2455
  }
2456
+
2457
+ // get_stock only works as of WC 5 and higher?
2458
  $product_data['availability'] = $this->get_stock( $this->childID );
2459
 
2460
  /**
2463
  * Therefor, we need to check the stock_status and overwrite te availability value
2464
  */
2465
  $stock_status = $product->get_stock_status();
2466
+ $product_data['stock_status'] = $stock_status;
2467
  if ($stock_status == "outofstock"){
2468
  $product_data['availability'] = "out of stock";
2469
  } elseif ($stock_status == "onbackorder") {
2545
  }
2546
 
2547
  $product_data['shipping_label'] = $product->get_shipping_class();
2548
+ $term = get_term_by( 'slug', $product->get_shipping_class(), 'product_shipping_class' );
2549
+ if(is_object($term)){
2550
+ $product_data['shipping_label_name'] = $term->name;
2551
+ }
2552
 
2553
  // Get product prices
2554
  $product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2559
  $product_data['regular_price'] = wc_format_decimal($product_data['regular_price'],2);
2560
 
2561
  // Untouched raw system pricing - DO NOT CHANGE THESE
2562
+ $float_system_net_price = floatval(wc_get_price_excluding_tax( $product ));
2563
+ $product_data['system_net_price'] = round($float_system_net_price, 2);
2564
+ $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2565
+ $float_system_regular_price = floatval($product->get_regular_price());
2566
+ $product_data['system_regular_price'] = round($float_system_regular_price,2);
2567
  $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2568
 
2569
  $product_data['system_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2597
  if($product->get_type() == "bundle"){
2598
  if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
2599
  $product_data['price'] = get_post_meta($product_data['id'], '_price', true);
2600
+ $product_data['sale_price'] = get_post_meta($product_data['id'], '_sale_price', true);
2601
  if(is_numeric($tax_rates[1]['rate'])){
2602
  $product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2603
  $product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2683
  $product_data['net_sale_price'] = "";
2684
  }
2685
  }
2686
+ $float_net_price = floatval(wc_get_price_excluding_tax( $product ));
2687
+ $product_data['net_price'] = round($float_net_price, 2);
2688
+ $product_data['net_price'] = wc_format_decimal($product_data['net_price'],2);
2689
+
2690
  $price = wc_get_price_including_tax($product,array('price'=> $product->get_price()));
2691
  if($product_data['sale_price'] > 0){
2692
  $price = $product_data['sale_price'];
2697
  $discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $product_data['sale_price'], 'discounted_price', true, true);
2698
  if($discount !== false){
2699
  $product_data['sale_price'] = $discount;
2700
+ $product_data['price'] = $discount;
2701
  $price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
2702
  if($price_incl_tax == "yes"){
2703
  $product_data['price_forced'] = $product_data['price']*($fullrate/100);
2813
  $product_data['sale_price'] = wc_format_localized_price($product_data['sale_price']);
2814
  if($product->get_price()){
2815
  $product_data['price_forced'] = wc_format_localized_price($product_data['price_forced']);
2816
+ //$product_data['price_forced'] = (float)$product_data['price_forced'];
2817
+ //$product_data['price_forced_rounded'] = round($product_data['price_forced'],0);
2818
  }
2819
  if($product->get_regular_price()){
2820
  $product_data['regular_price_forced'] = wc_format_localized_price($product_data['regular_price_forced']);
2821
+ //$product_data['regular_price_forced'] = (float)$product_data['regular_price_forced'];
2822
+ //$product_data['regular_price_forced_rounded'] = round($product_data['regular_price_forced'],0);
2823
  }
2824
  if($product->get_sale_price()){
2825
  $product_data['sale_price_forced'] = wc_format_localized_price($product_data['sale_price_forced']);
2826
+ //$product_data['sale_price_forced_rounded'] = round($product_data['sale_price_forced'],0);
2827
+
2828
  }
2829
  $product_data['net_price'] = wc_format_localized_price($product_data['net_price']);
2830
 
2844
  $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
2845
 
2846
  // Add rounded price options
2847
+ $float_price = floatval($product_data['price']);
2848
+ $float_regular_price = floatval($product_data['regular_price']);
2849
+ $float_sale_price = floatval($product_data['sale_price']);
2850
+ $product_data['rounded_price'] = round($float_price,0);
2851
+ $product_data['rounded_regular_price'] = round($float_regular_price,0);
2852
+ $product_data['rounded_sale_price'] = round($float_sale_price,0);
2853
 
2854
  // Calculate discount percentage
2855
  if($product_data['sale_price'] > 0){
2867
  }
2868
  }
2869
 
2870
+ if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi") OR ($project_config['fields'] == "customfeed")){
2871
  $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
2872
  $shipping_str = $product_data['shipping'];
2873
  }
2963
 
2964
  foreach($diff_taxonomies as $taxo){
2965
  $term_value = get_the_terms($product_data['id'], $taxo);
2966
+ $product_data["$taxo"] = "";
2967
 
2968
  if(is_array($term_value)){
2969
  // Do not add variation values to the feed when they are out of stock
2973
  $variations = $product_skroutz->get_available_variations();
2974
  $variations_id = wp_list_pluck( $variations, 'variation_id' );
2975
  $skroutz_att_array = array();
2976
+
2977
  foreach($variations_id as $var_id){
2978
  $stock_value = get_post_meta( $var_id, "_stock_status", true );
2979
  if($stock_value == "instock"){
2987
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
2988
  }
2989
  }
 
2990
  foreach($skroutz_att_array as $skrtz_value){
2991
  $product_data[$taxo] .= ",". $skrtz_value;
2992
  }
3101
  $data = $wpdb->get_results($sql);
3102
  if (count($data)) {
3103
  foreach ($data as $key => $value) {
3104
+ $value_display = str_replace("_", " ",$value->name);
3105
  if (preg_match("/_product_attributes/i",$value->name)){
3106
  $product_attr = unserialize($value->type);
3107
  if(!empty($product_attr)){
3119
 
3120
  /**
3121
  * Get Product Attributes for Single products
3122
+ * These are the attributes users create themselves in WooCommerce
3123
  */
3124
+ if (($product->is_type('simple')) OR ($product->is_type('external')) OR ($product->is_type('mix-and-match')) OR ($product->is_type('bundle')) OR ($product->is_type('composite')) OR ($product->is_type('auction') OR ($product->is_type('subscription')) OR ($product->is_type('variable')))){
3125
  $single_attributes = $product->get_attributes();
 
3126
  foreach ($single_attributes as $attribute){
3127
+ $attr_name = strtolower($attribute->get_name());
3128
+ $attr_value = $product->get_attribute($attr_name);
3129
+ $product_data[$attr_name] = $attr_value;
3130
  }
3131
  }
3132
 
3152
  $product_variations = new WC_Product_Variation( $product_data['id'] );
3153
  $variations = $product_variations->get_variation_attributes();
3154
 
3155
+ // For Skroutz and Bestprice apparal products we can only append colours to the product name
3156
  // When a product has both a size and color attribute we assume its an apparal product
3157
+ if(($project_config['fields'] == "skroutz") OR ($project_config['fields'] == "bestprice")){
3158
  $size_found = "no";
3159
  $color_found = "no";
3160
 
3230
  }
3231
  }
3232
 
 
 
3233
  if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
 
3234
  // Determine the default variation product
3235
  if( ($product_data['item_group_id'] > 0) AND (is_object(wc_get_product( $product_data['item_group_id']))) AND (($product_data['product_type'] == "variation") OR ($product_data['product_type'] == "subscription_variation"))){
3236
+ $mother_product = new WC_Product_Variable($product_data['item_group_id']);
3237
+ //$mother_product = wc_get_product($product_data['item_group_id']);
3238
+ $def_attributes = $mother_product->get_default_attributes();
3239
 
3240
  if(isset($project_config['lowest_price_variations'])){
3241
+
3242
  // Determine lowest priced variation
3243
  $variation_min_price = $mother_product->get_variation_price('min');
3244
  $variation_min_price = wc_format_decimal($variation_min_price,2);
3245
  $variation_min_price = wc_format_localized_price($variation_min_price);
3246
+ $var_price = get_post_meta($product_data['id'], '_price', true);
3247
+ $var_price = wc_format_decimal($var_price,2);
3248
+ $var_price = wc_format_localized_price($var_price);
3249
+ $variation_prices = $mother_product->get_variation_prices();
3250
+ $variation_prices_price = array_values($variation_prices['price']);
3251
+ $lowest_price = min($variation_prices_price);
3252
+
3253
+ if(($var_price == $lowest_price) OR ($var_price == $variation_min_price) OR ($product_data['system_regular_price'] == $variation_min_price) OR ($product_data['system_net_price'] == $variation_min_price)){
3254
  $variation_pass = "true";
3255
  } else {
3256
  $variation_pass = "false";
3388
  /**
3389
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
3390
  */
3391
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3392
+ //if($stock_value == "instock"){
3393
  foreach($diff_taxonomies as $taxo){
3394
  $term_value = get_the_terms($product_data['item_group_id'], $taxo);
3395
  unset($product_data[$taxo]);
3396
  if(is_array($term_value)){
3397
  foreach($term_value as $term){
3398
  if(empty($product_data[$taxo])){
3399
+ $product_data[$taxo] = $term->name;
3400
  } else {
3401
+ $product_data[$taxo] .= " ".$term->name;
3402
  }
3403
  }
3404
  }
3405
+ }
3406
 
3407
  /**
3408
  * Add product tags to the product data array
3422
 
3423
  // Add attribute values to the variation product names to make them unique
3424
  $product_data['title_hyphen'] = $product_data['title']." - ";
3425
+ $product_data['mother_title_hyphen'] = $product_data['mother_title']." - ";
3426
 
3427
  foreach($variations as $kk => $vv){
3428
  $custom_key = $kk;
3571
  * we will add CDATA brackets to the title and description attributes
3572
  */
3573
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
3574
+ $product_data['title_lcw'] = ucwords(strtolower($product_data['title']));
3575
+
3576
  //$product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3577
  //$product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
3578
 
3581
  */
3582
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3583
 
3584
+ /**
3585
+ * Filter out reviews that do not have text
3586
+ */
3587
+ if(!empty($product_data['reviews'])){
3588
+ foreach($product_data['reviews'] as $review_id => $review_details){
3589
+ if(empty($review_details['content'])){
3590
+ unset($product_data['reviews'][$review_id]);
3591
+ }
3592
+ }
3593
+ }
3594
+
3595
  /**
3596
  * Check if individual products need to be excluded
3597
  */
3657
  // For these channels parent products are allowed
3658
  $allowed_channel_parents = array(
3659
  "skroutz",
3660
+ "bestprice",
3661
  "google_dsa",
3662
  "google_product_review",
3663
  );
3664
 
3665
+ if(array_key_exists('fields', $project_config)){
3666
+ if (!in_array($project_config['fields'], $allowed_channel_parents)){
3667
+ if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
3668
+ $product_data = array();
3669
+ $product_data = null;
3670
+ }
3671
+ }
3672
+ }
3673
 
3674
  /**
3675
  * Remove variation products that are not THE default variation product
3682
  /**
3683
  * And item_group_id is not allowed for simple products, prevent users from adding this to the feedd
3684
  */
3685
+ if($product->is_type('simple') OR ($product->is_type('auction') OR ($product->is_type('external') OR ($product->is_type('bundle')) OR ($product->is_type('composite'))))){
3686
  unset($product_data['item_group_id']);
3687
  }
3688
 
3696
  }
3697
  }
3698
 
3699
+ /**
3700
+ * Do final check on Skroutz out of stock sizes
3701
+ * When a size is not on stock remove it
3702
+ */
3703
+ if($project_config['fields'] == "skroutz"){
3704
+ if(isset($product_data['id'])){
3705
+ foreach($project_config['attributes'] as $ky => $vy){
3706
+ if(isset($vy['attribute'])){
3707
+ if($vy['attribute'] == "size"){
3708
+ $size_found = "yes";
3709
+ $sz_attribute = $vy['mapfrom'];
3710
+ }
3711
+ if($vy['attribute'] == "color"){
3712
+ $color_found = "yes";
3713
+ $clr_attribute = $vy['mapfrom'];
3714
+ }
3715
+ }
3716
+ }
3717
+
3718
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3719
+ $sz_attr_value = get_post_meta( $product_data['id'], $sz_attribute, true );
3720
+ $clr_attr_value = get_post_meta( $product_data['id'], "attribute_".$clr_attribute, true );
3721
+ if(isset($product_data['item_group_id']) AND ($product_data['item_group_id'] > 0)){
3722
+ $product_skroutz = wc_get_product($product_data['item_group_id']);
3723
+ $variations = $product_skroutz->get_available_variations();
3724
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
3725
+
3726
+ foreach($variations_id as $var_id){
3727
+ $clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
3728
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
3729
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
3730
+
3731
+ if($clr_variation == $clr_attr_value){
3732
+ if($stock_variation == "outofstock"){
3733
+ // Remove this size as it is not on stock
3734
+ if(array_key_exists($sz_attribute, $product_data)){
3735
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
3736
+ }
3737
+ }
3738
+ }
3739
+ }
3740
+ }
3741
+ }
3742
+ }
3743
+
3744
  /**
3745
  * When product has passed the filter rules it can continue with the rest
3746
  */
3774
  }
3775
  } else {
3776
  if((strlen($attr_value['mapfrom'])) AND (array_key_exists($attr_value['mapfrom'], $product_data))){
3777
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
3778
  $attr_line = "'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
3779
  } else {
3780
  $attr_line = "'".$attr_value['prefix']. "".$product_data[$attr_value['mapfrom']]."" .$attr_value['suffix']."'";
3846
  }
3847
  } else {
3848
  if(strlen($product_data[$attr_value['mapfrom']])){
3849
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
3850
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3851
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3852
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
4066
  }
4067
  } else {
4068
  if(strlen($product_data[$attr_value['mapfrom']])){
4069
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
4070
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
4071
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
4072
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
4596
  return $product_data;
4597
  }
4598
 
4599
+ /**
4600
+ * Execute project rules
4601
+ */
4602
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
4603
+ $aantal_prods = count($product_data);
4604
+ if($aantal_prods > 0){
4605
 
4606
+ foreach ($project_rules2 as $pr_key => $pr_array){
4607
 
4608
+ foreach ($product_data as $pd_key => $pd_value){
4609
 
4610
+ // Check is there is a rule on specific attributes
4611
+ if($pd_key == $pr_array['attribute']){
4612
 
4613
+ // This is because for data manipulation the than attribute is empty
4614
+ if(!array_key_exists('than_attribute', $pr_array)){
4615
+ $pr_array['than_attribute'] = $pd_key;
4616
+ }
4617
 
4618
  // Check if a rule has been set for Google categories
4619
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
4620
+
4621
+ $pr_array['than_attribute'] = "categories";
4622
  $category_id = explode("-", $pr_array['newvalue']);
4623
  $pr_array['newvalue'] = $category_id[0];
4624
+ $product_data['categories'] = $pr_array['newvalue'];
4625
+ }
4626
 
4627
+ // Make sure that rules on numerics are on true numerics
4628
+ if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
4629
+ $pd_value = strtr($pd_value, ',', '.');
4630
+ }
4631
 
4632
 
4633
+ // Make sure the price or sale price is numeric
4634
+ if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
4635
+ settype($pd_value, "double");
4636
+ }
4637
 
4638
+ if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
4639
 
4640
+ // Rules for numeric values
4641
+ switch ($pr_array['condition']) {
4642
+ case($pr_array['condition'] = "contains"):
4643
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4644
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
4645
+ }
4646
+ break;
4647
+ case($pr_array['condition'] = "containsnot"):
4648
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4649
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4650
+ }
4651
+ break;
4652
+ case($pr_array['condition'] = "="):
4653
+ if (($pd_value == $pr_array['criteria'])){
4654
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4655
+ }
4656
+ break;
4657
+ case($pr_array['condition'] = "!="):
4658
+ if (($pd_value != $pr_array['criteria'])){
4659
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4660
+ }
4661
+ break;
4662
+ case($pr_array['condition'] = ">"):
4663
+ if (($pd_value > $pr_array['criteria'])){
4664
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4665
+ }
4666
+ break;
4667
+ case($pr_array['condition'] = ">="):
4668
+ if (($pd_value >= $pr_array['criteria'])){
4669
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4670
+ }
4671
+ break;
4672
+ case($pr_array['condition'] = "<"):
4673
+ if (($pd_value < $pr_array['criteria'])){
4674
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4675
+ }
4676
+ break;
4677
+ case($pr_array['condition'] = "=<"):
4678
+ if (($pd_value <= $pr_array['criteria'])){
4679
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4680
+ }
4681
+ break;
4682
+ case($pr_array['condition'] = "empty"):
4683
+ if(empty($product_data[$pr_array['attribute']])){
4684
+ if ((strlen($pd_value) < 1)){
4685
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4686
+ } else {
4687
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4688
+ }
4689
+ }
4690
+ break;
4691
+ case($pr_array['condition'] = "multiply"):
4692
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4693
+ $convert_back = "false";
4694
+ $pos = strpos($pd_value, ',');
4695
+ if($pos !== false){
4696
+ $convert_back = "true";
4697
+ }
4698
+ $pd_value = strtr($pd_value, ',', '.');
4699
+ $newvalue = $pd_value*$pr_array['criteria'];
4700
+ $newvalue = round($newvalue, 2);
4701
+ if($convert_back == "true"){
4702
+ $newvalue = strtr($newvalue, '.',',');
4703
+ }
4704
+ $product_data[$pr_array['attribute']] = $newvalue;
4705
+ break;
4706
+ case($pr_array['condition'] = "divide"):
4707
+ $newvalue = ($pd_value / $pr_array['criteria']);
4708
+ $newvalue = round($newvalue, 2);
4709
+ $newvalue = strtr($newvalue, '.',',');
4710
+ $product_data[$pr_array['attribute']] = $newvalue;
4711
+ break;
4712
+ case($pr_array['condition'] = "plus"):
4713
+ $newvalue = ($pd_value + $pr_array['criteria']);
4714
+ $product_data[$pr_array['attribute']] = $newvalue;
4715
+ break;
4716
+ case($pr_array['condition'] = "minus"):
4717
+ $newvalue = ($pd_value - $pr_array['criteria']);
4718
+ $product_data[$pr_array['attribute']] = $newvalue;
4719
+ break;
4720
+ case($pr_array['condition'] = "findreplace"):
4721
+ if (strpos($pd_value, $pr_array['criteria']) !== false){
4722
  // Make sure that a new value has been set
4723
+ if(!empty($pr_array['newvalue'])){
4724
+ // Find and replace only work on same attribute field, otherwise create a contains rule
4725
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4726
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4727
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4728
  }
4729
+ }
4730
+ }
4731
+ break;
4732
+ default:
4733
+ break;
4734
+ }
4735
+ } elseif (is_array($pd_value)) {
4736
+
4737
+ // For now only shipping details are in an array
4738
+ foreach ($pd_value as $k => $v){
4739
+ if(is_array($v)){
4740
+ foreach ($v as $kk => $vv){
4741
+ // Only shipping detail rule can be on price for now
4742
+ if($kk == "price"){
4743
+ switch ($pr_array['condition']) {
4744
+ case($pr_array['condition'] = "contains"):
4745
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
4746
+ $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
4747
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4748
+ }
4749
+ break;
4750
+ case($pr_array['condition'] = "containsnot"):
4751
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
4752
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4753
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4754
+ }
4755
+ break;
4756
+ case($pr_array['condition'] = "="):
4757
+ if (($vv == $pr_array['criteria'])){
4758
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4759
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4760
+ }
4761
+ break;
4762
+ case($pr_array['condition'] = "!="):
4763
+ if (($vv != $pr_array['criteria'])){
4764
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4765
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4766
+ }
4767
+ break;
4768
+ case($pr_array['condition'] = ">"):
4769
+ if (($vv > $pr_array['criteria'])){
4770
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4771
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4772
+ }
4773
+ break;
4774
+ case($pr_array['condition'] = ">="):
4775
+ if (($vv >= $pr_array['criteria'])){
4776
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4777
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4778
+ }
4779
+ break;
4780
+ case($pr_array['condition'] = "<"):
4781
+ if (($vv < $pr_array['criteria'])){
4782
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4783
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4784
+ }
4785
+ break;
4786
+ case($pr_array['condition'] = "=<"):
4787
+ if (($vv <= $pr_array['criteria'])){
4788
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4789
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4790
+ }
4791
+ break;
4792
+ case($pr_array['condition'] = "empty"):
4793
+ if ((strlen($vv) < 1)){
4794
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4795
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4796
+ }
4797
+ break;
4798
+ case($pr_array['condition'] = "multiply"):
4799
+ // Only shipping array
4800
+ if(is_array($pd_value)){
4801
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4802
+ foreach ($pd_value as $ship_a_key => $shipping_arr){
4803
+ foreach($shipping_arr as $ship_key => $ship_value){
4804
+ if($ship_key == "price"){
4805
+ $ship_pieces = explode(" ", $ship_value);
4806
+ $pd_value = strtr($ship_pieces[1], ',', '.');
4807
+ $newvalue = $pd_value*$pr_array['criteria'];
4808
+ $newvalue = round($newvalue, 2);
4809
+ $newvalue = strtr($newvalue, '.',',');
4810
+ $newvalue = $ship_pieces[0]." ".$newvalue;
4811
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4812
+ }
4813
+ }
4814
+ }
4815
+ }
4816
+ break;
4817
+ default:
4818
+ break;
4819
+ }
4820
+ }
4821
+ }
4822
+ } else {
4823
+ // Rules on product tags
4824
+ foreach ($pd_value as $k => $v){
4825
+
4826
+ // Rules for string values
4827
+ if (!array_key_exists('cs', $pr_array)){
4828
+ $v = strtolower($v);
4829
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
4830
+ }
4831
+
4832
+ switch ($pr_array['condition']) {
4833
+ case($pr_array['condition'] = "contains"):
4834
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
4835
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4836
+ }
4837
+ break;
4838
+ case($pr_array['condition'] = "containsnot"):
4839
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
4840
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4841
+ }
4842
+ break;
4843
+ case($pr_array['condition'] = "="):
4844
+ if (($v == $pr_array['criteria'])){
4845
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4846
+ }
4847
+ break;
4848
+ case($pr_array['condition'] = "!="):
4849
+ if (($v != $pr_array['criteria'])){
4850
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4851
+ }
4852
+ break;
4853
+ case($pr_array['condition'] = ">"):
4854
+ if (($v > $pr_array['criteria'])){
4855
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4856
+ }
4857
+ break;
4858
+ case($pr_array['condition'] = ">="):
4859
+ if (($v >= $pr_array['criteria'])){
4860
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4861
+ }
4862
+ break;
4863
+ case($pr_array['condition'] = "<"):
4864
+ if (($v < $pr_array['criteria'])){
4865
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4866
+ }
4867
+ break;
4868
+ case($pr_array['condition'] = "=<"):
4869
+ if (($v <= $pr_array['criteria'])){
4870
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4871
+ }
4872
+ break;
4873
+ case($pr_array['condition'] = "empty"):
4874
+ if ((strlen($v) < 1)){
4875
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4876
+ }
4877
+ break;
4878
+ case($pr_array['condition'] = "multiply"):
4879
+ // Only shipping array
4880
+ if(is_array($v)){
4881
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4882
+ foreach ($v as $ship_a_key => $shipping_arr){
4883
+ foreach($shipping_arr as $ship_key => $ship_value){
4884
+ if($ship_key == "price"){
4885
+ $ship_pieces = explode(" ", $ship_value);
4886
+ $pd_value = strtr($ship_pieces[1], ',', '.');
4887
+ $newvalue = $pd_value*$pr_array['criteria'];
4888
+ $newvalue = round($newvalue, 2);
4889
+ $newvalue = strtr($newvalue, '.',',');
4890
+ $newvalue = $ship_pieces[0]." ".$newvalue;
4891
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4892
+ }
4893
+ }
4894
+ }
4895
+ }
4896
+ break;
4897
+ default:
4898
+ break;
4899
+ }
4900
+ }
4901
+ }
4902
+ }
4903
+ } else {
4904
+ // Rules for string values
4905
+ if (!array_key_exists('cs', $pr_array)){
4906
+ if($pr_array['attribute'] != "image"){
4907
+ $pd_value = strtolower($pd_value);
4908
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
4909
+ }
4910
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4911
 
4912
+ switch ($pr_array['condition']) {
4913
+ case($pr_array['condition'] = "contains"):
4914
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4915
+ // Specifically for shipping price rules
4916
+ if(!empty($product_data[$pr_array['than_attribute']])){
4917
+ if(is_array($product_data[$pr_array['than_attribute']])){
4918
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4919
+ for ($x = 0; $x <= $arr_size; $x++) {
4920
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4921
+ }
4922
+ } else {
4923
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4924
+ }
4925
+ } else {
4926
+ // This attribute value is empty for this product
4927
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4928
+ }
4929
+ }
4930
+ break;
4931
+ case($pr_array['condition'] = "containsnot"):
4932
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4933
+ // Specifically for shipping price rules
4934
+ if(is_array($product_data[$pr_array['than_attribute']])){
4935
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4936
+ for ($x = 0; $x <= $arr_size; $x++) {
4937
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4938
+ }
4939
+ } else {
4940
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4941
+ }
4942
+ }
4943
+ break;
4944
+ case($pr_array['condition'] = "="):
4945
+ if (($pr_array['criteria'] == "$pd_value")){
4946
+ // Specifically for shipping price rules
4947
+ if(is_array($product_data[$pr_array['than_attribute']])){
4948
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4949
+ for ($x = 0; $x <= $arr_size; $x++) {
4950
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4951
+ }
4952
+ } else {
4953
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4954
+ }
4955
+ }
4956
+ $ship = $product_data['shipping'];
4957
+ break;
4958
+ case($pr_array['condition'] = "!="):
4959
+ if (($pr_array['criteria'] != "$pd_value")){
4960
+ // Specifically for shipping price rules
4961
+ if(is_array($product_data[$pr_array['than_attribute']])){
4962
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4963
+ for ($x = 0; $x <= $arr_size; $x++) {
4964
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4965
+ }
4966
+ } else {
4967
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4968
+ }
4969
+ }
4970
+ break;
4971
+ case($pr_array['condition'] = ">"):
4972
+ // Use a lexical order on relational string operators
4973
+ if (($pd_value > $pr_array['criteria'])){
4974
+ // Specifically for shipping price rules
4975
+ if(is_array($product_data[$pr_array['than_attribute']])){
4976
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4977
+ for ($x = 0; $x <= $arr_size; $x++) {
4978
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4979
+ }
4980
+ } else {
4981
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4982
+ }
4983
+ }
4984
+ break;
4985
+ case($pr_array['condition'] = ">="):
4986
+ // Use a lexical order on relational string operators
4987
+ if (($pd_value >= $pr_array['criteria'])){
4988
+ // Specifically for shipping price rules
4989
+ if(is_array($product_data[$pr_array['than_attribute']])){
4990
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4991
+ for ($x = 0; $x <= $arr_size; $x++) {
4992
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4993
+ }
4994
+ } else {
4995
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4996
+ }
4997
+ }
4998
+ break;
4999
+ case($pr_array['condition'] = "<"):
5000
+ // Use a lexical order on relational string operators
5001
+ if (($pd_value < $pr_array['criteria'])){
5002
+ // Specifically for shipping price rules
5003
+ if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
5004
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5005
+ for ($x = 0; $x <= $arr_size; $x++) {
5006
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5007
+ }
5008
+ } else {
5009
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5010
+ }
5011
+ }
5012
+ break;
5013
+ case($pr_array['condition'] = "=<"):
5014
+ // Use a lexical order on relational string operators
5015
+ if (($pd_value <= $pr_array['criteria'])){
5016
+ // Specifically for shipping price rules
5017
+ if(is_array($product_data[$pr_array['than_attribute']])){
5018
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5019
+ for ($x = 0; $x <= $arr_size; $x++) {
5020
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5021
+ }
5022
+ } else {
5023
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5024
+ }
5025
+ }
5026
+ break;
5027
+
5028
+ case($pr_array['condition'] = "empty"):
5029
+ if(empty($product_data[$pr_array['attribute']])){
5030
+ if(empty($product_data[$pr_array['than_attribute']])){
5031
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5032
+ } else {
5033
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5034
+ }
5035
+ }
5036
+ break;
5037
+ case($pr_array['condition'] = "replace"):
5038
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
5039
+ break;
5040
  case($pr_array['condition'] = "findreplace"):
5041
  if (strpos($pd_value, $pr_array['criteria']) !== false){
5042
+ // Make sure that a new value has been set
5043
+ if(!empty($pr_array['newvalue'])){
5044
+ // Find and replace only work on same attribute field, otherwise create a contains rule
5045
  if($pr_array['attribute'] == $pr_array['than_attribute']){
5046
+ $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
5047
+ //$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
5048
+ $product_data[$pr_array['than_attribute']] = $newvalue;
5049
+ }
5050
+ }
5051
+ }
5052
  break;
5053
+ default:
5054
+ break;
5055
+ }
5056
+ }
5057
+ } else {
5058
+ // When a rule has been set on an attribute that is not in product_data
5059
+ // Add the newvalue to product_data
5060
+ if (!array_key_exists($pr_array['attribute'], $product_data)){
5061
+ if(!empty($pr_array['newvalue'])){
5062
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5063
+ } else {
5064
+ if(array_key_exists($pr_array['than_attribute'], $product_data)){
5065
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5066
+ }
5067
+ }
5068
+ }
5069
+ }
5070
+ }
5071
+ }
5072
+ }
5073
+ return $product_data;
5074
+ }
5075
 
5076
  /**
5077
  * Function to exclude products based on individual product exclusions
5094
  }
5095
  }
5096
 
5097
+
5098
+ /**
5099
+ * Execute project filters (include / exclude)
5100
+ */
5101
  private function woocommerce_sea_filters( $project_rules, $product_data ){
5102
+ $allowed = 1;
5103
 
5104
+ // Check if product was already excluded from the feed
5105
+ $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
5106
 
5107
+ if( $product_excluded == "Yes"){
5108
+ $allowed = 0;
5109
+ }
5110
 
5111
+ foreach ($project_rules as $pr_key => $pr_array){
5112
 
5113
+ if($pr_array['attribute'] == "categories"){
5114
+ $pr_array['attribute'] = "raw_categories";
5115
+ }
5116
 
5117
+ //if(array_key_exists($pr_array['attribute'], $product_data)){
5118
 
5119
+ if(!array_key_exists($pr_array['attribute'], $product_data)) {
5120
+ $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
5121
+ }
5122
 
5123
+ foreach ($product_data as $pd_key => $pd_value){
5124
+ // Check is there is a rule on specific attributes
5125
+ if(in_array($pd_key, $pr_array, TRUE)){
5126
 
5127
+ if($pd_key == "price"){
5128
+ //$pd_value = @number_format($pd_value,2);
5129
+ $pd_value = wc_format_decimal($pd_value);
5130
+ }
5131
 
5132
+ if (is_numeric($pd_value)){
5133
+ $old_value = $pd_value;
5134
+ if($pd_key == "price"){
5135
+ $pd_value = @number_format($pd_value,2);
5136
+ }
5137
+
5138
+ // Rules for numeric values
5139
+ switch ($pr_array['condition']) {
5140
+ case($pr_array['condition'] = "contains"):
5141
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5142
+ $allowed = 0;
5143
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5144
+ $allowed = 0;
5145
+ }
5146
+ break;
5147
+ case($pr_array['condition'] = "containsnot"):
5148
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5149
+ $allowed = 0;
5150
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5151
+ $allowed = 0;
5152
+ }
5153
+ break;
 
 
 
 
 
5154
  case($pr_array['condition'] = "="):
5155
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5156
+ $allowed = 0;
5157
+ } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5158
+ $allowed = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5159
  }
5160
+ break;
5161
+ case($pr_array['condition'] = "!="):
5162
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5163
+ if($allowed <> 0){
5164
+ $allowed = 1;
5165
+ }
5166
+ } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5167
+ $allowed = 0;
5168
+ }
5169
+ break;
5170
+ case($pr_array['condition'] = ">"):
5171
+ if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5172
+ $allowed = 0;
5173
+ } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5174
+ $allowed = 0;
5175
+ }
5176
+ break;
5177
+ case($pr_array['condition'] = ">="):
5178
+ if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5179
+ $allowed = 0;
5180
+ } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5181
+ $allowed = 0;
5182
+ }
5183
+ break;
5184
+ case($pr_array['condition'] = "<"):
5185
+ if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5186
+ $allowed = 0;
5187
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5188
+ $allowed = 0;
5189
+ }
5190
+ break;
5191
+ case($pr_array['condition'] = "=<"):
5192
+ if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5193
+ $allowed = 0;
5194
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5195
+ $allowed = 0;
5196
+ }
5197
+ break;
5198
+ case($pr_array['condition'] = "empty"):
5199
+ if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5200
+ $allowed = 0;
5201
+ } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5202
+ $allowed = 0;
5203
+ }
5204
+ break;
5205
+ default:
5206
+ break;
5207
+ }
5208
+ } elseif (is_array($pd_value)){
5209
+ // Tis can either be a shipping or product_tag array
5210
+ if($pr_array['attribute'] == "product_tag"){
5211
+ $in_tag_array = "not";
5212
+
5213
+ foreach($pd_value as $pt_key => $pt_value){
5214
+ // Rules for string values
5215
+ if (!array_key_exists('cs', $pr_array)){
5216
+ $pt_value = strtolower($pt_value);
5217
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5218
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5219
 
5220
+ if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5221
+ $in_tag_array = "yes";
5222
+ }
5223
+ }
5224
+
5225
+ if($in_tag_array == "yes"){
5226
+ //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5227
+ $v = $pr_array['criteria'];
5228
+ switch ($pr_array['condition']) {
5229
+ case($pr_array['condition'] = "contains"):
5230
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5231
+ if($pr_array['than'] == "include_only"){
5232
+ if($allowed <> 0){
5233
+ $allowed = 1;
5234
+ }
5235
+ } else {
5236
+ $allowed = 0;
5237
+ }
5238
+ } else {
5239
+ $allowed = 0;
5240
+ }
5241
+ break;
5242
+ case($pr_array['condition'] = "containsnot"):
5243
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5244
+ if($pr_array['than'] == "include_only"){
5245
+ if($allowed <> 0){
5246
+ $allowed = 1;
5247
+ }
5248
+ } else {
5249
+ $allowed = 0;
5250
+ }
5251
+ } else {
5252
+ $allowed = 0;
5253
+ }
5254
+ break;
5255
+ case($pr_array['condition'] = "="):
5256
+ if (($v == $pr_array['criteria'])){
5257
+ if($pr_array['than'] == "include_only"){
5258
+ if($allowed <> 0){
5259
+ $allowed = 1;
5260
+ }
5261
+ } else {
5262
+ $allowed = 0;
5263
+ }
5264
+ } else {
5265
+ $allowed = 0;
5266
+ }
5267
+ break;
5268
+ case($pr_array['condition'] = "!="):
5269
+ if (($v != $pr_array['criteria'])){
5270
+ if($pr_array['than'] == "include_only"){
5271
+ if($allowed <> 0){
5272
+ $allowed = 1;
5273
+ }
5274
+ } else {
5275
+ $allowed = 0;
5276
+ }
5277
+ }
5278
+ break;
5279
+ case($pr_array['condition'] = ">"):
5280
+ if (($v > $pr_array['criteria'])){
5281
+ if($pr_array['than'] == "include_only"){
5282
+ if($allowed <> 0){
5283
+ $allowed = 1;
5284
+ }
5285
+ } else {
5286
+ $allowed = 0;
5287
+ }
5288
+ }
5289
+ break;
5290
+ case($pr_array['condition'] = ">="):
5291
+ if (($v >= $pr_array['criteria'])){
5292
+ if($pr_array['than'] == "include_only"){
5293
+ if($allowed <> 0){
5294
+ $allowed = 1;
5295
+ }
5296
+ } else {
5297
+ $allowed = 0;
5298
+ }
5299
+ }
5300
+ break;
5301
+ case($pr_array['condition'] = "<"):
5302
+ if (($v < $pr_array['criteria'])){
5303
+ if($pr_array['than'] == "include_only"){
5304
+ if($allowed <> 0){
5305
+ $allowed = 1;
5306
+ }
5307
+ } else {
5308
+ $allowed = 0;
5309
+ }
5310
+ }
5311
+ break;
5312
+ case($pr_array['condition'] = "=<"):
5313
+ if (($v <= $pr_array['criteria'])){
5314
+ if($pr_array['than'] == "include_only"){
5315
+ if($allowed <> 0){
5316
+ $allowed = 1;
5317
+ }
5318
+ } else {
5319
+ $allowed = 0;
5320
+ }
5321
+ }
5322
+ break;
5323
+ case($pr_array['condition'] = "empty"):
5324
+ if (strlen($v) < 1){
5325
+ if($pr_array['than'] == "include_only"){
5326
+ if($allowed <> 0){
5327
+ $allowed = 1;
5328
+ }
5329
+ } else {
5330
+ if(!empty($pt_value)){
5331
+ $allowed = 1;
5332
+ } else {
5333
+ $allowed = 0;
5334
+ }
5335
+ }
5336
+ }
5337
+ break;
5338
+ default:
5339
+ break;
5340
+ }
5341
+ } else {
5342
+ switch ($pr_array['condition']) {
5343
+ case($pr_array['condition'] = "contains"):
5344
+ if($pr_array['than'] == "include_only"){
5345
+ $allowed = 0;
5346
+ } else {
5347
+ if($allowed <> 0){
5348
+ $allowed = 1;
5349
+ }
5350
+ }
5351
+ break;
5352
+ case($pr_array['condition'] = "containsnot"):
5353
+ if($pr_array['than'] == "include_only"){
5354
+ if($allowed <> 0){
5355
+ $allowed = 1;
5356
+ }
5357
+ } else {
5358
+ $allowed = 0;
5359
+ }
5360
+ break;
5361
+ case($pr_array['condition'] = "="):
5362
+ if($pr_array['than'] == "include_only"){
5363
+ $allowed = 0;
5364
+ } else {
5365
+ if($allowed <> 0){
5366
+ $allowed = 1;
5367
+ }
5368
+ }
5369
+ break;
5370
+ case($pr_array['condition'] = "!="):
5371
+ if($pr_array['than'] == "include_only"){
5372
+ if($allowed <> 0){
5373
+ $allowed = 1;
5374
+ }
5375
+ } else {
5376
+ $allowed = 0;
5377
+ }
5378
+ break;
5379
+ case($pr_array['condition'] = ">"):
5380
+ if($pr_array['than'] == "include_only"){
5381
+ $allowed = 0;
5382
+ } else {
5383
+ $allowed = 0;
5384
+ }
5385
+ break;
5386
+ case($pr_array['condition'] = ">="):
5387
+ if($pr_array['than'] == "include_only"){
5388
+ $allowed = 0;
5389
+ } else {
5390
+ $allowed = 0;
5391
+ }
5392
+ break;
5393
+ case($pr_array['condition'] = "<"):
5394
+ if($pr_array['than'] == "include_only"){
5395
+ $allowed = 0;
5396
+ } else {
5397
+ $allowed = 0;
5398
+ }
5399
+ break;
5400
+ case($pr_array['condition'] = "=<"):
5401
+ if($pr_array['than'] == "include_only"){
5402
+ $allowed = 0;
5403
+ } else {
5404
+ $allowed = 0;
5405
+ }
5406
+ break;
5407
+ case($pr_array['condition'] = "empty"):
5408
+ if($pr_array['than'] == "include_only"){
5409
+ if($allowed <> 0){
5410
+ $allowed = 1;
5411
+ }
5412
+ } else {
5413
+ $allowed = 0;
5414
+ }
5415
+ break;
5416
+ default:
5417
+ break;
5418
+ }
5419
+ }
5420
+ } else {
5421
+ // For now only shipping details are in an array
5422
+ foreach ($pd_value as $k => $v){
5423
+ foreach ($v as $kk => $vv){
5424
+ // Only shipping detail rule can be on price for now
5425
+ if($kk == "price"){
5426
+ switch ($pr_array['condition']) {
5427
+ case($pr_array['condition'] = "contains"):
5428
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5429
+ $allowed = 0;
5430
+ }
5431
+ break;
5432
+ case($pr_array['condition'] = "containsnot"):
5433
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5434
+ $allowed = 0;
5435
+ }
5436
+ break;
5437
+ case($pr_array['condition'] = "="):
5438
+ if (($vv == $pr_array['criteria'])){
5439
+ $allowed = 0;
5440
+ }
5441
+ break;
5442
+ case($pr_array['condition'] = "!="):
5443
+ if (($vv != $pr_array['criteria'])){
5444
+ $allowed = 0;
5445
+ }
5446
+ break;
5447
+ case($pr_array['condition'] = ">"):
5448
+ if (($vv > $pr_array['criteria'])){
5449
+ $allowed = 0;
5450
+ }
5451
+ break;
5452
+ case($pr_array['condition'] = ">="):
5453
+ if (($vv >= $pr_array['criteria'])){
5454
+ $allowed = 0;
5455
+ }
5456
+ break;
5457
+ case($pr_array['condition'] = "<"):
5458
+ if (($vv < $pr_array['criteria'])){
5459
+ $allowed = 0;
5460
+ }
5461
+ break;
5462
+ case($pr_array['condition'] = "=<"):
5463
+ if (($vv <= $pr_array['criteria'])){
5464
+ $allowed = 0;
5465
+ }
5466
+ break;
5467
+ case($pr_array['condition'] = "empty"):
5468
+ if (strlen($vv) < 1){
5469
+ $allowed = 0;
5470
+ }
5471
+ break;
5472
+ default:
5473
+ break;
5474
+ }
5475
+ }
5476
+ }
5477
+ }
5478
+ }
5479
+ } else {
5480
+ // Filters for string values
5481
+ // If case-sensitve is off than lowercase both the criteria and attribute value
5482
+ if (array_key_exists('cs', $pr_array)){
5483
+ if ($pr_array['cs'] != "on"){
5484
+ $pd_value = strtolower($pd_value);
5485
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5486
+ }
5487
+ }
5488
+ $pos = strpos($pd_value, '&amp;');
5489
+ $pos_slash = strpos($pr_array['criteria'], '\\');
5490
+ if($pos !== false){
5491
+ $pd_value = str_replace("&amp;","&",$pd_value);
5492
+ }
5493
+ if($pos_slash !== false){
5494
+ $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5495
+ }
5496
+
5497
+ switch ($pr_array['condition']) {
5498
+ case($pr_array['condition'] = "contains"):
5499
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5500
+ $allowed = 0;
5501
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5502
+ $allowed = 0;
5503
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5504
+ if($allowed <> 0){
5505
+ $allowed = 1;
5506
+ }
5507
+ }
5508
+ break;
5509
+ case($pr_array['condition'] = "containsnot"):
5510
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5511
+ $allowed = 0;
5512
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5513
+ $allowed = 0;
5514
+ }
5515
+ break;
5516
  case($pr_array['condition'] = "="):
5517
+ if (($pr_array['criteria'] == "$pd_value") AND ($pr_array['than'] == "exclude")){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5518
  $allowed = 0;
5519
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
5520
+ $found = strpos($pd_value,$pr_array['criteria']);
5521
+ if ($found !== false) {
5522
+ //for category mapping check if its an array
5523
+ if($pr_array['attribute'] == "raw_categories"){
5524
+ $raw_cats_arr = explode("||",$pd_value);
5525
+ if(is_array($raw_cats_arr)){
5526
+ if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
5527
+ if($allowed <> 0){
5528
+ $allowed = 1;
5529
+ }
5530
+ } else {
5531
+ $allowed = 0;
5532
+ }
5533
+ }
5534
+ } else {
5535
+ if($allowed <> 0){
5536
+ $allowed = 1;
5537
+ }
5538
+ }
5539
+ } else {
5540
+ $allowed = 0;
5541
+ }
5542
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5543
+ if($allowed <> 0){
5544
+ $allowed = 1;
5545
+ }
5546
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5547
+ // $allowed = 0;
5548
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5549
+ $allowed = 1;
5550
+ } else {
5551
+ // $allowed = 1; // Change made on February 24th 2021
5552
+ }
5553
+ break;
5554
+ case($pr_array['condition'] = "!="):
5555
+ if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5556
+ if($allowed <> 0){
5557
+ $allowed = 1;
5558
+ }
5559
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5560
+ $allowed = 0;
5561
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
5562
+ $allowed = 0;
5563
+ }
5564
+ break;
5565
+ case($pr_array['condition'] = ">"):
5566
+ // Use a lexical order on relational string operators
5567
+ if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5568
+ $allowed = 0;
5569
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5570
+ $allowed = 0;
5571
+ }
5572
+ break;
5573
+ case($pr_array['condition'] = ">="):
5574
+ // Use a lexical order on relational string operators
5575
+ if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5576
+ $allowed = 0;
5577
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5578
+ $allowed = 0;
5579
+ }
5580
+ break;
5581
+ case($pr_array['condition'] = "<"):
5582
+ // Use a lexical order on relational string operators
5583
+ if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5584
+ $allowed = 0;
5585
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5586
+ $allowed = 0;
5587
+ }
5588
+ break;
5589
+ case($pr_array['condition'] = "=<"):
5590
+ // Use a lexical order on relational string operators
5591
+ if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5592
+ $allowed = 0;
5593
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5594
+ $allowed = 0;
5595
+ }
5596
+ break;
5597
+ case($pr_array['condition'] = "empty"):
5598
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5599
+ $allowed = 0;
5600
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
5601
+ if($allowed <> 0){
5602
+ $allowed = 1;
5603
+ }
5604
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
5605
+ $allowed = 0;
5606
+ }
5607
+ break;
5608
+ default:
5609
+ break;
5610
+ }
5611
+ }
5612
+ }
5613
+ }
5614
+ }
5615
 
5616
+ if ($allowed < 1){
5617
+ $product_data = array();
5618
+ $product_data = null;
5619
+ } else {
5620
+ return $product_data;
5621
+ }
5622
+ }
5623
  }
js/woosea_autocomplete.js CHANGED
@@ -5695,8 +5695,10 @@ jQuery(document).ready(function($) {
5695
  jQuery(".js-autosuggest").on('click',function(){
5696
  var className = $(this).attr("class").split(' ')[3];
5697
  var rowCount = className.split("_")[1]
5698
-
5699
- jQuery( ".autocomplete_" + rowCount ).typeahead({
 
 
5700
  input: '.js-autosuggest',
5701
  source: google_taxonomy,
5702
  hint: true,
@@ -5708,7 +5710,6 @@ jQuery(document).ready(function($) {
5708
  });
5709
  jQuery( ".autocomplete_" + rowCount ).focus();
5710
 
5711
-
5712
  jQuery(this).on('change', function(){ // on change of state
5713
 
5714
  var minimum = 1;
@@ -5741,7 +5742,6 @@ jQuery(document).ready(function($) {
5741
  }
5742
  } else {
5743
  var map_to_category = "";
5744
-
5745
  jQuery.ajax({
5746
  method: "POST",
5747
  url: ajaxurl,
5695
  jQuery(".js-autosuggest").on('click',function(){
5696
  var className = $(this).attr("class").split(' ')[3];
5697
  var rowCount = className.split("_")[1]
5698
+
5699
+ //$('#the-basics-11603 .autocomplete_11603').typeahead({
5700
+ jQuery("." + className).typeahead({
5701
+ //jQuery(".autocomplete_" + rowCount ).typeahead({
5702
  input: '.js-autosuggest',
5703
  source: google_taxonomy,
5704
  hint: true,
5710
  });
5711
  jQuery( ".autocomplete_" + rowCount ).focus();
5712
 
 
5713
  jQuery(this).on('change', function(){ // on change of state
5714
 
5715
  var minimum = 1;
5742
  }
5743
  } else {
5744
  var map_to_category = "";
 
5745
  jQuery.ajax({
5746
  method: "POST",
5747
  url: ajaxurl,
js/woosea_key.js CHANGED
@@ -27,7 +27,7 @@ jQuery(document).ready(function($) {
27
  var license_key = $('#license-key').val();
28
 
29
  jQuery.ajax({
30
- url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=9.3.7',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
27
  var license_key = $('#license-key').val();
28
 
29
  jQuery.ajax({
30
+ url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=9.9.2',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
js/woosea_manage.js CHANGED
@@ -256,6 +256,26 @@ jQuery(function($) {
256
  }
257
  })
258
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  // Check if user would like to enable debug logging
260
  $('#add_woosea_logging').on('change', function(){ // on change of state
261
  if(this.checked){
256
  }
257
  })
258
 
259
+ // Check if user would like the plugin to remove the free shipping class
260
+ $('#remove_free_shipping').on('change', function(){ // on change of state
261
+ if(this.checked){
262
+
263
+ // Checkbox is on
264
+ jQuery.ajax({
265
+ method: "POST",
266
+ url: ajaxurl,
267
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "on" }
268
+ })
269
+ } else {
270
+ // Checkbox is off
271
+ jQuery.ajax({
272
+ method: "POST",
273
+ url: ajaxurl,
274
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "off" }
275
+ })
276
+ }
277
+ })
278
+
279
  // Check if user would like to enable debug logging
280
  $('#add_woosea_logging').on('change', function(){ // on change of state
281
  if(this.checked){
pages/admin/woosea-generate-feed-step-1.php CHANGED
@@ -101,7 +101,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
101
 
102
  $r .= "<tr class=\"catmapping\">";
103
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">$woo_category ($sub_category->count)</td>";
104
- $r .= "<td><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x\" value=\"$mapped_category\"></td>";
105
  if(($yo == $nr_categories) AND ($nr_subcats == 0)){
106
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
107
  } else {
@@ -115,7 +115,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
115
  } else {
116
  $r .= "<tr class=\"catmapping\">";
117
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">-- $woo_category ($sub_category->count)</td>";
118
- $r .= "<td><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x mother_$sub_category->parent\" value=\"$mapped_category\"></td>";
119
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
120
  $r .= "</tr>";
121
  }
@@ -227,7 +227,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
227
 
228
  <table class="woo-product-feed-pro-table">
229
  <tr>
230
- <td><strong><?php _e( 'We\’ve got you covered!','woo-product-feed-pro' );?></strong></td>
231
  </tr>
232
  <tr>
233
  <td>
101
 
102
  $r .= "<tr class=\"catmapping\">";
103
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">$woo_category ($sub_category->count)</td>";
104
+ $r .= "<td><div id=\"the-basics-$x\"><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x\" value=\"$mapped_category\"></div></td>";
105
  if(($yo == $nr_categories) AND ($nr_subcats == 0)){
106
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
107
  } else {
115
  } else {
116
  $r .= "<tr class=\"catmapping\">";
117
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">-- $woo_category ($sub_category->count)</td>";
118
+ $r .= "<td><div id=\"the-basics-$x\"><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x mother_$sub_category->parent\" value=\"$mapped_category\"></div></td>";
119
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
120
  $r .= "</tr>";
121
  }
227
 
228
  <table class="woo-product-feed-pro-table">
229
  <tr>
230
+ <td><strong><?php _e( 'We have got you covered!','woo-product-feed-pro' );?></strong></td>
231
  </tr>
232
  <tr>
233
  <td>
pages/admin/woosea-generate-feed-step-4.php CHANGED
@@ -77,7 +77,7 @@ if (array_key_exists('project_hash', $_GET)){
77
  $criteria = "";
78
  }
79
  ?>
80
- <tr class="rowCount">
81
  <td><input type="hidden" name="rules[<?php print "$rule_key";?>][rowCount]" value="<?php print "$rule_key";?>"><input type="checkbox" name="record" class="checkbox-field"></td>
82
  <td><i><?php _e( 'Filter','woo-product-feed-pro' );?></i></td>
83
  <td>
@@ -155,7 +155,7 @@ if (array_key_exists('project_hash', $_GET)){
155
  </td>
156
  <td>
157
  <div style="display: block;">
158
- <input type="text" id="rulevalue" name="rules[<?php print "$rule_key";?>][criteria]" class="input-field-large" value="<?php print "$criteria";?>">
159
  </div>
160
  </td>
161
  <td>
@@ -314,7 +314,7 @@ if (array_key_exists('project_hash', $_GET)){
314
  </td>
315
  <td>
316
  <div style="display: block;">
317
- <input type="text" id="rulevalue" name="rules2[<?php print "$rule2_key";?>][criteria]" class="input-field-large" value="<?php print "$criteria";?>">
318
  </div>
319
  </td>
320
  <?php
77
  $criteria = "";
78
  }
79
  ?>
80
+ <tr class="rowCount">
81
  <td><input type="hidden" name="rules[<?php print "$rule_key";?>][rowCount]" value="<?php print "$rule_key";?>"><input type="checkbox" name="record" class="checkbox-field"></td>
82
  <td><i><?php _e( 'Filter','woo-product-feed-pro' );?></i></td>
83
  <td>
155
  </td>
156
  <td>
157
  <div style="display: block;">
158
+ <input type="text" id="rulevalue" name="rules[<?php print "$rule_key";?>][criteria]" class="input-field-large" value='<?php print $criteria;?>'>
159
  </div>
160
  </td>
161
  <td>
314
  </td>
315
  <td>
316
  <div style="display: block;">
317
+ <input type="text" id="rulevalue" name="rules2[<?php print "$rule2_key";?>][criteria]" class="input-field-large" value='<?php print $criteria;?>'>
318
  </div>
319
  </td>
320
  <?php
pages/admin/woosea-manage-feed.php CHANGED
@@ -67,6 +67,7 @@ if(!empty($license_information)){
67
  if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
68
  $notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
69
  }
 
70
  ?>
71
  <div class="wrap">
72
  <div class="woo-product-feed-pro-form-style-2">
@@ -124,6 +125,18 @@ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
124
  <?php
125
  }
126
  }
 
 
 
 
 
 
 
 
 
 
 
 
127
  ?>
128
 
129
  <div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
67
  if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
68
  $notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
69
  }
70
+
71
  ?>
72
  <div class="wrap">
73
  <div class="woo-product-feed-pro-form-style-2">
125
  <?php
126
  }
127
  }
128
+
129
+
130
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
131
+ ?>
132
+ <div class="notice notice-error is-dismissible">
133
+ <p>
134
+ <strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
135
+ We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active otherwise it cannot update and generate your product feeds. <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>Please enable your WP-cron first</strong></a>.
136
+ </p>
137
+ </div>
138
+ <?php
139
+ }
140
  ?>
141
 
142
  <div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
pages/admin/woosea-manage-settings.php CHANGED
@@ -101,6 +101,20 @@ if(isset($_GET["tab"])) {
101
  ?>
102
  </span>
103
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  <!-- wordpress provides the styling for tabs. -->
106
  <h2 class="nav-tab-wrapper">
@@ -290,6 +304,24 @@ if(isset($_GET["tab"])) {
290
  </label>
291
  </td>
292
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  <tr>
294
  <td>
295
  <span><?php _e( 'Remove the local pickup shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
@@ -440,70 +472,89 @@ if(isset($_GET["tab"])) {
440
  $external_path_tsv = $external_base . "/woo-product-feed-pro/";
441
  $external_path_logs = $external_base . "/woo-product-feed-pro/";
442
  $test_file = $external_path . "/tesfile.txt";
443
- $test_file_xml = $external_path . "/xml/tesfile.txt";
444
- $test_file_csv = $external_path . "/csv/tesfile.txt";
445
- $test_file_txt = $external_path . "/txt/tesfile.txt";
446
- $test_file_tsv = $external_path . "/tsv/tesfile.txt";
447
- $test_file_logs = $external_path . "/logs/tesfile.txt";
448
 
449
  if (is_writable($external_path)) {
450
- // Normal root category
451
- $fp = @fopen($test_file, 'w');
452
- @fwrite($fp, 'Cats chase mice');
453
- @fclose($fp);
454
- if(is_file($test_file)){
455
- $directory_perm = "True";
456
- }
457
-
458
- // XML subcategory
459
- $fp = @fopen($test_file_xml, 'w');
460
- @fwrite($fp, 'Cats chase mice');
461
- @fclose($fp);
462
- if(is_file($test_file_xml)){
463
- $directory_perm_xml = "True";
464
- } else {
465
- $directory_perm_xml = "False";
466
- }
467
-
468
- // CSV subcategory
469
- $fp = @fopen($test_file_csv, 'w');
470
- @fwrite($fp, 'Cats chase mice');
471
- @fclose($fp);
472
- if(is_file($test_file_csv)){
473
- $directory_perm_csv = "True";
474
- } else {
475
- $directory_perm_csv = "False";
476
- }
477
-
478
- // TXT subcategory
479
- $fp = @fopen($test_file_txt, 'w');
480
- @fwrite($fp, 'Cats chase mice');
481
- @fclose($fp);
482
- if(is_file($test_file_txt)){
483
- $directory_perm_txt = "True";
484
- } else {
485
- $directory_perm_txt = "False";
486
- }
487
-
488
- // TSV subcategory
489
- $fp = @fopen($test_file_tsv, 'w');
490
- @fwrite($fp, 'Cats chase mice');
491
- @fclose($fp);
492
- if(is_file($test_file_tsv)){
493
- $directory_perm_tsv = "True";
494
- } else {
495
- $directory_perm_tsv = "False";
496
- }
497
-
498
- // Logs subcategory
499
- $fp = @fopen($test_file_logs, 'w');
500
- @fwrite($fp, 'Cats chase mice');
501
- @fclose($fp);
502
- if(is_file($test_file_logs)){
503
- $directory_perm_logs = "True";
504
- } else {
505
- $directory_perm_logs = "False";
506
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  } else {
508
  $directory_perm = "False";
509
  }
@@ -515,6 +566,10 @@ if(isset($_GET["tab"])) {
515
  $cron_enabled = "True";
516
  }
517
 
 
 
 
 
518
  print "<table class=\"woo-product-feed-pro-table\">";
519
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
520
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
101
  ?>
102
  </span>
103
  </div>
104
+
105
+ <?php
106
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
107
+ ?>
108
+ <div class="notice notice-error is-dismissible">
109
+ <p>
110
+ <strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
111
+ We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active for it to be able to update and generate your product feeds. More information on the inner workings of our plugin and instructions on how to enable your WP-Cron can be found here: <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>My feed won't update or is stuck processing</strong></a>.
112
+ </p>
113
+ </div>
114
+ <?php
115
+ }
116
+ ?>
117
+
118
 
119
  <!-- wordpress provides the styling for tabs. -->
120
  <h2 class="nav-tab-wrapper">
304
  </label>
305
  </td>
306
  </tr>
307
+ <tr>
308
+ <td>
309
+ <span><?php _e( 'Remove the free shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
310
+ </td>
311
+ <td>
312
+ <label class="woo-product-feed-pro-switch">
313
+ <?php
314
+ $remove_free_shipping = get_option ('remove_free_shipping');
315
+ if($remove_free_shipping == "yes"){
316
+ print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\" checked>";
317
+ } else {
318
+ print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\">";
319
+ }
320
+ ?>
321
+ <div class="woo-product-feed-pro-slider round"></div>
322
+ </label>
323
+ </td>
324
+ </tr>
325
  <tr>
326
  <td>
327
  <span><?php _e( 'Remove the local pickup shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
472
  $external_path_tsv = $external_base . "/woo-product-feed-pro/";
473
  $external_path_logs = $external_base . "/woo-product-feed-pro/";
474
  $test_file = $external_path . "/tesfile.txt";
475
+ $test_file_xml = $external_path . "xml/tesfile.txt";
476
+ $test_file_csv = $external_path . "csv/tesfile.txt";
477
+ $test_file_txt = $external_path . "txt/tesfile.txt";
478
+ $test_file_tsv = $external_path . "tsv/tesfile.txt";
479
+ $test_file_logs = $external_path . "logs/tesfile.txt";
480
 
481
  if (is_writable($external_path)) {
482
+ // Normal root category
483
+ $fp = @fopen($test_file, 'w');
484
+ @fwrite($fp, 'Cats chase mice');
485
+ @fclose($fp);
486
+ if(is_file($test_file)){
487
+ $directory_perm = "True";
488
+ }
489
+
490
+ // XML subcategory
491
+ $fp = @fopen($test_file_xml, 'w');
492
+ if(!is_bool($fp)){
493
+ @fwrite($fp, 'Cats chase mice');
494
+ @fclose($fp);
495
+ if(is_file($test_file_xml)){
496
+ $directory_perm_xml = "True";
497
+ } else {
498
+ $directory_perm_xml = "False";
499
+ }
500
+ } else {
501
+ $directory_perm_xml = "Unknown";
502
+ }
503
+
504
+ // CSV subcategory
505
+ $fp = @fopen($test_file_csv, 'w');
506
+ if(!is_bool($fp)){
507
+ @fwrite($fp, 'Cats chase mice');
508
+ @fclose($fp);
509
+ if(is_file($test_file_csv)){
510
+ $directory_perm_csv = "True";
511
+ } else {
512
+ $directory_perm_csv = "False";
513
+ }
514
+ } else {
515
+ $directory_perm_csv = "Unknown";
516
+ }
517
+
518
+ // TXT subcategory
519
+ $fp = @fopen($test_file_txt, 'w');
520
+ if(!is_bool($fp)){
521
+ @fwrite($fp, 'Cats chase mice');
522
+ @fclose($fp);
523
+ if(is_file($test_file_txt)){
524
+ $directory_perm_txt = "True";
525
+ } else {
526
+ $directory_perm_txt = "False";
527
+ }
528
+ } else {
529
+ $directory_perm_txt = "Unknown";
530
+ }
531
+ // TSV subcategory
532
+ $fp = @fopen($test_file_tsv, 'w');
533
+ if(!is_bool($fp)){
534
+ @fwrite($fp, 'Cats chase mice');
535
+ @fclose($fp);
536
+ if(is_file($test_file_tsv)){
537
+ $directory_perm_tsv = "True";
538
+ } else {
539
+ $directory_perm_tsv = "False";
540
+ }
541
+ } else {
542
+ $directory_perm_tsv = "Uknown";
543
+ }
544
+
545
+ // Logs subcategory
546
+ $fp = @fopen($test_file_logs, 'w');
547
+ if(!is_bool($fp)){
548
+ @fwrite($fp, 'Cats chase mice');
549
+ @fclose($fp);
550
+ if(is_file($test_file_logs)){
551
+ $directory_perm_logs = "True";
552
+ } else {
553
+ $directory_perm_logs = "False";
554
+ }
555
+ } else {
556
+ $directory_perm_logs = "Unknown";
557
+ }
558
  } else {
559
  $directory_perm = "False";
560
  }
566
  $cron_enabled = "True";
567
  }
568
 
569
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
570
+ $cron_enabled = "<strong>False</strong>";
571
+ }
572
+
573
  print "<table class=\"woo-product-feed-pro-table\">";
574
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
575
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
readme.txt CHANGED
@@ -4,15 +4,15 @@ License: GPLv3
4
  License URI: http://www.gnu.org/licenses/gpl.html
5
  Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
6
  Requires at least: 4.5
7
- Tested up to: 5.6
8
- Stable tag: 9.3.7
9
 
10
  == Description ==
11
 
12
- Generate WooCommerce product feeds for all your marketing channels, such as Google Shopping (merchant center), Facebook Remarketing, Bing Ads, Billiger.de, Pricerunner, Vergelijk.nl and many more. Next to custom feeds there are over 100 pre-defined templates included for marketplaces, comparison shopping engines and search engines. This plugin provides high-quality product feed for Google Shopping and many many more.
13
 
14
  = Why choose this plugin? =
15
- Simply because this is the most complete plugin offering support for an unlimited number of products and feeds, including features such as category- & field-mapping and advanced, rule-based, filtering and product variables support.
16
 
17
  = Our mission =
18
  Offer free and advanced, intuitive, tooling and plugins for website owners and marketers to easily set-up and manage their online marketing campaigns.
@@ -61,21 +61,24 @@ This plugin enables you to add and configure Google Analytics UTM tracking-codes
61
  = Shipping class support =
62
  This plugin enables you to set the shipping zone (and shipping class) so the right shipping cost end up in your product feed. Our plugin uses all shipping zone settings you have configured in WooCommerce (flat rates, classes and free shipping). Our support also supports US and Australian postal codes and regions.
63
 
 
 
 
64
  = WooCommerce Shipping Table Rate (Bolder Elements) support =
65
  Our plugin supports the WooCommerce Shipping Table Rate plugin created by Bolder Elements.
66
 
67
  = Product variations / Variables =
68
  This plugin supports product variables so all your variations make it to product feeds as individual products too.
69
 
70
- = Facebook Pixel (Elite version) =
71
  This plugin adds the Facebook pixel code on your websites and makes sure it matches the content of your Facebook catalogue product feed
72
  Our plugin add's the following Facebook pixel events:
73
  * on your product pages, both for simple, variable and variations pages
74
  * on your category pages (ViewCategory event)
75
  * on your search result pages (Search event)
76
  * on your cart page (AddToCart event)
77
- * on the add to cart button (AddToCart event)
78
- * on the thank you page (PurChase event)
79
 
80
  = Google Dynamic Remarketing Pixel =
81
  This plugin adds the Google Dynamic Remarketing pixel code on your website.
@@ -112,6 +115,8 @@ Our plugin supports Polylang
112
  * XML, CSV, TSV and TXT formats;
113
  * Supports WPML (version 4.1 and higher)
114
  * Supports WCML, WooCommerce Multilingual
 
 
115
  * Intuitive interface;
116
  * Supports product variations / variables;
117
  * Scheduled product feed refreshes: daily, twice-daily or every hour;
@@ -134,19 +139,19 @@ Our plugin supports Polylang
134
  * Supports WooCommerce Dynamic Pricing & Discounts from RightPress
135
  * Supports the Discount Rules for WooCommerce plugin from FlyCart
136
  * Supports WC Fields Factory
 
137
  * Supports Table Rate Shipping for WooCommerce from Bolder Elements
138
  * Supports usage of the All In One SEO pack title and description attributes
139
 
140
  Some of the above mentioned feature can only be used by users who upgraded to the Elite version of our plugin
141
 
142
  === Elite paid features ===
143
- * WPML support
144
  * Aelia currency switcher support
145
  * Polylang support
146
  * Addition of the extra fields on your product edit pages
147
  * Data manipulation feature
148
  * WooCommerce structured data bug fix
149
- * Facebook pixel
150
 
151
  === Channels ===
152
  * Custom feeds
@@ -160,6 +165,7 @@ Some of the above mentioned feature can only be used by users who upgraded to th
160
  * Google Shopping Actions
161
  * Facebook Dynamic Ad’s / remarketing
162
  * Bing Shopping
 
163
  * Pinterest
164
  * <a href="https://businesshelp.snapchat.com/en-US/a/product-catalog-specs" target="_blank">Snapchat</a>
165
  * <a href="https://yandex.com/support/market-tech-requirements/index.html" target="_blank">Yandex</a>
@@ -175,6 +181,7 @@ Some of the above mentioned feature can only be used by users who upgraded to th
175
  * <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
176
  * <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
177
  * <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
 
178
  * Bol.com
179
  * Stylight
180
  * Incurvy
@@ -229,6 +236,7 @@ Some of the above mentioned feature can only be used by users who upgraded to th
229
  * <a href="https://www.guenstiger.de" target="_blank" rel="nofollow">Guenstiger.de</a>
230
  * Hood.de
231
  * Ladenzeile.de
 
232
  * Livingo.de
233
  * Medizinfuchs.de
234
  * <a href="https://www.moebel.de" target="_blank">Moebel.de</a>
@@ -249,13 +257,13 @@ Some of the above mentioned feature can only be used by users who upgraded to th
249
  == Installation ==
250
 
251
  === From within Wordpress ===
252
- 1. Visit Plugins > Add New’;
253
- 1. Search for Product Feed PRO for WooCommerce’;
254
- 1. Activate Product Feed PRO for WooCommerce from your plugins page.
255
 
256
  === Manually ===
257
  1. Upload the woo-product-feed-pro folder to your /wp-content/plugins/ directory;
258
- 1. Activate Product Feed PRO for WooCommerce from your plugins page.
259
 
260
  == Frequently Asked Questions ==
261
 
@@ -322,6 +330,179 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
322
 
323
  === Changelog ===
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  = 9.3.7 (2021-01-12) =
326
  * Added the Bestprice.gr template
327
 
@@ -2988,6 +3169,179 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
2988
 
2989
  == Upgrade Notice ==
2990
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2991
  = 9.3.7 =
2992
  Added the Bestprice.gr template
2993
 
4
  License URI: http://www.gnu.org/licenses/gpl.html
5
  Tags: Product Feed, Google Shopping, Google Shopping Feed, WooCommerce Product Feed, WooCommerce Product Feed PRO, Bing Shopping, Bing product feed, Bing remarking, Google Merchant Feed, Google DRM Feed, Google Dynamic Remarketing Feed, Facebook feed, Google feed, Bing feed, Facebook Product Feed, Facebook Dynamic remarketing, Data Feed, WooCommerce Feed, XML product feed, CSV product feed, TSV, TXT product feed, comparison shopping engines, comparison shopping websites, vergelijk.nl, vergelijk.be, vertaa.fi, beslist.nl, kieskeurig.nl, bol.com, raketten, pricerunner, pricegrabber, Buy, leGuide, Kelkoo, Twenga, Yandex, Etsy, Dealtime, Shopzilla, Billiger, Google Product Review feed
6
  Requires at least: 4.5
7
+ Tested up to: 5.7
8
+ Stable tag: 9.9.2
9
 
10
  == Description ==
11
 
12
+ Generate WooCommerce product feeds for all your marketing channels, such as Google Shopping (merchant center), Facebook Remarketing, Bing Ads, Billiger.de, Pricerunner, Skroutz and many more. Next to custom feeds there are over 100 pre-defined templates included for marketplaces, comparison shopping engines and search engines. This plugin provides high-quality product feed for Google Shopping and many many more.
13
 
14
  = Why choose this plugin? =
15
+ Simply because this is the most complete plugin offering support for an unlimited number of products and feeds, including features such as category- & field-mapping and advanced, rule-based, filtering and product variables support. Next to creating product feeds this plugin also add's the Facebook pixel and Google Dynamic Remarketing pixel to your website and makes sure they are aligned with your feeds.
16
 
17
  = Our mission =
18
  Offer free and advanced, intuitive, tooling and plugins for website owners and marketers to easily set-up and manage their online marketing campaigns.
61
  = Shipping class support =
62
  This plugin enables you to set the shipping zone (and shipping class) so the right shipping cost end up in your product feed. Our plugin uses all shipping zone settings you have configured in WooCommerce (flat rates, classes and free shipping). Our support also supports US and Australian postal codes and regions.
63
 
64
+ = WooCommerce Shipping Table Rate (official WooCommerce) support =
65
+ Our plugin supports the official shipping table rate plugin of WooCommerce
66
+
67
  = WooCommerce Shipping Table Rate (Bolder Elements) support =
68
  Our plugin supports the WooCommerce Shipping Table Rate plugin created by Bolder Elements.
69
 
70
  = Product variations / Variables =
71
  This plugin supports product variables so all your variations make it to product feeds as individual products too.
72
 
73
+ = Facebook Pixel =
74
  This plugin adds the Facebook pixel code on your websites and makes sure it matches the content of your Facebook catalogue product feed
75
  Our plugin add's the following Facebook pixel events:
76
  * on your product pages, both for simple, variable and variations pages
77
  * on your category pages (ViewCategory event)
78
  * on your search result pages (Search event)
79
  * on your cart page (AddToCart event)
80
+ * on the checkout page (initiateCheckout event)
81
+ * on the order thank you page (PurChase event)
82
 
83
  = Google Dynamic Remarketing Pixel =
84
  This plugin adds the Google Dynamic Remarketing pixel code on your website.
115
  * XML, CSV, TSV and TXT formats;
116
  * Supports WPML (version 4.1 and higher)
117
  * Supports WCML, WooCommerce Multilingual
118
+ * Supports Aelia Currency Switcher
119
+ * Supports Polylang
120
  * Intuitive interface;
121
  * Supports product variations / variables;
122
  * Scheduled product feed refreshes: daily, twice-daily or every hour;
139
  * Supports WooCommerce Dynamic Pricing & Discounts from RightPress
140
  * Supports the Discount Rules for WooCommerce plugin from FlyCart
141
  * Supports WC Fields Factory
142
+ * Supports Table Rate Shipping for WooCommerce from WooCommerce
143
  * Supports Table Rate Shipping for WooCommerce from Bolder Elements
144
  * Supports usage of the All In One SEO pack title and description attributes
145
 
146
  Some of the above mentioned feature can only be used by users who upgraded to the Elite version of our plugin
147
 
148
  === Elite paid features ===
149
+ * WPML / WCML support
150
  * Aelia currency switcher support
151
  * Polylang support
152
  * Addition of the extra fields on your product edit pages
153
  * Data manipulation feature
154
  * WooCommerce structured data bug fix
 
155
 
156
  === Channels ===
157
  * Custom feeds
165
  * Google Shopping Actions
166
  * Facebook Dynamic Ad’s / remarketing
167
  * Bing Shopping
168
+ * Bing Shopping Promotions
169
  * Pinterest
170
  * <a href="https://businesshelp.snapchat.com/en-US/a/product-catalog-specs" target="_blank">Snapchat</a>
171
  * <a href="https://yandex.com/support/market-tech-requirements/index.html" target="_blank">Yandex</a>
181
  * <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
182
  * <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
183
  * <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
184
+ * <a href="https://www.boetiek.nl" target="_blank">Boetiek.nl</a>
185
  * Bol.com
186
  * Stylight
187
  * Incurvy
236
  * <a href="https://www.guenstiger.de" target="_blank" rel="nofollow">Guenstiger.de</a>
237
  * Hood.de
238
  * Ladenzeile.de
239
+ * <a href="https://connect.idealo.de/import/en/csv/#_attributes_documentation" target="_blank">Idealo.de</a>
240
  * Livingo.de
241
  * Medizinfuchs.de
242
  * <a href="https://www.moebel.de" target="_blank">Moebel.de</a>
257
  == Installation ==
258
 
259
  === From within Wordpress ===
260
+ 1. Visit Plugins > Add New;
261
+ 1. Search for Product Feed PRO for WooCommerce;
262
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
263
 
264
  === Manually ===
265
  1. Upload the woo-product-feed-pro folder to your /wp-content/plugins/ directory;
266
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
267
 
268
  == Frequently Asked Questions ==
269
 
330
 
331
  === Changelog ===
332
 
333
+ = 9.9.2 (2021-03-27) =
334
+ * Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
335
+
336
+ = 9.9.1 (2021-03-25) =
337
+ * Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
338
+
339
+ = 9.9.0 (2021-03-24) =
340
+ * Added product type field mapping to the Facebook template
341
+ * Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
342
+
343
+ = 9.8.9 (2021-03-22) =
344
+ * Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
345
+
346
+ = 9.8.8 (2021-03-22) =
347
+ * Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
348
+
349
+ = 9.8.7 (2021-03-22) =
350
+ * Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
351
+
352
+ = 9.8.6 (2021-03-19) =
353
+ * Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
354
+
355
+ = 9.8.5 (2021-03-18) =
356
+ * Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
357
+
358
+ = 9.8.4 (2021-03-18) =
359
+ * Added the Idealo.de Germany template, including their Direktkauf fields
360
+
361
+ = 9.8.3 (2021-03-15) =
362
+ * Solved a rounding issue for sale prices including VAT
363
+
364
+ = 9.8.2 (2021-03-15) =
365
+ * Fixed a Facebook Purchase event where only the value of the last product was added to the Facebook pixel instead of the value of all products bought
366
+
367
+ = 9.8.1 (2021-03-13) =
368
+ * The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
369
+
370
+ = 9.8.0 (2021-03-11) =
371
+ * Only reviews that are approved make it to the review feeds, disapproved reviews are removed
372
+
373
+ = 9.7.9 (2021-03-10) =
374
+ * Checked for compatibility with WordPress 5.7
375
+ * Checked for compatibility with WooCommerce 5.1
376
+
377
+ = 9.7.8 (2021-03-10) =
378
+ * Added a boolean check on the review feed creation
379
+
380
+ = 9.7.7 (2021-03-09) =
381
+ * Removed the woosea_add_cart.js from the source as it was an empty file
382
+
383
+ = 9.7.6 (2021-03-08) =
384
+ * Fixed an issue with the Facebook Purchase event that did not track the order value correct
385
+
386
+ = 9.7.5 (2021-03-07) =
387
+ * Another recode of the lowest price variation feature
388
+
389
+ = 9.7.4 (2021-03-05) =
390
+ * Added Bing Shopping Promotions template
391
+
392
+ = 9.7.3 (2021-03-04) =
393
+ * Added a new attribute "Stock Status WooCommerce"
394
+ * Fixed another quote issue with the Facebook pixel
395
+
396
+ = 9.7.2 (2021-03-03) =
397
+ * Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
398
+
399
+ = 9.7.1 (2021-03-03) =
400
+ * Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
401
+
402
+ = 9.7.0 (2021-03-03) =
403
+ * Fixed a bug where lowest priced variations where not making it to feeds
404
+
405
+ = 9.6.9 (2021-02-28) =
406
+ * Added product name parent hyphen attribute
407
+
408
+ = 9.6.8 (2021-02-25) =
409
+ * Added Google category taxonomy mapping for Snapchat feeds
410
+
411
+ = 9.6.7 (2021-02-25) =
412
+ * When suffixes and prefixes are used for the Heureka URL fields spaces are removed
413
+
414
+ = 9.6.6 (2021-02-24) =
415
+ * Added support for PHP 8.0
416
+
417
+ = 9.6.5 (2021-02-24) =
418
+ * Do not add Skroutz variable products to the feed when they do not have item_group_id's
419
+
420
+ = 9.6.4 (2021-02-24) =
421
+ * Fixed an issue with rules and filters
422
+ * When a rule was set on an image link, no longer lowercase the image link
423
+
424
+ = 9.6.3 (2021-02-23) =
425
+ * Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
426
+ * Reverted back some changes in filters and rules
427
+
428
+ = 9.6.2 (2021-02-22) =
429
+ * For Skroutz feed removing sizes from feeds when they are out-of-stock
430
+
431
+ = 9.6.1 (2021-02-19) =
432
+ * Added attribute that will allow you to uppercase every first character of a string in product names
433
+
434
+ = 9.6.0 (2021-02-19) =
435
+ * Changed g:itemid to g:id for the Google Local Product Feeds
436
+
437
+ = 9.5.9 (2021-02-19) =
438
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
439
+
440
+ = 9.5.8 (2021-02-18) =
441
+ * Added shipping class name attribute
442
+
443
+ = 9.5.7 (2021-02-17) =
444
+ * Dynamic attribute values are now also added to parent variable products for Skroutz feeds
445
+
446
+ = 9.5.6 (2021-02-17) =
447
+ * Changed attribute name primary category to Yoast primary category as it caused lots of confussion
448
+
449
+ = 9.5.5 (2021-02-11) =
450
+ * Fixed a PHP notice that showed when creating a new rule
451
+ * Tested for compatibility with WooCommerce 5.0
452
+
453
+ = 9.5.4 (2021-02-09) =
454
+ * When free shipping zones are removed do not remove the other shipping zones
455
+
456
+ = 9.5.3 (2021-02-08) =
457
+ * Added a feature to remove free shipping zones from Google and Facebook feeds
458
+
459
+ = 9.5.2 (2021-02-08) =
460
+ * Fixed a minor issue in exclude rules for WooCommerce category names
461
+
462
+ = 9.5.1 (2021-02-02) =
463
+ * Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
464
+
465
+ = 9.5.0 (2021-02-01) =
466
+ * Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
467
+
468
+ = 9.4.9 (2021-01-31) =
469
+ * Added a seperate sale price attribute for bundled products
470
+ * Reviews for parent variable products are removed, the reviews are attached to its variations
471
+
472
+ = 9.4.8 (2021-01-30) =
473
+ * Fixed an issue with the ecomm_prodid on the cart page
474
+
475
+ = 9.4.7 (2021-01-29) =
476
+ * Solved an issue that shipping costs to the first product in a custom feed where empty
477
+
478
+ = 9.4.6 (2021-01-28) =
479
+ * Added a new attribute: product description parent product
480
+
481
+ = 9.4.5 (2021-01-28) =
482
+ * Added a Google Shopping field to their template: g:ship_from_country
483
+ * Stripping & characters from review names as it breaks the review feeds
484
+
485
+ = 9.4.4 (2021-01-27) =
486
+ * Fixed an issue where reviews without review text caused the feed to be disapproved by Google. We now remove reviews from feeds that have no review texts.
487
+
488
+ = 9.4.3 (2021-01-27) =
489
+ * Fixed an issue with an undefined ecomm_price variable on product variable pages
490
+
491
+ = 9.4.2 (2021-01-26) =
492
+ * Added the Dutch Boetiek.nl template
493
+
494
+ = 9.4.1 (2021-01-19) =
495
+ * Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
496
+
497
+ = 9.4.0 (2021-01-14) =
498
+ * Added a WP-cron check and notifications
499
+
500
+ = 9.3.9 (2021-01-14) =
501
+ * Bestprice.gr apparel products are now grouped by color
502
+
503
+ = 9.3.8 (2021-01-13) =
504
+ * Tested for compatibility with WooCommerce 4.9
505
+
506
  = 9.3.7 (2021-01-12) =
507
  * Added the Bestprice.gr template
508
 
3169
 
3170
  == Upgrade Notice ==
3171
 
3172
+ = 9.9.2 =
3173
+ Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
3174
+
3175
+ = 9.9.1 =
3176
+ Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
3177
+
3178
+ = 9.9.0 =
3179
+ Added product type field mapping to the Facebook template
3180
+ Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
3181
+
3182
+ = 9.8.9 =
3183
+ Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
3184
+
3185
+ = 9.8.8 =
3186
+ Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
3187
+
3188
+ = 9.8.7 =
3189
+ Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
3190
+
3191
+ = 9.8.6 =
3192
+ Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
3193
+
3194
+ = 9.8.5 =
3195
+ Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
3196
+
3197
+ = 9.8.4 =
3198
+ Added the Idealo.de Germany template, including their Direktkauf fields
3199
+
3200
+ = 9.8.3 =
3201
+ Solved a rounding issue for sale prices including VAT
3202
+
3203
+ = 9.8.2 =
3204
+ Fixed a Facebook Purchase event where only the value of the last product was added to the Facebook pixel instead of the value of all products bought
3205
+
3206
+ = 9.8.1 =
3207
+ The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
3208
+
3209
+ = 9.8.0 =
3210
+ Only reviews that are approved make it to the review feeds, disapproved reviews are removed
3211
+
3212
+ = 9.7.9 =
3213
+ Checked for compatibility with WordPress 5.7
3214
+ Checked for compatibility with WooCommerce 5.1.0
3215
+
3216
+ = 9.7.8 =
3217
+ Added a boolean check on the review feed creation
3218
+
3219
+ = 9.7.7 =
3220
+ Removed the woosea_add_cart.js from the source as it was an empty file
3221
+
3222
+ = 9.7.6 =
3223
+ Fixed an issue with the Facebook Purchase event that did not track the order value correct
3224
+
3225
+ = 9.7.5 =
3226
+ Another recode of the lowest price variation feature
3227
+
3228
+ = 9.7.4 =
3229
+ Added Bing Shopping Promotions template
3230
+
3231
+ = 9.7.3 =
3232
+ Added a new attribute "Stock Status WooCommerce"
3233
+ Fixed another quote issue with the Facebook pixel
3234
+
3235
+ = 9.7.2 =
3236
+ Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
3237
+
3238
+ = 9.7.1 =
3239
+ Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
3240
+
3241
+ = 9.7.0 =
3242
+ Fixed a bug where lowest priced variations where not making it to feeds
3243
+
3244
+ = 9.6.9 =
3245
+ Added product name parent hyphen attribute
3246
+
3247
+ = 9.6.8 =
3248
+ Added Google category taxonomy mapping for Snapchat feeds
3249
+
3250
+ = 9.6.7 =
3251
+ When suffixes and prefixes are used for the Heureka URL fields spaces are removed
3252
+
3253
+ = 9.6.6 =
3254
+ Added support for PHP 8.0
3255
+
3256
+ = 9.6.5 =
3257
+ Do not add Skroutz variable products to the feed when they do not have item_group_id's
3258
+
3259
+ = 9.6.4 =
3260
+ Fixed an issue with rules and filters
3261
+ When a rule was set on an image link, no longer lowercase the image link
3262
+
3263
+ = 9.6.3 =
3264
+ Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
3265
+ Reverted back some changes in filters and rules
3266
+
3267
+ = 9.6.2 =
3268
+ For Skroutz feed removing sizes from feeds when they are out-of-stock
3269
+
3270
+ = 9.6.1 =
3271
+ Added attribute that will allow you to uppercase every first character of a string in product names
3272
+
3273
+ = 9.6.0 =
3274
+ Changed g:itemid to g:id for the Google Local Product Feeds
3275
+
3276
+ = 9.5.9 =
3277
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
3278
+
3279
+ = 9.5.8 =
3280
+ Added shipping class name attribute
3281
+
3282
+ = 9.5.7 =
3283
+ Dynamic attribute values are now also added to parent variable products for Skroutz feeds
3284
+
3285
+ = 9.5.6 =
3286
+ Changed attribute name primary category to Yoast primary category as it caused lots of confussion
3287
+
3288
+ = 9.5.5 =
3289
+ Fixed a PHP notice that showed when creating a new rule
3290
+ Tested for compatibility with WooCommerce 5.0
3291
+
3292
+ = 9.5.4 =
3293
+ When free shipping zones are removed do not remove the other shipping zones
3294
+
3295
+ = 9.5.3 =
3296
+ Added a feature to remove free shipping zones from Google and Facebook feeds
3297
+
3298
+ = 9.5.2 =
3299
+ Fixed a minor issue in exclude rules for WooCommerce category names
3300
+
3301
+ = 9.5.1 =
3302
+ Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
3303
+
3304
+ = 9.5.0 =
3305
+ Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
3306
+
3307
+ = 9.4.9 =
3308
+ Added a seperate sale price attribute for bundled products
3309
+ Reviews for parent variable products are removed, the reviews are attached to its variations
3310
+
3311
+ = 9.4.8 =
3312
+ Fixed an issue with the ecomm_prodid on the cart page
3313
+
3314
+ = 9.4.7 =
3315
+ Solved an issue that shipping costs to the first product in a custom feed where empty
3316
+
3317
+ = 9.4.6 =
3318
+ Added a new attribute: product description parent product
3319
+
3320
+ = 9.4.5 =
3321
+ Added a Google Shopping field to their template: g:ship_from_country
3322
+ Stripping & characters from review names as it breaks the review feeds
3323
+
3324
+ = 9.4.4 =
3325
+ Fixed an issue where reviews without review text caused the feed to be disapproved by Google. We now remove reviews from feeds that have no review texts.
3326
+
3327
+ = 9.4.3 =
3328
+ Fixed an issue with an undefined ecomm_price variable on product variable pages
3329
+
3330
+ = 9.4.2 =
3331
+ Added the Dutch Boetiek.nl template
3332
+
3333
+ = 9.4.1 =
3334
+ Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
3335
+
3336
+ = 9.4.0 =
3337
+ Added a WP-cron check and notifications
3338
+
3339
+ = 9.3.9 =
3340
+ Bestprice.gr apparel products are now grouped by color
3341
+
3342
+ = 9.3.8 =
3343
+ Tested for compatibility with WooCommerce 4.9
3344
+
3345
  = 9.3.7 =
3346
  Added the Bestprice.gr template
3347
 
woocommerce-sea.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
- * Version: 9.3.7
5
  * Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
6
  * Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
7
  * Author: AdTribes.io
@@ -11,13 +11,13 @@
11
  * License: GPL3
12
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
  * Requires at least: 4.5
14
- * Tested up to: 5.6
15
  *
16
  * Text Domain: woo-product-feed-pro
17
  * Domain Path: /languages
18
  *
19
  * WC requires at least: 4.4
20
- * WC tested up to: 4.8
21
  *
22
  * Product Feed PRO for WooCommerce is free software: you can redistribute it and/or modify
23
  * it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ if (!defined('ABSPATH')) {
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
- define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '9.3.7' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
@@ -115,7 +115,7 @@ function woosea_scripts($hook) {
115
  wp_enqueue_script( 'typeahead-js' );
116
 
117
  // JS for adding input field validation
118
- wp_register_script( 'woosea_validation-js', plugin_dir_url( __FILE__ ) . 'js/woosea_validation.js?BLAAT=999', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
119
  wp_enqueue_script( 'woosea_validation-js' );
120
 
121
  // JS for autocomplete
@@ -123,7 +123,7 @@ function woosea_scripts($hook) {
123
  wp_enqueue_script( 'woosea_autocomplete-js' );
124
 
125
  // JS for adding table rows to the rules page
126
- wp_register_script( 'woosea_rules-js', plugin_dir_url( __FILE__ ) . 'js/woosea_rules.js?BLAAT=1', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
127
  wp_enqueue_script( 'woosea_rules-js' );
128
 
129
  // JS for adding table rows to the field mappings page
@@ -279,7 +279,7 @@ add_filter('plugin_action_links', 'woosea_plugin_action_links', 10, 2);
279
  /**
280
  * Get category path for Facebook pixel
281
  */
282
- function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxonomy, $nicename = false, $visited = array() ) {
283
  // Only add Home to the beginning of the chain when we start buildin the chain
284
  if(empty($visited)){
285
  $chain = 'Home';
@@ -302,7 +302,7 @@ function woosea_get_term_parents( $id, $taxonomy, $link = false, $project_taxono
302
 
303
  if ($parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited, TRUE )){
304
  $visited[] = $parent->parent;
305
- $chain .= woosea_get_term_parents( $parent->parent, $taxonomy, $link, $separator, $nicename, $visited );
306
  }
307
 
308
  if ($link){
@@ -335,6 +335,9 @@ function woosea_add_facebook_pixel( $product = null ){
335
 
336
  $fb_prodid = get_the_id();
337
  $product_name = $product->get_name();
 
 
 
338
  $cats = "";
339
  $all_cats = get_the_terms( $fb_prodid, 'product_cat' );
340
  if(!empty($all_cats)){
@@ -345,9 +348,10 @@ function woosea_add_facebook_pixel( $product = null ){
345
  // strip last comma
346
  $cats = rtrim($cats, ",");
347
  $cats = str_replace("&amp;","&", $cats);
 
 
348
 
349
  if(!empty($fb_prodid)){
350
-
351
  if(!$product) {
352
  return -1;
353
  }
@@ -433,8 +437,8 @@ function woosea_add_facebook_pixel( $product = null ){
433
  $order = wc_get_order( $order_id );
434
  $order_items = $order->get_items();
435
  $currency = get_woocommerce_currency();
436
- $order_real = 0;
437
  $contents = "";
 
438
 
439
  if ( !is_wp_error( $order_items )) {
440
  foreach( $order_items as $item_id => $order_item) {
@@ -443,13 +447,7 @@ function woosea_add_facebook_pixel( $product = null ){
443
  if($variation_id > 0){
444
  $prod_id = $variation_id;
445
  }
446
-
447
  $prod_quantity = $order_item->get_quantity();
448
- $order_real = wc_format_localized_price( $order_item->get_total() );
449
-
450
- // $order_subtotal = number_format(($order_item->get_subtotal()),2, '.', '');
451
- // $order_subtotal_tax= number_format(($order_item->get_subtotal_tax()),2, '.', '');
452
- // $order_real = number_format(($order_subtotal+$order_subtotal_tax+$order_real),2,',','');
453
  $contents .= "{'id': '$prod_id', 'quantity': $prod_quantity},";
454
  }
455
  }
@@ -463,6 +461,8 @@ function woosea_add_facebook_pixel( $product = null ){
463
  $cart_real = 0;
464
  $contents = "";
465
 
 
 
466
  $checkoutpage = wc_get_checkout_url();
467
  $current_url = get_permalink(get_the_ID());
468
 
@@ -477,20 +477,15 @@ function woosea_add_facebook_pixel( $product = null ){
477
  //$contents .= "$prod_id,";
478
 
479
  $cart_real = wc_format_localized_price( $cart_item['line_total'] );
480
-
481
- // $line_total = number_format(($cart_item['line_total']),2, '.','');
482
- // $line_tax = number_format(($cart_item['line_tax']),2, '.','');
483
- // $cart_real = number_format($cart_real,2, '.','');
484
- // $cart_real = number_format(($line_total+$line_tax+$cart_real),2,',','');
485
  }
486
  $contents = rtrim($contents, ",");
487
 
488
  // User is on the billing pages
489
  if($checkoutpage == $current_url){
490
- $viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_real\", content_type:\"product\", content_ids:[$contents]});";
491
  } else {
492
  // User is on the basket page
493
- $viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_real\", content_type:\"product\", content_ids:[$contents]});";
494
  }
495
  }
496
  }
@@ -523,8 +518,8 @@ function woosea_add_facebook_pixel( $product = null ){
523
  }
524
  $fb_prodid = rtrim($fb_prodid, ",");
525
  $category_name = $term->name;
526
- $category_path = woosea_get_term_parents( $term->term_id, 'product_cat', $link = false, $project_taxonomy = false, $nicename = false, $visited = array() );
527
- $viewContent = "fbq(\"track\",\"ViewCategory\",{content_category:\"$category_path\", content_name:\"$category_name\", content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
528
  } elseif ($fb_pagetype == "searchresults"){
529
  $term = get_queried_object();
530
  $search_string = sanitize_text_field($_GET['s']);
@@ -553,7 +548,7 @@ function woosea_add_facebook_pixel( $product = null ){
553
  }
554
  }
555
  $fb_prodid = rtrim($fb_prodid, ",");
556
- $viewContent = "fbq(\"trackCustom\",\"Search\",{search_string:\"$search_string\", content_type:\"product\", content_ids:\"[\"$fb_prodid\"]\"});";
557
  } else {
558
  // This is another page than a product page
559
  $viewContent = "";
@@ -622,7 +617,7 @@ function woosea_add_remarketing_tags( $product = null ){
622
  // In that case we need to put in the AggregateOffer structured data
623
  $variation_id = woosea_find_matching_product_variation( $product, $_GET );
624
  $nr_get = count($_GET);
625
-
626
  if($nr_get > 0){
627
  $variable_product = wc_get_product($variation_id);
628
 
@@ -659,7 +654,9 @@ function woosea_add_remarketing_tags( $product = null ){
659
  $ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
660
  } else {
661
  $ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
662
- $ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
 
 
663
  }
664
  }
665
  } else {
@@ -671,14 +668,18 @@ function woosea_add_remarketing_tags( $product = null ){
671
  var google_tag_params = {
672
  ecomm_prodid: <?php print "$ecomm_prodid";?>,
673
  ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
674
- ecomm_totalvalue: '<?php print "$ecomm_price";?>',
675
  };
676
  </script>
677
 
678
  <?php
679
  }
680
  } elseif ($ecomm_pagetype == "cart"){
681
- $ecomm_prodid = get_the_id();
 
 
 
 
682
  ?>
683
  <script type="text/javascript">
684
  var google_tag_params = {
@@ -804,6 +805,7 @@ function woosea_request_review(){
804
  }
805
  add_action('admin_notices', 'woosea_request_review');
806
 
 
807
  /**
808
  * Create a seperate MySql table for saving conversion information
809
  */
@@ -2285,6 +2287,21 @@ function woosea_local_pickup_shipping (){
2285
  }
2286
  add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
2287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2288
  /**
2289
  * This function enables the setting to use
2290
  * logging
@@ -4618,13 +4635,16 @@ function woosea_blog_widgets() {
4618
 
4619
  add_meta_box('woosea_rss_dashboard_widget', __('Latest Product Feed Pro Tutorials', 'rc_mdm'), 'woosea_my_rss_box','dashboard','side','high');
4620
  }
4621
- add_action('wp_dashboard_setup', 'woosea_blog_widgets');
4622
 
4623
  /**
4624
  * Creates the RSS metabox
4625
  */
 
 
 
 
4626
  function woosea_my_rss_box() {
4627
-
4628
  // Get RSS Feed(s)
4629
  include_once(ABSPATH . WPINC . '/feed.php');
4630
  $domain = $_SERVER['HTTP_HOST'];
@@ -4633,6 +4653,8 @@ function woosea_my_rss_box() {
4633
  $my_feeds = array(
4634
  'https://www.adtribes.io/feed/'
4635
  );
 
 
4636
 
4637
  // Loop through Feeds
4638
  foreach ( $my_feeds as $feed) :
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
+ * Version: 9.9.2
5
  * Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
6
  * Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
7
  * Author: AdTribes.io
11
  * License: GPL3
12
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
  * Requires at least: 4.5
14
+ * Tested up to: 5.7
15
  *
16
  * Text Domain: woo-product-feed-pro
17
  * Domain Path: /languages
18
  *
19
  * WC requires at least: 4.4
20
+ * WC tested up to: 5.1
21
  *
22
  * Product Feed PRO for WooCommerce is free software: you can redistribute it and/or modify
23
  * it under the terms of the GNU General Public License as published by
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
+ define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '9.9.2' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
115
  wp_enqueue_script( 'typeahead-js' );
116
 
117
  // JS for adding input field validation
118
+ wp_register_script( 'woosea_validation-js', plugin_dir_url( __FILE__ ) . 'js/woosea_validation.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
119
  wp_enqueue_script( 'woosea_validation-js' );
120
 
121
  // JS for autocomplete
123
  wp_enqueue_script( 'woosea_autocomplete-js' );
124
 
125
  // JS for adding table rows to the rules page
126
+ wp_register_script( 'woosea_rules-js', plugin_dir_url( __FILE__ ) . 'js/woosea_rules.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
127
  wp_enqueue_script( 'woosea_rules-js' );
128
 
129
  // JS for adding table rows to the field mappings page
279
  /**
280
  * Get category path for Facebook pixel
281
  */
282
+ function woosea_get_term_parents( $id, $taxonomy, $project_taxonomy, $link = false, $nicename = false, $visited = array() ) {
283
  // Only add Home to the beginning of the chain when we start buildin the chain
284
  if(empty($visited)){
285
  $chain = 'Home';
302
 
303
  if ($parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited, TRUE )){
304
  $visited[] = $parent->parent;
305
+ $chain .= woosea_get_term_parents( $parent->parent, $taxonomy, $separator, $link = false, $nicename, $visited );
306
  }
307
 
308
  if ($link){
335
 
336
  $fb_prodid = get_the_id();
337
  $product_name = $product->get_name();
338
+ $product_name = str_replace("\"","",$product_name);
339
+ $product_name = str_replace("'","",$product_name);
340
+
341
  $cats = "";
342
  $all_cats = get_the_terms( $fb_prodid, 'product_cat' );
343
  if(!empty($all_cats)){
348
  // strip last comma
349
  $cats = rtrim($cats, ",");
350
  $cats = str_replace("&amp;","&", $cats);
351
+ $cats = str_replace("\"","",$cats);
352
+ $cats = str_replace("'","",$cats);
353
 
354
  if(!empty($fb_prodid)){
 
355
  if(!$product) {
356
  return -1;
357
  }
437
  $order = wc_get_order( $order_id );
438
  $order_items = $order->get_items();
439
  $currency = get_woocommerce_currency();
 
440
  $contents = "";
441
+ $order_real = wc_format_localized_price($order->get_total());
442
 
443
  if ( !is_wp_error( $order_items )) {
444
  foreach( $order_items as $item_id => $order_item) {
447
  if($variation_id > 0){
448
  $prod_id = $variation_id;
449
  }
 
450
  $prod_quantity = $order_item->get_quantity();
 
 
 
 
 
451
  $contents .= "{'id': '$prod_id', 'quantity': $prod_quantity},";
452
  }
453
  }
461
  $cart_real = 0;
462
  $contents = "";
463
 
464
+ $cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
465
+
466
  $checkoutpage = wc_get_checkout_url();
467
  $current_url = get_permalink(get_the_ID());
468
 
477
  //$contents .= "$prod_id,";
478
 
479
  $cart_real = wc_format_localized_price( $cart_item['line_total'] );
 
 
 
 
 
480
  }
481
  $contents = rtrim($contents, ",");
482
 
483
  // User is on the billing pages
484
  if($checkoutpage == $current_url){
485
+ $viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
486
  } else {
487
  // User is on the basket page
488
+ $viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
489
  }
490
  }
491
  }
518
  }
519
  $fb_prodid = rtrim($fb_prodid, ",");
520
  $category_name = $term->name;
521
+ $category_path = woosea_get_term_parents( $term->term_id, 'product_cat', $project_taxonomy = false, $link = false, $nicename = false, $visited = array() );
522
+ $viewContent = "fbq(\"track\",\"ViewCategory\",{content_category:'$category_path', content_name:'$category_name', content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
523
  } elseif ($fb_pagetype == "searchresults"){
524
  $term = get_queried_object();
525
  $search_string = sanitize_text_field($_GET['s']);
548
  }
549
  }
550
  $fb_prodid = rtrim($fb_prodid, ",");
551
+ $viewContent = "fbq(\"trackCustom\",\"Search\",{search_string:\"$search_string\", content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
552
  } else {
553
  // This is another page than a product page
554
  $viewContent = "";
617
  // In that case we need to put in the AggregateOffer structured data
618
  $variation_id = woosea_find_matching_product_variation( $product, $_GET );
619
  $nr_get = count($_GET);
620
+
621
  if($nr_get > 0){
622
  $variable_product = wc_get_product($variation_id);
623
 
654
  $ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
655
  } else {
656
  $ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
657
+ $ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
658
+ $ecomm_price = $ecomm_lowprice;
659
+
660
  }
661
  }
662
  } else {
668
  var google_tag_params = {
669
  ecomm_prodid: <?php print "$ecomm_prodid";?>,
670
  ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
671
+ ecomm_totalvalue: <?php print "$ecomm_price";?>,
672
  };
673
  </script>
674
 
675
  <?php
676
  }
677
  } elseif ($ecomm_pagetype == "cart"){
678
+ // Get the first product from cart and use that product ID
679
+ foreach( WC()->cart->get_cart() as $cart_item ){
680
+ $ecomm_prodid = $cart_item['product_id'];
681
+ break;
682
+ }
683
  ?>
684
  <script type="text/javascript">
685
  var google_tag_params = {
805
  }
806
  add_action('admin_notices', 'woosea_request_review');
807
 
808
+
809
  /**
810
  * Create a seperate MySql table for saving conversion information
811
  */
2287
  }
2288
  add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
2289
 
2290
+ /**
2291
+ * This function enables the setting to remove
2292
+ * free shipping zones
2293
+ */
2294
+ function woosea_remove_free_shipping (){
2295
+ $status = sanitize_text_field($_POST['status']);
2296
+
2297
+ if ($status == "off"){
2298
+ update_option( 'remove_free_shipping', 'no', 'yes');
2299
+ } else {
2300
+ update_option( 'remove_free_shipping', 'yes', 'yes');
2301
+ }
2302
+ }
2303
+ add_action( 'wp_ajax_woosea_remove_free_shipping', 'woosea_remove_free_shipping' );
2304
+
2305
  /**
2306
  * This function enables the setting to use
2307
  * logging
4635
 
4636
  add_meta_box('woosea_rss_dashboard_widget', __('Latest Product Feed Pro Tutorials', 'rc_mdm'), 'woosea_my_rss_box','dashboard','side','high');
4637
  }
4638
+ //add_action('wp_dashboard_setup', 'woosea_blog_widgets');
4639
 
4640
  /**
4641
  * Creates the RSS metabox
4642
  */
4643
+ function woosea_feed_interval( $seconds ) {
4644
+ return 172800; // Cache the feed for 2 days
4645
+ }
4646
+
4647
  function woosea_my_rss_box() {
 
4648
  // Get RSS Feed(s)
4649
  include_once(ABSPATH . WPINC . '/feed.php');
4650
  $domain = $_SERVER['HTTP_HOST'];
4653
  $my_feeds = array(
4654
  'https://www.adtribes.io/feed/'
4655
  );
4656
+
4657
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'woosea_feed_interval' );
4658
 
4659
  // Loop through Feeds
4660
  foreach ( $my_feeds as $feed) :