Product Feed PRO for WooCommerce - Version 10.1.8

Version Description

When the identifier exists field mapping is removed from the field mapping also remove it from the feed Some minor textual changes in the feed configuration forms

Download this release

Release Info

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

Code changes from version 9.3.7 to 10.1.8

TODO.txt CHANGED
@@ -3,20 +3,27 @@ Missing some features you might like? Drop me a line at support@adtribes.io and
3
 
4
  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
3
 
4
  Tutorial / Blog posts:
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
+ - product highlight / details article
7
 
8
  Priority issues:
9
+ - Autosuggest for category mapping broken
10
+ - Add AddToCart event on buttons again
11
+ - identifier exists field mapping wel halen in field mapping
12
+ - Add Vivino EXTRA fields, see: https://vivino.slab.com/public/posts/9gq0o3dg
13
+ - Local product feed - store code should also work with an attribute and not just static values
14
+ - Add Pinterest Tag; https://help.pinterest.com/nl/business/article/install-the-pinterest-tag
15
  - License key input field needs to be a password field (asterixes)
16
+ - Allow adding multiple pictures to Yandex feeds, see:https://wordpress.org/support/topic/yandex-yml-support/#post-14344829
17
+ - A seperate FB pixel per WPML website / language
18
  - Add a preview option so only 5-10 products are being generated
19
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
20
  - Google local product feed inventory in XML format (not just TXT like it is now)
21
  - Add support for Multisites
22
  - Add a filter on review score (and amount of reviews)
23
  - Make extra woosea fields available for front-end usage
 
24
  - Add header to extra fields on product edit pages
25
  - Add possibility to create OR rules
26
  - Add support for Google My Business product feeds
 
27
  - AMAZON integration:
28
  - requires a professional seller account, 39 dollar a month, before being able to create a developer account
29
+ - 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
@@ -132,8 +132,8 @@ class WooSEA_google_shopping {
132
  "Product type" => array(
133
  "name" => "product_type",
134
  "feed_name" => "g:product_type",
135
- "format" => "optional",
136
- "woo_suggest" => "product_type",
137
  ),
138
  ),
139
  "Product identifiers" => array(
@@ -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(
@@ -425,6 +430,31 @@ class WooSEA_google_shopping {
425
  "feed_name" => "g:google_funded_promotion_eligibility",
426
  "format" => "optional",
427
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  ),
429
  );
430
  return $google_attributes;
132
  "Product type" => array(
133
  "name" => "product_type",
134
  "feed_name" => "g:product_type",
135
+ "format" => "required",
136
+ "woo_suggest" => "raw_categories",
137
  ),
138
  ),
139
  "Product identifiers" => 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(
430
  "feed_name" => "g:google_funded_promotion_eligibility",
431
  "format" => "optional",
432
  ),
433
+ "Pickup method" => array(
434
+ "name" => "pickup_method",
435
+ "feed_name" => "g:pickup_method",
436
+ "format" => "optional",
437
+ ),
438
+ "Pickup SLA" => array(
439
+ "name" => "pickup_SLA",
440
+ "feed_name" => "g:pickup_SLA",
441
+ "format" => "optional",
442
+ ),
443
+ "Pickup link template" => array(
444
+ "name" => "pickup_link_template",
445
+ "feed_name" => "g:pickup_link_template",
446
+ "format" => "optional",
447
+ ),
448
+ "Store code" => array(
449
+ "name" => "store_code",
450
+ "feed_name" => "g:store_code",
451
+ "format" => "optional",
452
+ ),
453
+ "Mobile pickup link template" => array(
454
+ "name" => "mobile_pickup_link_template",
455
+ "feed_name" => "g:mobile_pickup_link_template",
456
+ "format" => "optional",
457
+ ),
458
  ),
459
  );
460
  return $google_attributes;
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",
@@ -1321,8 +1335,7 @@ class WooSEA_Activation {
1321
  "fields" => "compari_ro",
1322
  "taxonomy" => "none",
1323
  "utm_source" => "Compari.ro",
1324
- "type" => "Comparison shopping engine" ),
1325
-
1326
  ),
1327
  "Russian Federation" => array (
1328
  "Yandex" => array (
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",
1335
  "fields" => "compari_ro",
1336
  "taxonomy" => "none",
1337
  "utm_source" => "Compari.ro",
1338
+ "type" => "Comparison shopping engine" ),
 
1339
  ),
1340
  "Russian Federation" => array (
1341
  "Yandex" => array (
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",
@@ -235,6 +239,10 @@ public function get_mapping_attributes_dropdown() {
235
  "vivino_sale_price" => "Pinterest / Vivino sale price",
236
  "vivino_regular_price" => "Pinterest / Vivino regular price",
237
  "non_geo_wcml_price" => "Non GEO WCML price",
 
 
 
 
238
  "discount_percentage" => "Discount percentage",
239
  "link" => "Link",
240
  "variable_link" => "Product variable link",
@@ -247,9 +255,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 +276,9 @@ 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 +361,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 +410,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 +445,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",
@@ -456,7 +473,11 @@ public function get_mapping_attributes_dropdown() {
456
  "vivino_sale_price" => "Pinterest / Vivino sale price",
457
  "vivino_regular_price" => "Pinterest / Vivino regular price",
458
  "non_geo_wcml_price" => "Non GEO WCML price",
459
- "discount_percentage" => "Discount percentage",
 
 
 
 
460
  "item_group_id" => "Item group ID",
461
  "weight" => "Weight",
462
  "width" => "Width",
@@ -464,7 +485,9 @@ 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",
239
  "vivino_sale_price" => "Pinterest / Vivino sale price",
240
  "vivino_regular_price" => "Pinterest / Vivino regular price",
241
  "non_geo_wcml_price" => "Non GEO WCML price",
242
+ "mm_min_price" => "Mix & Match minimum price",
243
+ "mm_min_regular_price" => "Mix & Match minimum regular price",
244
+ "mm_max_price" => "Mix & Match maximum price",
245
+ "mm_max_regular_price" => "Mix & Match maximum regular price",
246
  "discount_percentage" => "Discount percentage",
247
  "link" => "Link",
248
  "variable_link" => "Product variable link",
255
  "category_path" => "Category path",
256
  "category_path_short" => "Category path short",
257
  "category_path_skroutz" => "Category path Skroutz",
258
+ "one_category" => "Yoast / Rankmath primary category",
259
  "condition" => "Condition",
260
+ "availability" => "Availability",
261
+ "stock_status" => "Stock Status WooCommerce",
262
  "quantity" => "Quantity [Stock]",
263
  "product_type" => "Product Type",
264
  "content_type" => "Content Type",
276
  "length" => "Length",
277
  "shipping" => "Shipping",
278
  "shipping_price" => "Shipping cost",
279
+ "lowest_shipping_costs" => "Lowest shipping costs",
280
+ "shipping_label" => "Shipping class slug",
281
+ "shipping_label_name" => "Shipping class name",
282
  "visibility" => "Visibility",
283
  "rating_total" => "Total rating",
284
  "rating_average" => "Average rating",
361
 
362
  foreach ($custom_attributes as $key => $value) {
363
  if (!preg_match("/pyre|sbg|fusion/i",$value)){
364
+ $value = ltrim($value);
365
+ if (!empty($value)){
366
  $dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
367
+ }
368
  }
369
  }
370
 
410
  "parent_sku" => "SKU parent variable product",
411
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
412
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
413
+ "title" => "Product name",
414
+ "title_hyphen" => "Product name hyphen",
415
+ "mother_title" => "Product name parent product",
416
+ "mother_title_hyphen" => "Product name parent product hyphen",
417
  "title_lc" => "Product name lowercase",
418
+ "title_lcw" => "Product name uppercase first characters",
419
  "description" => "Product description",
420
  "short_description" => "Product short description",
421
  "raw_description" => "Unfiltered product description",
422
  "raw_short_description" => "Unfiltered product short description",
423
+ "mother_description" => "Product description parent product",
424
+ "mother_short_description" => "Product short description parent product",
425
+ "link" => "Link",
426
  "variable_link" => "Product variable link",
427
  "add_to_cart_link" => "Add to cart link",
428
  "image" => "Main image",
445
  "category_path" => "Category path",
446
  "category_path_short" => "Category path short",
447
  "category_path_skroutz" => "Category path Skroutz",
448
+ "one_category" => "Yoast / Rankmath primary category",
449
  "condition" => "Condition",
450
  "availability" => "Availability",
451
+ "stock_status" => "Stock Status WooCommerce",
452
+ "quantity" => "Quantity [Stock]",
453
  "price" => "Price",
454
  "regular_price" => "Regular price",
455
  "sale_price" => "Sale price",
473
  "vivino_sale_price" => "Pinterest / Vivino sale price",
474
  "vivino_regular_price" => "Pinterest / Vivino regular price",
475
  "non_geo_wcml_price" => "Non GEO WCML price",
476
+ "mm_min_price" => "Mix & Match minimum price",
477
+ "mm_min_regular_price" => "Mix & Match minimum regular price",
478
+ "mm_max_price" => "Mix & Match maximum price",
479
+ "mm_max_regular_price" => "Mix & Match maximum regular price",
480
+ "discount_percentage" => "Discount percentage",
481
  "item_group_id" => "Item group ID",
482
  "weight" => "Weight",
483
  "width" => "Width",
485
  "length" => "Length",
486
  "shipping" => "Shipping",
487
  "shipping_price" => "Shipping cost",
488
+ "lowest_shipping_costs" => "Lowest shipping costs",
489
+ "shipping_label" => "Shipping class slug",
490
+ "shipping_label_name" => "Shipping class name",
491
  "visibility" => "Visibility",
492
  "rating_total" => "Total rating",
493
  "rating_average" => "Average rating",
classes/class-get-products.php CHANGED
@@ -23,10 +23,11 @@ class WooSEA_Get_Products {
23
  * Function to add CDATA brackets to title, short_description and description attributes
24
  */
25
  protected function woosea_append_cdata( $string ){
26
- return "<![CDATA[ $string ]]>";
 
 
27
  }
28
 
29
-
30
  /**
31
  * Check if a plugin is active
32
  */
@@ -57,6 +58,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 +79,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 +187,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 +213,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
  }
@@ -257,8 +270,10 @@ class WooSEA_Get_Products {
257
  $product_attr = unserialize($value->type);
258
  if(!empty($product_attr)){
259
  foreach ($product_attr as $key_inner => $arr_value) {
260
- $value_display = @str_replace("_", " ",$arr_value['name']);
261
- $list[$key_inner] = ucfirst($value_display);
 
 
262
  }
263
  }
264
  }
@@ -324,7 +339,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 +378,15 @@ class WooSEA_Get_Products {
363
  return $chain;
364
  }
365
 
 
 
 
 
 
 
 
 
 
366
  /**
367
  * Get all configured shipping zones
368
  */
@@ -652,7 +676,7 @@ class WooSEA_Get_Products {
652
  /**
653
  * Get shipping cost for product
654
  */
655
- public function woosea_get_shipping_cost ($class_cost_id, $project_config, $price, $tax_rates, $shipping_zones, $product_id, $item_group_id) {
656
  $shipping_cost = 0;
657
  $shipping_arr = array();
658
  $zone_count = 0;
@@ -712,6 +736,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'])){
@@ -743,7 +769,7 @@ class WooSEA_Get_Products {
743
  if($taxable == "taxable"){
744
  foreach ($tax_rates as $k_inner => $w){
745
  if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
746
- $rate = (($w['rate']+100)/100);
747
 
748
  $shipping_cost = str_replace(",", ".", $shipping_cost);
749
  $shipping_cost = $shipping_cost*$rate;
@@ -754,22 +780,22 @@ class WooSEA_Get_Products {
754
  }
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 +813,85 @@ 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 +1025,16 @@ class WooSEA_Get_Products {
931
  unset($shipping_cost);
932
  }
933
  }
 
 
 
 
 
 
 
 
 
 
934
  }
935
 
936
  if(isset($zone_details)){
@@ -948,7 +1052,12 @@ class WooSEA_Get_Products {
948
  }
949
  }
950
  }
951
-
 
 
 
 
 
952
  if(isset($shipping_cost)){
953
  if(strlen($shipping_cost) > 0){
954
  if($project_config['ship_suffix'] == "false"){
@@ -957,12 +1066,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 +1098,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 +1118,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
  }
@@ -1141,20 +1252,24 @@ class WooSEA_Get_Products {
1141
  $link = $product->addChild('g:additional_image_link', $v, $namespace['g']);
1142
  //$product->$k = $v;
1143
  } elseif (preg_match("/g:product_highlight/i",$k)){
 
1144
  $product_highlight = $product->addChild('g:product_highlight', $v, $namespace['g']);
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)){
@@ -1317,10 +1432,10 @@ class WooSEA_Get_Products {
1317
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><products></products>');
1318
  $xml->addAttribute('version', '1.0');
1319
  $xml->addAttribute('standalone', 'yes');
1320
- $xml->addChild('datetime', date('Y-m-d H:i:s'));
1321
- $xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1322
- $xml->addChild('link', site_url());
1323
- $xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1324
  $xml->asXML($file);
1325
  }
1326
  } else {
@@ -1355,194 +1470,203 @@ 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
  }
1542
  }
1543
 
1544
  foreach ($products as $key => $value){
1545
-
1546
  if ((is_array ( $value )) and (!empty( $value ))) {
1547
  if ($feed_config['name'] == "Yandex") {
1548
  $product = $xml->shop->offers->addChild('offer');
@@ -1676,11 +1800,10 @@ class WooSEA_Get_Products {
1676
  $product->addChild("$k");
1677
  $product->$k = $v;
1678
  } else {
1679
- if ($feed_config['fields'] != 'standard'){
1680
  $k = $this->get_alternative_key ($channel_attributes, $k);
1681
  }
1682
  if(!empty($k)){
1683
-
1684
  /**
1685
  * Some Zbozi and Heureka attributes need some extra XML nodes
1686
  */
@@ -1798,7 +1921,7 @@ class WooSEA_Get_Products {
1798
  $channel_attributes = get_option('channel_attributes');
1799
  }
1800
  }
1801
-
1802
  // Append or write to file
1803
  $fp = fopen($file, 'a+');
1804
 
@@ -1815,7 +1938,7 @@ class WooSEA_Get_Products {
1815
  $pieces = str_replace("'", "", $pieces);
1816
 
1817
  foreach ($pieces as $k_inner => $v){
1818
- if ($feed_config['fields'] != 'standard'){
1819
  $v = $this->get_alternative_key ($channel_attributes, $v);
1820
  }
1821
 
@@ -1993,7 +2116,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
 
@@ -2248,10 +2371,9 @@ class WooSEA_Get_Products {
2248
  // Check if there are mother categories
2249
  if(!empty($product_cat)){
2250
  $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
2251
- $category_path_skroutz = preg_replace('/&gt;/', '>', $category_path);
2252
- //$category_path_skroutz = str_replace('&gt;','>',$category_path);
2253
 
2254
- if(!is_object($category_path)){
 
2255
  $product_data['category_path'] = $category_path;
2256
  $product_data['category_path_skroutz'] = $category_path_skroutz;
2257
  $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
@@ -2290,6 +2412,19 @@ class WooSEA_Get_Products {
2290
  }
2291
  }
2292
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2293
  $product_data['category_path_short'] = str_replace("Home &gt;","",$product_data['category_path']);
2294
  $product_data['category_path_short'] = str_replace("&gt;",">",$product_data['category_path_short']);
2295
  $product_data['category_link'] = $catlink;
@@ -2325,6 +2460,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 +2489,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 +2499,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") {
@@ -2430,6 +2572,8 @@ class WooSEA_Get_Products {
2430
 
2431
  $product_data['shipping'] = 0;
2432
  $tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class() );
 
 
2433
  $shipping_class_id = $product->get_shipping_class_id();
2434
  $shipping_class= $product->get_shipping_class();
2435
 
@@ -2439,6 +2583,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()));
@@ -2448,32 +2596,57 @@ class WooSEA_Get_Products {
2448
  $product_data['regular_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_regular_price()));
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()));
2458
- $product_data['system_price'] = ($product->get_regular_price()) ? $this->get_product_price($product, $product->get_regular_price()) : '';
2459
- $product_data['system_price'] = wc_format_decimal($product_data['system_price'],2);
2460
-
2461
- $product_data['system_sale_price'] = wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price()));
2462
- $sale_price = $product_data['system_sale_price'];
2463
- //$product_data['system_sale_price'] = ($product->get_sale_price() != $sale_price) ? $this->get_product_price($product, $sale_price ) : '';
2464
- $product_data['system_sale_price'] = wc_format_decimal($product_data['system_sale_price'],2);
 
 
 
2465
 
2466
- if(!empty($tax_rates)){
2467
 
2468
- foreach ($tax_rates as $tk => $tv){
2469
- if($tv['rate'] > 0){
2470
- $tax_rates[1]['rate'] = $tv['rate'];
2471
- } else {
2472
- $tax_rates[1]['rate'] = 0;
 
 
 
 
 
 
 
 
 
 
 
2473
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2474
  }
2475
- } else {
2476
- $tax_rates[1]['rate'] = 0;
2477
  }
2478
 
2479
  $fullrate = 100+$tax_rates[1]['rate'];
@@ -2485,6 +2658,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);
@@ -2525,9 +2699,16 @@ class WooSEA_Get_Products {
2525
 
2526
  // Make sure the product ID is not NULL either
2527
  global $woocommerce_wpml;
2528
- if(!is_null($product_data['WCML'])){
2529
- $product_data['non_geo_wcml_price'] = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $product_data['id'], $project_config['WCML'] );
2530
- }
 
 
 
 
 
 
 
2531
 
2532
  // When WCML manual prices have been entered
2533
  if(!is_null($product_data['id'])){
@@ -2557,21 +2738,23 @@ class WooSEA_Get_Products {
2557
  }
2558
  if($product->get_regular_price()){
2559
  $product_data['regular_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())) * (100+$tax_rates[1]['rate'])/100,2);
2560
- $product_data['net_regular_price'] = ($product->get_regular_price()/$fullrate)*100;
2561
- $product_data['net_regular_price'] = round($product_data['net_regular_price'],2);
 
2562
  }
2563
  if($product->get_sale_price()){
2564
  $product_data['sale_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())) * (100+$tax_rates[1]['rate'])/100,2);
2565
- $product_data['net_sale_price'] = ($product->get_sale_price()/$fullrate)*100;
2566
- $product_data['net_sale_price'] = round($product_data['net_sale_price'],2);
2567
-
2568
  // We do not want to have 0 sale price values in the feed
2569
  if($product_data['net_sale_price'] == 0){
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 +2765,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);
@@ -2690,6 +2874,24 @@ class WooSEA_Get_Products {
2690
  }
2691
  }
2692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2693
  // Localize the price attributes
2694
  $decimal_separator = wc_get_price_decimal_separator();
2695
  $product_data['price'] = wc_format_localized_price($product_data['price']);
@@ -2697,12 +2899,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
 
@@ -2716,15 +2924,29 @@ class WooSEA_Get_Products {
2716
  $product_data['net_sale_price'] = wc_format_localized_price($product_data['net_sale_price']);
2717
  }
2718
 
2719
- $product_data['system_price'] = wc_format_localized_price($product_data['system_price']);
2720
- $product_data['system_net_price'] = wc_format_localized_price($product_data['system_net_price']);
2721
- $product_data['system_regular_price'] = wc_format_localized_price($product_data['system_regular_price']);
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){
@@ -2735,15 +2957,15 @@ class WooSEA_Get_Products {
2735
  if(is_array($attr_arr)){
2736
  if($attr_arr['attribute'] == "g:shipping"){
2737
  if($product_data['price'] > 0){
2738
- $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']);
2739
  $shipping_str = $product_data['shipping'];
2740
  }
2741
  }
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
  }
2749
 
@@ -2751,7 +2973,8 @@ class WooSEA_Get_Products {
2751
  if(!empty($shipping_str)){
2752
  $product_data['shipping_price'] = 0;
2753
  }
2754
- $shipping_arr = $product_data['shipping'];
 
2755
 
2756
  if(is_array($shipping_arr)){
2757
  foreach($shipping_arr as $akey => $arr){
@@ -2759,6 +2982,7 @@ class WooSEA_Get_Products {
2759
  $pieces_ship = explode (" ", $arr['price']);
2760
  if(isset($pieces_ship['1'])){
2761
  $product_data['shipping_price'] = $pieces_ship['1'];
 
2762
  }
2763
  }
2764
 
@@ -2773,6 +2997,28 @@ class WooSEA_Get_Products {
2773
  }
2774
  }
2775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2776
  // Google Dynamic Remarketing feeds require the English price notation
2777
  if ($project_config['name'] == "Google Remarketing - DRM"){
2778
  $thousand_separator = wc_get_price_thousand_separator();
@@ -2838,7 +3084,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 +3094,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 +3108,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
  }
@@ -2928,7 +3173,15 @@ class WooSEA_Get_Products {
2928
  foreach($custom_attributes as $custom_kk => $custom_vv){
2929
  $custom_value = get_post_meta( $product_data['id'], $custom_kk, true );
2930
  $new_key ="custom_attributes_" . $custom_kk;
2931
-
 
 
 
 
 
 
 
 
2932
  // Just to make sure the title is never empty
2933
  if(($custom_kk == "_aioseop_title") && ($custom_value == "")){
2934
  $custom_value = $product_data['title'];
@@ -2977,7 +3230,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 +3248,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 +3281,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 +3359,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 +3517,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 +3551,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,14 +3700,32 @@ 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
 
3446
  /**
3447
  * Get product reviews for Google Product Review Feeds
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 +3791,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 +3816,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 +3830,79 @@ 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 +3936,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 +4008,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']."'";
@@ -3838,6 +4192,7 @@ class WooSEA_Get_Products {
3838
  $shipping_str .= ":WOOSEA_POSTAL_CODE##$v";
3839
  } elseif ($k == "price"){
3840
  $shipping_str .= ":WOOSEA_PRICE##$attr_value[prefix] $v $attr_value[suffix]";
 
3841
  } else {
3842
  // UNKNOWN, DO NOT ADD
3843
  }
@@ -3874,7 +4229,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]";
@@ -4144,9 +4499,9 @@ class WooSEA_Get_Products {
4144
  }
4145
  // New policy of Google, only when the value is yes add it to the feed
4146
  // 28 October 2019
4147
- // if($identifier_exists == "yes"){
4148
  $xml_product['g:identifier_exists'] = $identifier_exists;
4149
- //}
4150
  }
4151
  return $xml_product;
4152
  }
@@ -4404,479 +4759,483 @@ 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 +5258,529 @@ 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
  }
23
  * Function to add CDATA brackets to title, short_description and description attributes
24
  */
25
  protected function woosea_append_cdata( $string ){
26
+ if(!empty($string)){
27
+ return "<![CDATA[$string]]>";
28
+ }
29
  }
30
 
 
31
  /**
32
  * Check if a plugin is active
33
  */
58
  * Get all approved product review comments for Google's Product Review Feeds
59
  */
60
  public function woosea_get_reviews ( $product_data, $product ) {
61
+ // Rwviews for the parent variable product itself can be skipped, the review is added for the variation
62
+ if($product_data['product_type'] == "variable"){
63
+ return;
64
+ }
65
+
66
  $approved_reviews = array();
67
  $prod_id = $product_data['id'];
68
 
79
 
80
  // Loop through all product reviews for this specific products (ternary operators)
81
  foreach($reviews as $review_raw){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
+ // Only reviews that are approved will make it to the feed
84
+ if($review_raw->comment_approved == 1){
85
+
86
+ $review = array();
87
+ $review['review_reviewer_image'] = empty($product_data['reviewer_image']) ? '' : $product_data['reviewer_image'];
88
+ $review['review_ratings'] = get_comment_meta( $review_raw->comment_ID, 'rating', true);
89
+ $review['review_id'] = $review_raw->comment_ID;
90
+
91
+ // Names need to be anonomyzed
92
+ $name_pieces = explode(" ", $review_raw->comment_author);
93
+ $nr_name_pieces = count($name_pieces);
94
+ $cnt = 0;
95
+ $name = "";
96
+ foreach($name_pieces as $n_piece){
97
+ $n_piece = str_replace("&amp;", "", $n_piece);
98
+
99
+ if($cnt > 0){
100
+ $n_piece = ucfirst(substr($n_piece, 0, 1));
101
+ }
102
+ $name .= $n_piece." ";
103
+ $cnt++;
104
+ }
105
+
106
+ // Remove strange charachters from reviewer name
107
+ $review['reviewer_name'] = $this->rip_tags(trim(ucfirst($name)));
108
+ $review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
109
+ $review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
110
+ $review['reviewer_name'] = str_replace("&#xa0;", "", $review['reviewer_name']);
111
+ $review['reviewer_name'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
112
+
113
+ $review['reviewer_id'] = $review_raw->user_id;
114
+ $review['review_timestamp'] = $review_raw->comment_date;
115
+
116
+ // Remove strange characters from review title
117
+ $review['title'] = empty($product_data['title']) ? '' : $product_data['title'];
118
+ $review['title'] = $this->rip_tags($review['title']);
119
+ $review['title'] = html_entity_decode((str_replace("\r", "", $review['title'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
120
+ $review['title'] = preg_replace( '/\[(.*?)\]/', ' ', $review['title'] );
121
+ $review['title'] = str_replace("&#xa0;", "", $review['title']);
122
+ $review['title'] = $this->woosea_utf8_for_xml( $review['title'] );
123
+
124
+ // Remove strange charchters from review content
125
+ $review['content'] = $review_raw->comment_content;
126
+ $review['content'] = $this->rip_tags($review['content']);
127
+ $review['content'] = html_entity_decode((str_replace("\r", "", $review['content'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
128
+ $review['content'] = preg_replace( '/\[(.*?)\]/', ' ', $review['content'] );
129
+ $review['content'] = str_replace("&#xa0;", "", $review['content']);
130
+ $review['content'] = $this->woosea_utf8_for_xml( $review['content'] );
131
+
132
+ $review['review_product_name'] = $product_data['title'];
133
+ $review['review_url'] = $product_data['link'];
134
+ $review['review_product_url'] = $product_data['link'];
135
+ array_push($approved_reviews, $review);
136
+ }
137
  }
138
  $review_count = $product->get_review_count();
139
  $review_average = $product->get_average_rating();
187
  if($feed_config['fields'] == "google_drm"){
188
  $utm_part .= "&$key=$value";
189
  } else {
190
+ $utm_part .= "&$key=$value";
191
  }
192
  }
193
 
213
  if($parentId > 0){
214
  # Even though variation products always have parameters in the URL we still need to check and make sure they are there
215
  if(strpos($link, '?') !== false){
216
+ $utm_part = "&".ltrim($utm_part, '&amp;');
217
  } else {
218
  $utm_part = "?".ltrim($utm_part, '&amp;');
219
  }
270
  $product_attr = unserialize($value->type);
271
  if(!empty($product_attr)){
272
  foreach ($product_attr as $key_inner => $arr_value) {
273
+ if(!array_key_exists('name', $arr_value)){
274
+ $value_display = @str_replace("_", " ",$arr_value['name']);
275
+ $list[$key_inner] = ucfirst($value_display);
276
+ }
277
  }
278
  }
279
  }
339
  /**
340
  * Get category path (needed for Prisjakt)
341
  */
342
+ public function woosea_get_term_parents( $id, $taxonomy, string $link = null, $project_taxonomy, $nicename = false, $visited = array() ) {
343
  // Only add Home to the beginning of the chain when we start buildin the chain
344
  if(empty($visited)){
345
  $chain = 'Home';
378
  return $chain;
379
  }
380
 
381
+ /**
382
+ * Create a floatval for prices
383
+ */
384
+ public function woosea_floatvalue($val){
385
+ $val = str_replace(",",".",$val);
386
+ $val = preg_replace('/\.(?=.*\.)/', '', $val);
387
+ return floatval($val);
388
+ }
389
+
390
  /**
391
  * Get all configured shipping zones
392
  */
676
  /**
677
  * Get shipping cost for product
678
  */
679
+ public function woosea_get_shipping_cost ($class_cost_id, $project_config, $price, $tax_rates, $fullrate, $shipping_zones, $product_id, $item_group_id) {
680
  $shipping_cost = 0;
681
  $shipping_arr = array();
682
  $zone_count = 0;
736
  $shipping_methods = $zone['shipping_methods'];
737
 
738
  foreach ($shipping_methods as $k => $v){
739
+ $method = $v->method_title;
740
+ $shipping_rate_id = $v->instance_id;
741
 
742
  if($v->enabled == "yes"){
743
  if(empty($zone_details['country'])){
769
  if($taxable == "taxable"){
770
  foreach ($tax_rates as $k_inner => $w){
771
  if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
772
+ $rate = (($fullrate)/100);
773
 
774
  $shipping_cost = str_replace(",", ".", $shipping_cost);
775
  $shipping_cost = $shipping_cost*$rate;
780
  }
781
  }
782
 
783
+ // WooCommerce Table Rate - Bolder Elements
784
+ if($method == "Table Rate"){
785
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
786
+ // Set shipping cost
787
+ $shipping_cost = 0;
788
+ if(!empty($product_id)){
789
+ // Add product to cart
790
+ if ((isset($product_id)) AND ($product_id > 0)){
791
+ $quantity = 1;
792
+ if(!empty($code_from_config)){
793
+ defined( 'WC_ABSPATH' ) || exit;
794
+
795
+ // Load cart functions which are loaded only on the front-end.
796
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
797
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
798
+
799
  wc_load_cart();
800
 
801
  WC()->customer->set_shipping_country( $code_from_config );
813
  // Read cart and get schipping costs
814
  foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
815
  $total_cost = WC()->cart->get_total();
816
+ $shipping_cost = WC()->cart->get_shipping_total();
817
+ $shipping_tax = WC()->cart->get_shipping_tax();
818
+ $shipping_cost = ($shipping_cost+$shipping_tax);
819
  $shipping_cost = wc_format_localized_price($shipping_cost);
820
+ }
 
821
  // Make sure to empty the cart again
822
  WC()->cart->empty_cart();
823
+ }
824
+ }
825
+ }
826
+ }
827
+ }
828
+
829
+ // Official WooCommerce Table Rate plugin
830
+ if($method == "Table rates"){
831
+ if($this->woosea_is_plugin_active( 'woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php' )) {
832
+ // Set shipping cost
833
+ $shipping_cost = 0;
834
+ if(!empty($product_id)){
835
+ // Add product to cart
836
+ if ((isset($product_id)) AND ($product_id > 0)){
837
+ $quantity = 1;
838
+ if(!empty($code_from_config)){
839
+ defined( 'WC_ABSPATH' ) || exit;
840
+
841
+ // Load cart functions which are loaded only on the front-end.
842
+ include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
843
+ include_once WC_ABSPATH . 'includes/class-wc-cart.php';
844
+
845
+ wc_load_cart();
846
+
847
+ WC()->shipping()->reset_shipping();
848
+ WC()->customer->set_shipping_country( $code_from_config );
849
+
850
+ if(isset($zone_details['region'])){
851
+ WC()->customer->set_shipping_state(wc_clean( $zone_details['region'] ));
852
+ }
853
+
854
+ if(isset($zone_details['postal_code'])){
855
+ WC()->customer->set_shipping_postcode(wc_clean( $zone_details['postal_code'] ));
856
+ }
857
+ WC()->cart->add_to_cart( $product_id, $quantity );
858
+
859
+ // Read cart and get schipping costs
860
+ foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
861
+ // Loop though shipping packages
862
+ foreach ( WC()->shipping->get_packages() as $key => $package ) {
863
+ // Loop through Shipping rates
864
+ foreach($package['rates'] as $rate_id => $rate ){
865
+ if($rate->instance_id == $shipping_rate_id){
866
+ $shipping_cost = $rate->cost;
867
+ }
868
+ }
869
+ }
870
+ $shipping_tax = WC()->cart->get_shipping_tax();
871
+ $shipping_cost = ($shipping_cost+$shipping_tax);
872
+ $shipping_cost = wc_format_localized_price($shipping_cost);
873
+ }
874
+
875
+ if($taxable == "taxable"){
876
+ foreach ($tax_rates as $k_inner => $w){
877
+ if((isset($w['shipping'])) and ($w['shipping'] == "yes")){
878
+ $rate = (($w['rate']+100)/100);
879
+
880
+ $shipping_cost = str_replace(",", ".", $shipping_cost);
881
+ $shipping_cost = $shipping_cost*$rate;
882
+ $shipping_cost = round($shipping_cost, 2);
883
+ $shipping_cost = wc_format_localized_price($shipping_cost);
884
+ }
885
+ }
886
+ }
887
+
888
+ // Make sure to empty the cart again
889
+ WC()->cart->empty_cart();
890
+ }
891
+ }
892
+ }
893
+ }
894
+ }
895
 
896
  // CLASS SHIPPING COSTS
897
  if((isset($v->instance_settings[$class_cost_id])) AND ($class_cost_id != "no_class_cost")){
1025
  unset($shipping_cost);
1026
  }
1027
  }
1028
+
1029
+ // User do not want to have free shipping in their feed
1030
+ $remove_free_shipping = "no";
1031
+ $remove_free_shipping = get_option ('remove_free_shipping');
1032
+
1033
+ if($remove_free_shipping == "yes"){
1034
+ unset($zone_details['service']);
1035
+ unset($zone_details['price']);
1036
+ unset($shipping_cost);
1037
+ }
1038
  }
1039
 
1040
  if(isset($zone_details)){
1052
  }
1053
  }
1054
  }
1055
+
1056
+ // For Heureka remove currency
1057
+ if($project_config['fields'] == "heureka"){
1058
+ $currency = "";
1059
+ }
1060
+
1061
  if(isset($shipping_cost)){
1062
  if(strlen($shipping_cost) > 0){
1063
  if($project_config['ship_suffix'] == "false"){
1066
  $zone_details['price'] = trim($shipping_cost);
1067
  }
1068
  } else {
 
1069
  if(isset($shipping_cost)){
1070
  $zone_details['price'] = trim($currency." ".$shipping_cost);
1071
  }
 
 
1072
  }
1073
  }
1074
  }
1098
 
1099
  // Remove other shipping classes when free shipping is relevant
1100
  $free_check = "yes";
 
1101
 
1102
  if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
1103
  foreach($shipping_arr as $k => $v) {
1104
  if(!in_array($free_check, $v)){
1105
+
1106
+ // User do not want to have free shipping in their feed
1107
+ // Only remove the other shipping classes when free shipping is not being removed
1108
+ $remove_free_shipping = "no";
1109
+ $remove_free_shipping = get_option ('remove_free_shipping');
1110
+
1111
+ if($remove_free_shipping == "no"){
1112
+ unset($shipping_arr[$k]);
1113
+ }
1114
  }
1115
  }
1116
  }
1118
  // Fix empty services
1119
  foreach($shipping_arr as $k => $v){
1120
  if(empty($v['service'])){
 
 
1121
  unset($shipping_arr[$k]);
1122
  }
1123
  }
1252
  $link = $product->addChild('g:additional_image_link', $v, $namespace['g']);
1253
  //$product->$k = $v;
1254
  } elseif (preg_match("/g:product_highlight/i",$k)){
1255
+ $v = preg_replace('/&/', '&#38;', $v);
1256
  $product_highlight = $product->addChild('g:product_highlight', $v, $namespace['g']);
1257
  } elseif (preg_match("/g:product_detail/i",$k)){
1258
  if(!empty($v)){
1259
  $product_detail_split = explode("#", $v);
1260
+ $detail_complete = count($product_detail_split);
1261
+ if($detail_complete == 2){
1262
+ $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1263
+ $name = str_replace("_", " ", $product_detail_split[0]);
1264
+
1265
+ $section_name = explode(":", $name);
1266
+ $section_name_start = ucfirst($section_name[0]);
1267
+ $name = ucfirst(trim($section_name[1]));
1268
+
1269
+ $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1270
+ $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1271
+ $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
1272
+ }
1273
  }
1274
  } elseif ($k == "g:installment"){
1275
  if(!empty($v)){
1432
  $xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><products></products>');
1433
  $xml->addAttribute('version', '1.0');
1434
  $xml->addAttribute('standalone', 'yes');
1435
+ //$xml->addChild('datetime', date('Y-m-d H:i:s'));
1436
+ //$xml->addChild('title', htmlspecialchars($feed_config['projectname']));
1437
+ //$xml->addChild('link', site_url());
1438
+ //$xml->addChild('description', 'WooCommerce Product Feed PRO - This product feed is created with the free Advanced Product Feed PRO for WooCommerce plugin from AdTribes.io. For all your support questions check out our FAQ on https://www.adtribes.io or e-mail to: support@adtribes.io ');
1439
  $xml->asXML($file);
1440
  }
1441
  } else {
1470
 
1471
  // For Google Product review template
1472
  if (($feed_config['name'] == "Google Product Review") AND (empty($xml->channel))) {
1473
+
1474
+ if(!is_bool($xml)){
1475
+ $product = $xml->addChild('reviews');
1476
 
1477
+ foreach ($products as $key => $value){
1478
 
1479
+ $expl = "||";
1480
+ if(strpos($value['reviews'], $expl)) {
1481
+ $review_data = explode("||", $value['reviews']);
1482
+ foreach($review_data as $rk => $rv){
1483
 
1484
+ $review_comp = explode(":::", $rv);
1485
+ $nr_reviews = count($review_comp);
1486
 
1487
+ if($nr_reviews > 1){
1488
+ $productz = $xml->reviews->addChild('review');
1489
 
1490
+ foreach($review_comp as $rck => $rcv){
1491
+ $nodes = explode("##", $rcv);
1492
+ $nodes = str_replace("::", "", $nodes);
1493
 
1494
+ if($nodes[0] == "REVIEW_RATINGS"){
1495
+ // Do nothing
1496
+ } elseif($nodes[0] == "REVIEW_URL"){
1497
+ $rev_url = $productz->addChild(strtolower($nodes[0]), htmlspecialchars($nodes[1]));
1498
+ $rev_url->addAttribute('type', 'singleton');
1499
+ } elseif(($nodes[0] == "REVIEWER_NAME") OR ($nodes[0] == "REVIEWER_ID")){
1500
+ if(isset($productz->reviewer)){
1501
+ if($nodes[0] == "REVIEWER_NAME"){
1502
+ $name = $nodes[1];
1503
+ if(empty($name)){
1504
+ $reviewer->addChild('name','Anonymous');
1505
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1506
+ } else {
1507
+ $reviewer->addChild('name',$name);
1508
+ }
1509
  } else {
1510
+ if(is_numeric($nodes[1])){
1511
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1512
+ }
1513
  }
1514
  } else {
1515
+ $reviewer = $productz->addChild('reviewer');
1516
+ if($nodes[0] == "REVIEWER_NAME"){
1517
+ $name = $nodes[1];
1518
+ if(empty($name)){
1519
+ $reviewer->addChild('name','Anonymous');
1520
+ $reviewer->name->addAttribute('is_anonymous', 'true');
1521
+ } else {
1522
+ $reviewer->addChild('name',$name);
1523
+ }
1524
  } else {
1525
+ if(is_numeric($nodes[1])){
1526
+ $reviewer->addChild('reviewer_id',$nodes[1]);
1527
+ }
1528
  }
 
 
1529
  }
1530
+ } else {
1531
+ if(isset($nodes[1])){
1532
+ $content = html_entity_decode($nodes[1]);
1533
+ $content = htmlspecialchars($content);
1534
+ $rev = $productz->addChild(strtolower($nodes[0]), $content);
1535
+ }
1536
  }
1537
  }
 
1538
 
1539
+ foreach($review_comp as $rck => $rcv){
1540
+ $nodes = explode("##", $rcv);
1541
+ $nodes = str_replace("::", "", $nodes);
1542
 
1543
+ if($nodes[0] == "REVIEW_RATINGS"){
1544
+ $rev = $productz->addChild('ratings');
1545
+ $over = $productz->ratings->addChild('overall', $nodes[1]);
1546
+ $over->addAttribute('min', '1');
1547
+ $over->addAttribute('max', '5');
1548
+ }
1549
  }
 
 
1550
 
1551
+ $yo = $productz->addChild('products');
1552
+ $po = $yo->addChild('product');
1553
 
1554
+ $identifiers = array("gtin","mpn","sku","brand");
1555
 
1556
+ // Start determining order of product_ids in the Google review feed
1557
+ $proper_order = array("product_name","gtin","mpn","sku","brand","product_url","review_url","reviews");
1558
+ $order_sorted = array();
1559
+ foreach ($proper_order as &$order_value){
1560
+ if(isset($value[$order_value])){
1561
+ $order_sorted[$order_value] = $value[$order_value];
1562
+ }
1563
  }
1564
+ // End
1565
+
1566
+ foreach($order_sorted as $k => $v) {
1567
+ if(($k != "product_name") AND ($k != "product_url")){
1568
+ if(!in_array($k, $identifiers)){
1569
+ if(($k != "reviews") AND ($k != "review_url")){
1570
+ if($k != "product_url"){
1571
+ $v = str_replace("&", "and", $v);
1572
+ }
1573
+ $poa = $po->addChild($k,htmlspecialchars($v));
1574
+ }
1575
+ } else {
1576
+ if(isset($po->product_ids)){
1577
+ if ($k == "gtin"){
1578
+ $poig = $poi->addChild('gtins');
1579
+ $poig->$k = $v;
1580
+ } elseif ($k == "mpn"){
1581
+ $poim = $poi->addChild('mpns');
1582
+ $poim->$k = $v;
1583
+ } elseif ($k == "sku"){
1584
+ $poix = $poi->addChild('skus');
1585
+ $poix->$k = $v;
1586
+ } elseif($k == "brand"){
1587
+ $poib = $poi->addChild('brands');
1588
+ $poib->$k = $v;
1589
+ } else {
1590
+ // Do nothing
1591
+ }
1592
+ } else {
1593
+ $poi = $po->addChild('product_ids');
1594
+ if ($k == "gtin"){
1595
+ $poig = $poi->addChild('gtins');
1596
+ $poig->$k = $v;
1597
+ } elseif ($k == "mpn"){
1598
+ $poim = $poi->addChild('mpns');
1599
+ $poim->$k = $v;
1600
+ } elseif ($k == "sku"){
1601
+ $poix = $poi->addChild('skus');
1602
+ $poix->$k = $v;
1603
+ } elseif($k == "brand"){
1604
+ $poib = $poi->addChild('brands');
1605
+ $poib->$k = $v;
1606
+ } else {
1607
+ // Do nothing
1608
+ }
1609
  }
1610
+ }
1611
+ }
1612
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1613
 
1614
+ // foreach for product name and product url as order seems to mather to Google
1615
+ foreach($value as $k => $v) {
1616
+ if(($k == "product_name") OR ($k == "product_url")){
1617
+ if(!in_array($k, $identifiers)){
1618
+ if(($k != "reviews") AND ($k != "review_url")){
1619
+ if($k != "product_url"){
1620
+ $v = str_replace("&", "and", $v);
1621
+ }
1622
+ $poa = $po->addChild($k,htmlspecialchars($v));
1623
+ }
1624
+ } else {
1625
+ if(isset($po->product_ids)){
1626
+ if ($k == "gtin"){
1627
+ $poig = $poi->addChild('gtins');
1628
+ $poig->$k = $v;
1629
+ } elseif ($k == "mpn"){
1630
+ $poim = $poi->addChild('mpns');
1631
+ $poim->$k = $v;
1632
+ } elseif($k == "sku"){
1633
+ $poix = $poi->addChild('skus');
1634
+ $poix->$k = $v;
1635
+ } elseif($k == "brand"){
1636
+ $poib = $poi->addChild('brands');
1637
+ $poib->$k = $v;
1638
+ } else {
1639
+ // Do nothing
1640
+ }
1641
+ } else {
1642
+ $poi = $po->addChild('product_ids');
1643
+ if ($k == "gtin"){
1644
+ $poig = $poi->addChild('gtins');
1645
+ $poig->$k = $v;
1646
+ } elseif ($k == "mpn"){
1647
+ $poim = $poi->addChild('mpns');
1648
+ $poim->$k = $v;
1649
+ } elseif ($k == "sku"){
1650
+ $poix = $poi->addChild('skus');
1651
+ $poix->$k = $v;
1652
+ } elseif($k == "brand"){
1653
+ $poib = $poi->addChild('brands');
1654
+ $poib->$k = $v;
1655
+ } else {
1656
+ // Do nothing
1657
+ }
1658
  }
1659
+ }
1660
+ }
1661
+ }
1662
+ }
1663
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1664
  }
1665
  }
1666
  }
1667
  }
1668
 
1669
  foreach ($products as $key => $value){
 
1670
  if ((is_array ( $value )) and (!empty( $value ))) {
1671
  if ($feed_config['name'] == "Yandex") {
1672
  $product = $xml->shop->offers->addChild('offer');
1800
  $product->addChild("$k");
1801
  $product->$k = $v;
1802
  } else {
1803
+ if (($feed_config['fields'] != 'standard') AND ($feed_config['fields'] != "customfeed")){
1804
  $k = $this->get_alternative_key ($channel_attributes, $k);
1805
  }
1806
  if(!empty($k)){
 
1807
  /**
1808
  * Some Zbozi and Heureka attributes need some extra XML nodes
1809
  */
1921
  $channel_attributes = get_option('channel_attributes');
1922
  }
1923
  }
1924
+
1925
  // Append or write to file
1926
  $fp = fopen($file, 'a+');
1927
 
1938
  $pieces = str_replace("'", "", $pieces);
1939
 
1940
  foreach ($pieces as $k_inner => $v){
1941
+ if (($feed_config['fields'] != 'standard') AND ($feed_config['fields'] != "customfeed")){
1942
  $v = $this->get_alternative_key ($channel_attributes, $v);
1943
  }
1944
 
2116
  $xml_piece = "";
2117
 
2118
  // Get taxonomies
2119
+ $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");
2120
  $taxonomies = get_taxonomies();
2121
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
2122
 
2371
  // Check if there are mother categories
2372
  if(!empty($product_cat)){
2373
  $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
 
 
2374
 
2375
+ if(!is_object($category_path)){
2376
+ $category_path_skroutz = preg_replace('/&gt;/', '>', $category_path);
2377
  $product_data['category_path'] = $category_path;
2378
  $product_data['category_path_skroutz'] = $category_path_skroutz;
2379
  $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
2412
  }
2413
  }
2414
 
2415
+ // Get the RankMath primary category
2416
+ if ($this->woosea_is_plugin_active('seo-by-rank-math/rank-math.php')){
2417
+ $item_id = $product_data['id'];
2418
+ if($product_data['item_group_id'] > 0){
2419
+ $item_id = $product_data['item_group_id'];
2420
+ }
2421
+ $primary_cat_id = get_post_meta( $item_id, 'rank_math_primary_product_cat', true );
2422
+ if ( $primary_cat_id ) {
2423
+ $product_cat = get_term( $primary_cat_id, 'product_cat' );
2424
+ $product_data['one_category'] = $product_cat->name;
2425
+ }
2426
+ }
2427
+
2428
  $product_data['category_path_short'] = str_replace("Home &gt;","",$product_data['category_path']);
2429
  $product_data['category_path_short'] = str_replace("&gt;",">",$product_data['category_path_short']);
2430
  $product_data['category_link'] = $catlink;
2460
  $product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
2461
  $product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
2462
 
2463
+ // Parent variable description
2464
+ $product_data['mother_description'] = $product_data['description'];
2465
+ $product_data['mother_short_description'] = $product_data['short_description'];
2466
+
2467
  /**
2468
  * Check of we need to add Google Analytics UTM parameters
2469
  */
2489
  if(empty($product_data['condition']) || $product_data['condition'] == "Array"){
2490
  $product_data['condition'] = "New";
2491
  }
2492
+
2493
+ // get_stock only works as of WC 5 and higher?
2494
  $product_data['availability'] = $this->get_stock( $this->childID );
2495
 
2496
  /**
2499
  * Therefor, we need to check the stock_status and overwrite te availability value
2500
  */
2501
  $stock_status = $product->get_stock_status();
2502
+ $product_data['stock_status'] = $stock_status;
2503
  if ($stock_status == "outofstock"){
2504
  $product_data['availability'] = "out of stock";
2505
  } elseif ($stock_status == "onbackorder") {
2572
 
2573
  $product_data['shipping'] = 0;
2574
  $tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class() );
2575
+ $all_standard_taxes = WC_Tax::get_rates_for_tax_class( '' );
2576
+
2577
  $shipping_class_id = $product->get_shipping_class_id();
2578
  $shipping_class= $product->get_shipping_class();
2579
 
2583
  }
2584
 
2585
  $product_data['shipping_label'] = $product->get_shipping_class();
2586
+ $term = get_term_by( 'slug', $product->get_shipping_class(), 'product_shipping_class' );
2587
+ if(is_object($term)){
2588
+ $product_data['shipping_label_name'] = $term->name;
2589
+ }
2590
 
2591
  // Get product prices
2592
  $product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2596
  $product_data['regular_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_regular_price()));
2597
  $product_data['regular_price'] = wc_format_decimal($product_data['regular_price'],2);
2598
 
2599
+ // Untouched raw system pricing - DO NOT CHANGE THESE
2600
+ $float_system_net_price = floatval(wc_get_price_excluding_tax( $product ));
2601
+ $product_data['system_net_price'] = round($float_system_net_price, 2);
2602
+ $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2603
+
2604
+ // System regular price
2605
+ $float_system_regular_price = floatval($product->get_regular_price());
2606
+ $product_data['system_regular_price'] = round($float_system_regular_price,2);
2607
+ $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2608
+
2609
+ // System sale price
2610
+ $float_system_sale_price = floatval($product->get_sale_price());
2611
+ if($float_system_sale_price > 0){
2612
+ $product_data['system_sale_price'] = round($float_system_sale_price,2);
2613
+ $product_data['system_sale_price'] = wc_format_decimal($product_data['system_sale_price'],2);
2614
+ $sale_price = $product_data['system_sale_price'];
2615
+ }
2616
 
2617
+ $code_from_config = $this->woosea_country_to_code($project_config['countries']);
2618
 
2619
+ $nr_standard_rates = count($all_standard_taxes);
2620
+ if(!empty($all_standard_taxes) AND ($nr_standard_rates > 1)){
2621
+ foreach ($all_standard_taxes as $rate){
2622
+ $rate_arr = get_object_vars($rate);
2623
+ if($rate_arr['tax_rate_country'] == $code_from_config){
2624
+ $tax_rates[1]['rate'] = $rate_arr['tax_rate'];
2625
+ }
2626
+ }
2627
+ } else {
2628
+ if(!empty($tax_rates)){
2629
+ foreach ($tax_rates as $tk => $tv){
2630
+ if($tv['rate'] > 0){
2631
+ $tax_rates[1]['rate'] = $tv['rate'];
2632
+ } else {
2633
+ $tax_rates[1]['rate'] = 0;
2634
+ }
2635
  }
2636
+ } else {
2637
+ $tax_rates[1]['rate'] = 0;
2638
+ }
2639
+ }
2640
+
2641
+ if(empty($tax_rates[1]['rate'])){
2642
+ if(!empty($all_standard_taxes) AND ($nr_standard_rates > 1)){
2643
+ foreach ($all_standard_taxes as $rate){
2644
+ $rate_arr = get_object_vars($rate);
2645
+ if($rate_arr['tax_rate_country'] == ""){
2646
+ $tax_rates[1]['rate'] = $rate_arr['tax_rate'];
2647
+ }
2648
+ }
2649
  }
 
 
2650
  }
2651
 
2652
  $fullrate = 100+$tax_rates[1]['rate'];
2658
  if($product->get_type() == "bundle"){
2659
  if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
2660
  $product_data['price'] = get_post_meta($product_data['id'], '_price', true);
2661
+ $product_data['sale_price'] = get_post_meta($product_data['id'], '_sale_price', true);
2662
  if(is_numeric($tax_rates[1]['rate'])){
2663
  $product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2664
  $product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2699
 
2700
  // Make sure the product ID is not NULL either
2701
  global $woocommerce_wpml;
2702
+ if(!is_null($project_config['WCML'])){
2703
+ //$product_data['non_geo_wcml_price'] = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $product_data['id'], $project_config['WCML'] );
2704
+ $product_data['non_geo_wcml_price'] = wc_format_decimal(get_post_meta( $product_data['id'], '_regular_price', true),2);
2705
+ $product_data['non_geo_wcml_price'] = wc_format_localized_price($product_data['non_geo_wcml_price']);
2706
+ $non_geo_sale = get_post_meta( $product_data['id'], '_sale_price', true );
2707
+ if(!empty($non_geo_sale)){
2708
+ $product_data['non_geo_wcml_sale_price'] = wc_format_decimal(get_post_meta( $product_data['id'], '_sale_price', true),2);
2709
+ $product_data['non_geo_wcml_sale_price'] = wc_format_localized_price($product_data['non_geo_wcml_sale_price']);
2710
+ }
2711
+ }
2712
 
2713
  // When WCML manual prices have been entered
2714
  if(!is_null($product_data['id'])){
2738
  }
2739
  if($product->get_regular_price()){
2740
  $product_data['regular_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())) * (100+$tax_rates[1]['rate'])/100,2);
2741
+ $product_data['net_regular_price'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_regular_price())),2);
2742
+ //$product_data['net_regular_price'] = ($product->get_regular_price()/$fullrate)*100;
2743
+ //$product_data['net_regular_price'] = round($product_data['net_regular_price'],2);
2744
  }
2745
  if($product->get_sale_price()){
2746
  $product_data['sale_price_forced'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())) * (100+$tax_rates[1]['rate'])/100,2);
2747
+ $product_data['net_sale_price'] = round(wc_get_price_excluding_tax($product, array('price'=> $product->get_sale_price())),2);
2748
+
 
2749
  // We do not want to have 0 sale price values in the feed
2750
  if($product_data['net_sale_price'] == 0){
2751
  $product_data['net_sale_price'] = "";
2752
  }
2753
  }
2754
+ $float_net_price = floatval(wc_get_price_excluding_tax( $product ));
2755
+ $product_data['net_price'] = round($float_net_price, 2);
2756
+ $product_data['net_price'] = wc_format_decimal($product_data['net_price'],2);
2757
+
2758
  $price = wc_get_price_including_tax($product,array('price'=> $product->get_price()));
2759
  if($product_data['sale_price'] > 0){
2760
  $price = $product_data['sale_price'];
2765
  $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);
2766
  if($discount !== false){
2767
  $product_data['sale_price'] = $discount;
2768
+ $product_data['price'] = $discount;
2769
  $price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
2770
  if($price_incl_tax == "yes"){
2771
  $product_data['price_forced'] = $product_data['price']*($fullrate/100);
2874
  }
2875
  }
2876
 
2877
+ // Is the Mix and Match plugin active
2878
+ if ($this->woosea_is_plugin_active('woocommerce-mix-and-match-products/woocommerce-mix-and-match-products.php')){
2879
+ if($product->is_type('mix-and-match')){
2880
+ if($product_data['price'] == "0.00"){
2881
+ $product_data['price'] = "";
2882
+ $product_data['regular_price'] = "";
2883
+ }
2884
+
2885
+ // Get minimum prices
2886
+ $product_data['mm_min_price'] = wc_format_localized_price($product->get_mnm_price());
2887
+ $product_data['mm_min_regular_price'] = wc_format_localized_price($product->get_mnm_regular_price());
2888
+
2889
+ // Get maximum prices
2890
+ $product_data['mm_max_price'] = wc_format_localized_price($product->get_mnm_price('max'));
2891
+ $product_data['mm_max_regular_price'] = wc_format_localized_price($product->get_mnm_regular_price('max'));
2892
+ }
2893
+ }
2894
+
2895
  // Localize the price attributes
2896
  $decimal_separator = wc_get_price_decimal_separator();
2897
  $product_data['price'] = wc_format_localized_price($product_data['price']);
2899
  $product_data['sale_price'] = wc_format_localized_price($product_data['sale_price']);
2900
  if($product->get_price()){
2901
  $product_data['price_forced'] = wc_format_localized_price($product_data['price_forced']);
2902
+ //$product_data['price_forced'] = (float)$product_data['price_forced'];
2903
+ //$product_data['price_forced_rounded'] = round($product_data['price_forced'],0);
2904
  }
2905
  if($product->get_regular_price()){
2906
  $product_data['regular_price_forced'] = wc_format_localized_price($product_data['regular_price_forced']);
2907
+ //$product_data['regular_price_forced'] = (float)$product_data['regular_price_forced'];
2908
+ //$product_data['regular_price_forced_rounded'] = round($product_data['regular_price_forced'],0);
2909
  }
2910
  if($product->get_sale_price()){
2911
  $product_data['sale_price_forced'] = wc_format_localized_price($product_data['sale_price_forced']);
2912
+ //$product_data['sale_price_forced_rounded'] = round($product_data['sale_price_forced'],0);
2913
+
2914
  }
2915
  $product_data['net_price'] = wc_format_localized_price($product_data['net_price']);
2916
 
2924
  $product_data['net_sale_price'] = wc_format_localized_price($product_data['net_sale_price']);
2925
  }
2926
 
2927
+ if(!empty($product_data['system_price'])){
2928
+ $product_data['system_price'] = wc_format_localized_price($product_data['system_price']);
2929
+ }
2930
+
2931
+ if(!empty($product_data['system_net_price'])){
2932
+ $product_data['system_net_price'] = wc_format_localized_price($product_data['system_net_price']);
2933
+ }
2934
+
2935
+ if(!empty($product_data['system_regular_price'])){
2936
+ $product_data['system_regular_price'] = wc_format_localized_price($product_data['system_regular_price']);
2937
+ }
2938
+
2939
+ if(!empty($product_data['system_sale_price'])){
2940
+ $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
2941
+ }
2942
 
2943
  // Add rounded price options
2944
+ $float_price = floatval($product_data['price']);
2945
+ $float_regular_price = floatval($product_data['regular_price']);
2946
+ $float_sale_price = floatval($product_data['sale_price']);
2947
+ $product_data['rounded_price'] = round($float_price,0);
2948
+ $product_data['rounded_regular_price'] = round($float_regular_price,0);
2949
+ $product_data['rounded_sale_price'] = round($float_sale_price,0);
2950
 
2951
  // Calculate discount percentage
2952
  if($product_data['sale_price'] > 0){
2957
  if(is_array($attr_arr)){
2958
  if($attr_arr['attribute'] == "g:shipping"){
2959
  if($product_data['price'] > 0){
2960
+ $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $fullrate, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
2961
  $shipping_str = $product_data['shipping'];
2962
  }
2963
  }
2964
  }
2965
  }
2966
 
2967
+ if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('lowest_shipping_costs', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi") OR ($project_config['fields'] == "customfeed")){
2968
+ $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $fullrate, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
2969
  $shipping_str = $product_data['shipping'];
2970
  }
2971
 
2973
  if(!empty($shipping_str)){
2974
  $product_data['shipping_price'] = 0;
2975
  }
2976
+ $lowest_shipping_price = array();
2977
+ $shipping_arr = $product_data['shipping'];
2978
 
2979
  if(is_array($shipping_arr)){
2980
  foreach($shipping_arr as $akey => $arr){
2982
  $pieces_ship = explode (" ", $arr['price']);
2983
  if(isset($pieces_ship['1'])){
2984
  $product_data['shipping_price'] = $pieces_ship['1'];
2985
+ $lowest_shipping_price[] = $pieces_ship['1'];
2986
  }
2987
  }
2988
 
2997
  }
2998
  }
2999
 
3000
+ // Get the lowest shipping costs
3001
+ if(!empty($lowest_shipping_price)){
3002
+ $decimal_separator = wc_get_price_decimal_separator();
3003
+ if($decimal_separator == ","){
3004
+ $numeric_lowest_shipping_price = array();
3005
+ foreach ($lowest_shipping_price as &$value) {
3006
+ $number = str_replace(',', '.', $value);
3007
+ if (is_numeric($number)) {
3008
+ $value = number_format($number, 2, '.', '');
3009
+ $numeric_lowest_shipping_price[] = $value;
3010
+ }
3011
+ }
3012
+ $lowest_shipping_price = $numeric_lowest_shipping_price;
3013
+ unset($value);
3014
+ }
3015
+ $product_data['lowest_shipping_costs'] = min($lowest_shipping_price);
3016
+
3017
+ if($decimal_separator == ","){
3018
+ $product_data['lowest_shipping_costs'] = str_replace('.', ',', $product_data['lowest_shipping_costs']);
3019
+ }
3020
+ }
3021
+
3022
  // Google Dynamic Remarketing feeds require the English price notation
3023
  if ($project_config['name'] == "Google Remarketing - DRM"){
3024
  $thousand_separator = wc_get_price_thousand_separator();
3084
 
3085
  foreach($diff_taxonomies as $taxo){
3086
  $term_value = get_the_terms($product_data['id'], $taxo);
3087
+ $product_data["$taxo"] = "";
3088
 
3089
  if(is_array($term_value)){
3090
  // Do not add variation values to the feed when they are out of stock
3094
  $variations = $product_skroutz->get_available_variations();
3095
  $variations_id = wp_list_pluck( $variations, 'variation_id' );
3096
  $skroutz_att_array = array();
3097
+
3098
  foreach($variations_id as $var_id){
3099
  $stock_value = get_post_meta( $var_id, "_stock_status", true );
3100
  if($stock_value == "instock"){
3108
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
3109
  }
3110
  }
 
3111
  foreach($skroutz_att_array as $skrtz_value){
3112
  $product_data[$taxo] .= ",". $skrtz_value;
3113
  }
3173
  foreach($custom_attributes as $custom_kk => $custom_vv){
3174
  $custom_value = get_post_meta( $product_data['id'], $custom_kk, true );
3175
  $new_key ="custom_attributes_" . $custom_kk;
3176
+
3177
+ // This is a ACF image field (PLEASE NOTE: the ACF field needs to contain image or bild in the name)
3178
+ if(preg_match("/image|bild/i", $custom_kk)) {
3179
+ if (class_exists('ACF') AND ($custom_value > 0)) {
3180
+ $image = wp_get_attachment_image_src($custom_value, "large");
3181
+ $custom_value = $image[0];
3182
+ }
3183
+ }
3184
+
3185
  // Just to make sure the title is never empty
3186
  if(($custom_kk == "_aioseop_title") && ($custom_value == "")){
3187
  $custom_value = $product_data['title'];
3230
  $data = $wpdb->get_results($sql);
3231
  if (count($data)) {
3232
  foreach ($data as $key => $value) {
3233
+ $value_display = str_replace("_", " ",$value->name);
3234
  if (preg_match("/_product_attributes/i",$value->name)){
3235
  $product_attr = unserialize($value->type);
3236
  if(!empty($product_attr)){
3248
 
3249
  /**
3250
  * Get Product Attributes for Single products
3251
+ * These are the attributes users create themselves in WooCommerce
3252
  */
3253
+ 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')))){
3254
  $single_attributes = $product->get_attributes();
 
3255
  foreach ($single_attributes as $attribute){
3256
+ $attr_name = strtolower($attribute->get_name());
3257
+ $attr_value = $product->get_attribute($attr_name);
3258
+ $product_data[$attr_name] = $attr_value;
3259
  }
3260
  }
3261
 
3281
  $product_variations = new WC_Product_Variation( $product_data['id'] );
3282
  $variations = $product_variations->get_variation_attributes();
3283
 
3284
+ // For Skroutz and Bestprice apparal products we can only append colours to the product name
3285
  // When a product has both a size and color attribute we assume its an apparal product
3286
+ if(($project_config['fields'] == "skroutz") OR ($project_config['fields'] == "bestprice")){
3287
  $size_found = "no";
3288
  $color_found = "no";
3289
 
3359
  }
3360
  }
3361
 
 
 
3362
  if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
 
3363
  // Determine the default variation product
3364
  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"))){
3365
+ $mother_product = new WC_Product_Variable($product_data['item_group_id']);
3366
+ //$mother_product = wc_get_product($product_data['item_group_id']);
3367
+ $def_attributes = $mother_product->get_default_attributes();
3368
 
3369
  if(isset($project_config['lowest_price_variations'])){
3370
+
3371
  // Determine lowest priced variation
3372
  $variation_min_price = $mother_product->get_variation_price('min');
3373
  $variation_min_price = wc_format_decimal($variation_min_price,2);
3374
  $variation_min_price = wc_format_localized_price($variation_min_price);
3375
+ $var_price = get_post_meta($product_data['id'], '_price', true);
3376
+ $var_price = wc_format_decimal($var_price,2);
3377
+ $var_price = wc_format_localized_price($var_price);
3378
+ $variation_prices = $mother_product->get_variation_prices();
3379
+ $variation_prices_price = array_values($variation_prices['price']);
3380
+ $lowest_price = min($variation_prices_price);
3381
+
3382
+ 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)){
3383
  $variation_pass = "true";
3384
  } else {
3385
  $variation_pass = "false";
3517
  /**
3518
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
3519
  */
3520
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3521
+ //if($stock_value == "instock"){
3522
  foreach($diff_taxonomies as $taxo){
3523
  $term_value = get_the_terms($product_data['item_group_id'], $taxo);
3524
  unset($product_data[$taxo]);
3525
  if(is_array($term_value)){
3526
  foreach($term_value as $term){
3527
  if(empty($product_data[$taxo])){
3528
+ $product_data[$taxo] = $term->name;
3529
  } else {
3530
+ $product_data[$taxo] .= " ".$term->name;
3531
  }
3532
  }
3533
  }
3534
+ }
3535
 
3536
  /**
3537
  * Add product tags to the product data array
3551
 
3552
  // Add attribute values to the variation product names to make them unique
3553
  $product_data['title_hyphen'] = $product_data['title']." - ";
3554
+ $product_data['mother_title_hyphen'] = $product_data['mother_title']." - ";
3555
 
3556
  foreach($variations as $kk => $vv){
3557
  $custom_key = $kk;
3700
  * we will add CDATA brackets to the title and description attributes
3701
  */
3702
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
3703
+ $product_data['title_lcw'] = ucwords(strtolower($product_data['title']));
3704
+
3705
+ // Add CDATA to title and descriptions
3706
+ $add_woosea_cdata = get_option ('add_woosea_cdata');
3707
+ if($add_woosea_cdata == "yes"){
3708
+ $product_data['title'] = $this->woosea_append_cdata ( $product_data['title'] );
3709
+ $product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3710
+ $product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
3711
+ }
3712
 
3713
  /**
3714
  * Get product reviews for Google Product Review Feeds
3715
  */
3716
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3717
 
3718
+ /**
3719
+ * Filter out reviews that do not have text
3720
+ */
3721
+ if(!empty($product_data['reviews'])){
3722
+ foreach($product_data['reviews'] as $review_id => $review_details){
3723
+ if(empty($review_details['content'])){
3724
+ unset($product_data['reviews'][$review_id]);
3725
+ }
3726
+ }
3727
+ }
3728
+
3729
  /**
3730
  * Check if individual products need to be excluded
3731
  */
3791
  // For these channels parent products are allowed
3792
  $allowed_channel_parents = array(
3793
  "skroutz",
3794
+ "bestprice",
3795
  "google_dsa",
3796
  "google_product_review",
3797
  );
3798
 
3799
+ if(array_key_exists('fields', $project_config)){
3800
+ if (!in_array($project_config['fields'], $allowed_channel_parents)){
3801
+ if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
3802
+ $product_data = array();
3803
+ $product_data = null;
3804
+ }
3805
+ }
3806
+ }
3807
 
3808
  /**
3809
  * Remove variation products that are not THE default variation product
3816
  /**
3817
  * And item_group_id is not allowed for simple products, prevent users from adding this to the feedd
3818
  */
3819
+ 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')))){
3820
  unset($product_data['item_group_id']);
3821
  }
3822
 
3830
  }
3831
  }
3832
 
3833
+ /**
3834
+ * Do final check on Skroutz out of stock sizes
3835
+ * When a size is not on stock remove it
3836
+ */
3837
+ if($project_config['fields'] == "skroutz"){
3838
+ if(isset($product_data['id'])){
3839
+ foreach($project_config['attributes'] as $ky => $vy){
3840
+ if(isset($vy['attribute'])){
3841
+ if($vy['attribute'] == "size"){
3842
+ $size_found = "yes";
3843
+ $sz_attribute = $vy['mapfrom'];
3844
+ }
3845
+ if($vy['attribute'] == "color"){
3846
+ $color_found = "yes";
3847
+ $clr_attribute = $vy['mapfrom'];
3848
+ }
3849
+ }
3850
+ }
3851
+
3852
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3853
+ $sz_attr_value = get_post_meta( $product_data['id'], $sz_attribute, true );
3854
+ if(!empty($clr_attribute)){
3855
+ $clr_attr_value = get_post_meta( $product_data['id'], "attribute_".$clr_attribute, true );
3856
+ }
3857
+
3858
+ // HIER MOET EEN CHECK IN OP product_type
3859
+ if(isset($product_data['item_group_id']) AND ($product_data['product_type'] == "variable")){
3860
+ if($product_data['item_group_id'] > 0){
3861
+ $product_skroutz = wc_get_product($product_data['item_group_id']);
3862
+ $variations = $product_skroutz->get_available_variations();
3863
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
3864
+
3865
+ foreach($variations_id as $var_id){
3866
+ $clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
3867
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
3868
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
3869
+ if($clr_variation == $clr_attr_value){
3870
+ if($stock_variation == "outofstock"){
3871
+ // Remove this size as it is not on stock
3872
+ if(array_key_exists($sz_attribute, $product_data)){
3873
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
3874
+ $product_data[$sz_attribute] = str_replace(", , ",",",$product_data[$sz_attribute]);
3875
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], " ");
3876
+ $product_data[$sz_attribute] = trim($product_data[$sz_attribute], ",");
3877
+ }
3878
+ }
3879
+ }
3880
+ }
3881
+ } else {
3882
+ // This is a parent variable product
3883
+ $product_skroutz = wc_get_product($product_data['id']);
3884
+ $variations = $product_skroutz->get_available_variations();
3885
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
3886
+
3887
+ foreach($variations_id as $var_id){
3888
+ //$clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
3889
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
3890
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
3891
+ if($stock_variation == "outofstock"){
3892
+ // Remove this size as it is not on stock
3893
+ if(array_key_exists($sz_attribute, $product_data)){
3894
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
3895
+ $product_data[$sz_attribute] = str_replace(", , ",",",$product_data[$sz_attribute]);
3896
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], " ");
3897
+ $product_data[$sz_attribute] = rtrim($product_data[$sz_attribute], ",");
3898
+ }
3899
+ }
3900
+ }
3901
+ }
3902
+ }
3903
+ }
3904
+ }
3905
+
3906
  /**
3907
  * When product has passed the filter rules it can continue with the rest
3908
  */
3936
  }
3937
  } else {
3938
  if((strlen($attr_value['mapfrom'])) AND (array_key_exists($attr_value['mapfrom'], $product_data))){
3939
+ 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")){
3940
  $attr_line = "'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
3941
  } else {
3942
  $attr_line = "'".$attr_value['prefix']. "".$product_data[$attr_value['mapfrom']]."" .$attr_value['suffix']."'";
4008
  }
4009
  } else {
4010
  if(strlen($product_data[$attr_value['mapfrom']])){
4011
+ 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")){
4012
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
4013
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
4014
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
4192
  $shipping_str .= ":WOOSEA_POSTAL_CODE##$v";
4193
  } elseif ($k == "price"){
4194
  $shipping_str .= ":WOOSEA_PRICE##$attr_value[prefix] $v $attr_value[suffix]";
4195
+ //$shipping_str .= ":WOOSEA_PRICE##$v";
4196
  } else {
4197
  // UNKNOWN, DO NOT ADD
4198
  }
4229
  }
4230
  } else {
4231
  if(strlen($product_data[$attr_value['mapfrom']])){
4232
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
4233
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
4234
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
4235
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
4499
  }
4500
  // New policy of Google, only when the value is yes add it to the feed
4501
  // 28 October 2019
4502
+ if(array_key_exists('calculated', $project_config['attributes'])){
4503
  $xml_product['g:identifier_exists'] = $identifier_exists;
4504
+ }
4505
  }
4506
  return $xml_product;
4507
  }
4759
  return $product_data;
4760
  }
4761
 
4762
+ /**
4763
+ * Execute project rules
4764
+ */
4765
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
4766
  $aantal_prods = count($product_data);
4767
+ if($aantal_prods > 0){
 
 
4768
 
4769
+ foreach ($project_rules2 as $pr_key => $pr_array){
4770
 
4771
+ foreach ($product_data as $pd_key => $pd_value){
 
4772
 
4773
+ // Check is there is a rule on specific attributes
4774
+ if($pd_key == $pr_array['attribute']){
4775
+ // This is because for data manipulation the than attribute is empty
4776
+ if(!array_key_exists('than_attribute', $pr_array)){
4777
+ $pr_array['than_attribute'] = $pd_key;
4778
+ }
4779
 
4780
  // Check if a rule has been set for Google categories
4781
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
4782
+
4783
+ $pr_array['than_attribute'] = "categories";
4784
  $category_id = explode("-", $pr_array['newvalue']);
4785
  $pr_array['newvalue'] = $category_id[0];
4786
+ $product_data['categories'] = $pr_array['newvalue'];
4787
+ }
4788
 
4789
+ // Make sure that rules on numerics are on true numerics
4790
+ if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
4791
+ $pd_value = strtr($pd_value, ',', '.');
4792
+ }
4793
 
4794
 
4795
+ // Make sure the price or sale price is numeric
4796
+ if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
4797
+ settype($pd_value, "double");
4798
+ }
4799
 
4800
+ if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
4801
 
4802
+ // Rules for numeric values
4803
+ switch ($pr_array['condition']) {
4804
+ case($pr_array['condition'] = "contains"):
4805
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4806
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
4807
+ }
4808
+ break;
4809
+ case($pr_array['condition'] = "containsnot"):
4810
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4811
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4812
+ }
4813
+ break;
4814
+ case($pr_array['condition'] = "="):
4815
+ if (($pd_value == $pr_array['criteria'])){
4816
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4817
+ }
4818
+ break;
4819
+ case($pr_array['condition'] = "!="):
4820
+ if (($pd_value != $pr_array['criteria'])){
4821
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4822
+ }
4823
+ break;
4824
+ case($pr_array['condition'] = ">"):
4825
+ if (($pd_value > $pr_array['criteria'])){
4826
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4827
+ }
4828
+ break;
4829
+ case($pr_array['condition'] = ">="):
4830
+ if (($pd_value >= $pr_array['criteria'])){
4831
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4832
+ }
4833
+ break;
4834
+ case($pr_array['condition'] = "<"):
4835
+ if (($pd_value < $pr_array['criteria'])){
4836
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4837
+ }
4838
+ break;
4839
+ case($pr_array['condition'] = "=<"):
4840
+ if (($pd_value <= $pr_array['criteria'])){
4841
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4842
+ }
4843
+ break;
4844
+ case($pr_array['condition'] = "empty"):
4845
+ if(empty($product_data[$pr_array['attribute']])){
4846
+ if ((strlen($pd_value) < 1)){
4847
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4848
+ } else {
4849
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4850
+ }
4851
+ }
4852
+ break;
4853
+ case($pr_array['condition'] = "multiply"):
4854
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4855
+ $convert_back = "false";
4856
+ $pos = strpos($pd_value, ',');
4857
+ if($pos !== false){
4858
+ $convert_back = "true";
4859
+ }
4860
+ $pd_value = strtr($pd_value, ',', '.');
4861
+ $newvalue = $pd_value*$pr_array['criteria'];
4862
+ $newvalue = round($newvalue, 2);
4863
+ if($convert_back == "true"){
4864
+ $newvalue = strtr($newvalue, '.',',');
4865
+ }
4866
+ $product_data[$pr_array['attribute']] = $newvalue;
4867
+ break;
4868
+ case($pr_array['condition'] = "divide"):
4869
+ $newvalue = ($pd_value / $pr_array['criteria']);
4870
+ $newvalue = round($newvalue, 2);
4871
+ $newvalue = strtr($newvalue, '.',',');
4872
+ $product_data[$pr_array['attribute']] = $newvalue;
4873
+ break;
4874
+ case($pr_array['condition'] = "plus"):
4875
+ $newvalue = ($pd_value + $pr_array['criteria']);
4876
+ $product_data[$pr_array['attribute']] = $newvalue;
4877
+ break;
4878
+ case($pr_array['condition'] = "minus"):
4879
+ $newvalue = ($pd_value - $pr_array['criteria']);
4880
+ $product_data[$pr_array['attribute']] = $newvalue;
4881
+ break;
4882
+ case($pr_array['condition'] = "findreplace"):
4883
+ if (strpos($pd_value, $pr_array['criteria']) !== false){
4884
  // Make sure that a new value has been set
4885
+ if(!empty($pr_array['newvalue'])){
4886
+ // Find and replace only work on same attribute field, otherwise create a contains rule
4887
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4888
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4889
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4890
  }
4891
+ }
4892
+ }
4893
+ break;
4894
+ default:
4895
+ break;
4896
+ }
4897
+ } elseif (is_array($pd_value)) {
4898
+
4899
+ // For now only shipping details are in an array
4900
+ foreach ($pd_value as $k => $v){
4901
+ if(is_array($v)){
4902
+ foreach ($v as $kk => $vv){
4903
+ // Only shipping detail rule can be on price for now
4904
+ if($kk == "price"){
4905
+ switch ($pr_array['condition']) {
4906
+ case($pr_array['condition'] = "contains"):
4907
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
4908
+ $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
4909
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4910
+ }
4911
+ break;
4912
+ case($pr_array['condition'] = "containsnot"):
4913
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
4914
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4915
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4916
+ }
4917
+ break;
4918
+ case($pr_array['condition'] = "="):
4919
+ if (($vv == $pr_array['criteria'])){
4920
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4921
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4922
+ }
4923
+ break;
4924
+ case($pr_array['condition'] = "!="):
4925
+ if (($vv != $pr_array['criteria'])){
4926
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4927
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4928
+ }
4929
+ break;
4930
+ case($pr_array['condition'] = ">"):
4931
+ if (($vv > $pr_array['criteria'])){
4932
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4933
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4934
+ }
4935
+ break;
4936
+ case($pr_array['condition'] = ">="):
4937
+ if (($vv >= $pr_array['criteria'])){
4938
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4939
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4940
+ }
4941
+ break;
4942
+ case($pr_array['condition'] = "<"):
4943
+ if (($vv < $pr_array['criteria'])){
4944
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4945
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4946
+ }
4947
+ break;
4948
+ case($pr_array['condition'] = "=<"):
4949
+ if (($vv <= $pr_array['criteria'])){
4950
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4951
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4952
+ }
4953
+ break;
4954
+ case($pr_array['condition'] = "empty"):
4955
+ if ((strlen($vv) < 1)){
4956
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4957
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4958
+ }
4959
+ break;
4960
+ case($pr_array['condition'] = "multiply"):
4961
+ // Only shipping array
4962
+ if(is_array($pd_value)){
4963
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4964
+ foreach ($pd_value as $ship_a_key => $shipping_arr){
4965
+ foreach($shipping_arr as $ship_key => $ship_value){
4966
+ if($ship_key == "price"){
4967
+ $ship_pieces = explode(" ", $ship_value);
4968
+ $pd_value = strtr($ship_pieces[1], ',', '.');
4969
+ $newvalue = $pd_value*$pr_array['criteria'];
4970
+ $newvalue = round($newvalue, 2);
4971
+ $newvalue = strtr($newvalue, '.',',');
4972
+ $newvalue = $ship_pieces[0]." ".$newvalue;
4973
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4974
+ }
4975
+ }
4976
+ }
4977
+ }
4978
+ break;
4979
+ default:
4980
+ break;
4981
+ }
4982
+ }
4983
+ }
4984
+ } else {
4985
+ // Rules on product tags
4986
+ foreach ($pd_value as $k => $v){
4987
+
4988
+ // Rules for string values
4989
+ if (!array_key_exists('cs', $pr_array)){
4990
+ $v = strtolower($v);
4991
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
4992
+ }
4993
+
4994
+ switch ($pr_array['condition']) {
4995
+ case($pr_array['condition'] = "contains"):
4996
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
4997
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4998
+ }
4999
+ break;
5000
+ case($pr_array['condition'] = "containsnot"):
5001
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5002
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5003
+ }
5004
+ break;
5005
+ case($pr_array['condition'] = "="):
5006
+ if (($v == $pr_array['criteria'])){
5007
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5008
+ }
5009
+ break;
5010
+ case($pr_array['condition'] = "!="):
5011
+ if (($v != $pr_array['criteria'])){
5012
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5013
+ }
5014
+ break;
5015
+ case($pr_array['condition'] = ">"):
5016
+ if (($v > $pr_array['criteria'])){
5017
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5018
+ }
5019
+ break;
5020
+ case($pr_array['condition'] = ">="):
5021
+ if (($v >= $pr_array['criteria'])){
5022
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5023
+ }
5024
+ break;
5025
+ case($pr_array['condition'] = "<"):
5026
+ if (($v < $pr_array['criteria'])){
5027
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5028
+ }
5029
+ break;
5030
+ case($pr_array['condition'] = "=<"):
5031
+ if (($v <= $pr_array['criteria'])){
5032
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5033
+ }
5034
+ break;
5035
+ case($pr_array['condition'] = "empty"):
5036
+ if ((strlen($v) < 1)){
5037
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5038
+ }
5039
+ break;
5040
+ case($pr_array['condition'] = "multiply"):
5041
+ // Only shipping array
5042
+ if(is_array($v)){
5043
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
5044
+ foreach ($v as $ship_a_key => $shipping_arr){
5045
+ foreach($shipping_arr as $ship_key => $ship_value){
5046
+ if($ship_key == "price"){
5047
+ $ship_pieces = explode(" ", $ship_value);
5048
+ $pd_value = strtr($ship_pieces[1], ',', '.');
5049
+ $newvalue = $pd_value*$pr_array['criteria'];
5050
+ $newvalue = round($newvalue, 2);
5051
+ $newvalue = strtr($newvalue, '.',',');
5052
+ $newvalue = $ship_pieces[0]." ".$newvalue;
5053
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
5054
+ }
5055
+ }
5056
+ }
5057
+ }
5058
+ break;
5059
+ default:
5060
+ break;
5061
+ }
5062
+ }
5063
+ }
5064
+ }
5065
+ } else {
5066
  // Rules for string values
5067
  if (!array_key_exists('cs', $pr_array)){
5068
+ if($pr_array['attribute'] != "image"){
5069
+ $pd_value = strtolower($pd_value);
5070
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5071
+ }
5072
+ }
5073
 
5074
+ switch ($pr_array['condition']) {
5075
+ case($pr_array['condition'] = "contains"):
5076
  if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5077
+ // Specifically for shipping price rules
5078
+ if(!empty($product_data[$pr_array['than_attribute']])){
5079
+ if(is_array($product_data[$pr_array['than_attribute']])){
5080
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5081
+ for ($x = 0; $x <= $arr_size; $x++) {
5082
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5083
+ }
5084
+ } else {
5085
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5086
+ }
5087
+ } else {
5088
+ // This attribute value is empty for this product
5089
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5090
+ }
5091
+ }
5092
+ break;
5093
+ case($pr_array['condition'] = "containsnot"):
5094
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
5095
+ // Specifically for shipping price rules
5096
+ if(is_array($product_data[$pr_array['than_attribute']])){
5097
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5098
+ for ($x = 0; $x <= $arr_size; $x++) {
5099
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5100
+ }
5101
+ } else {
5102
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5103
+ }
5104
+ }
5105
+ break;
5106
+ case($pr_array['condition'] = "="):
5107
+ if (($pr_array['criteria'] == "$pd_value")){
5108
+ // Specifically for shipping price rules
5109
+ if(is_array($product_data[$pr_array['than_attribute']])){
5110
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5111
+ for ($x = 0; $x <= $arr_size; $x++) {
5112
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5113
+ }
5114
+ } else {
5115
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5116
+ }
5117
+ }
5118
+ $ship = $product_data['shipping'];
5119
+ break;
5120
+ case($pr_array['condition'] = "!="):
5121
+ if (($pr_array['criteria'] != "$pd_value")){
5122
+ // Specifically for shipping price rules
5123
+ if(is_array($product_data[$pr_array['than_attribute']])){
5124
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5125
+ for ($x = 0; $x <= $arr_size; $x++) {
5126
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5127
+ }
5128
+ } else {
5129
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5130
+ }
5131
+ }
5132
+ break;
5133
+ case($pr_array['condition'] = ">"):
5134
+ // Use a lexical order on relational string operators
5135
+ if (($pd_value > $pr_array['criteria'])){
5136
+ // Specifically for shipping price rules
5137
+ if(is_array($product_data[$pr_array['than_attribute']])){
5138
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5139
+ for ($x = 0; $x <= $arr_size; $x++) {
5140
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5141
+ }
5142
+ } else {
5143
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5144
+ }
5145
+ }
5146
+ break;
5147
+ case($pr_array['condition'] = ">="):
5148
+ // Use a lexical order on relational string operators
5149
+ if (($pd_value >= $pr_array['criteria'])){
5150
+ // Specifically for shipping price rules
5151
+ if(is_array($product_data[$pr_array['than_attribute']])){
5152
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5153
+ for ($x = 0; $x <= $arr_size; $x++) {
5154
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5155
+ }
5156
+ } else {
5157
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5158
+ }
5159
+ }
5160
+ break;
5161
+ case($pr_array['condition'] = "<"):
5162
+ // Use a lexical order on relational string operators
5163
+ if (($pd_value < $pr_array['criteria'])){
5164
+ // Specifically for shipping price rules
5165
+ if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
5166
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5167
+ for ($x = 0; $x <= $arr_size; $x++) {
5168
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5169
+ }
5170
+ } else {
5171
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5172
+ }
5173
+ }
5174
+ break;
5175
+ case($pr_array['condition'] = "=<"):
5176
+ // Use a lexical order on relational string operators
5177
+ if (($pd_value <= $pr_array['criteria'])){
5178
+ // Specifically for shipping price rules
5179
+ if(is_array($product_data[$pr_array['than_attribute']])){
5180
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
5181
+ for ($x = 0; $x <= $arr_size; $x++) {
5182
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
5183
+ }
5184
+ } else {
5185
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5186
+ }
5187
+ }
5188
+ break;
5189
 
5190
+ case($pr_array['condition'] = "empty"):
5191
+ if(empty($product_data[$pr_array['attribute']])){
5192
+ if(empty($product_data[$pr_array['than_attribute']])){
5193
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5194
+ } else {
5195
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5196
+ }
5197
+ }
5198
+ break;
5199
+ case($pr_array['condition'] = "replace"):
5200
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
5201
+ break;
5202
  case($pr_array['condition'] = "findreplace"):
5203
  if (strpos($pd_value, $pr_array['criteria']) !== false){
5204
+ // Make sure that a new value has been set
5205
+ if(!empty($pr_array['newvalue'])){
5206
+ // Find and replace only work on same attribute field, otherwise create a contains rule
5207
  if($pr_array['attribute'] == $pr_array['than_attribute']){
5208
+ $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
5209
+ //$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
5210
+ $product_data[$pr_array['than_attribute']] = $newvalue;
5211
+ }
5212
+ }
5213
+ }
5214
  break;
5215
+ default:
5216
+ break;
5217
+ }
5218
+ }
5219
+ } else {
5220
+ // When a rule has been set on an attribute that is not in product_data
5221
+ // Add the newvalue to product_data
5222
+ if (!array_key_exists($pr_array['attribute'], $product_data)){
5223
  if(!empty($pr_array['newvalue'])){
5224
+ if ($pr_array['condition'] == "empty") {
5225
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
5226
+ }
5227
  } else {
5228
  if(array_key_exists($pr_array['than_attribute'], $product_data)){
5229
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
5230
+ }
5231
+ }
5232
+ }
5233
+ }
5234
+ }
5235
+ }
5236
+ }
5237
+ return $product_data;
5238
+ }
5239
 
5240
  /**
5241
  * Function to exclude products based on individual product exclusions
5258
  }
5259
  }
5260
 
5261
+
5262
+ /**
5263
+ * Execute project filters (include / exclude)
5264
+ */
5265
  private function woocommerce_sea_filters( $project_rules, $product_data ){
5266
+ $allowed = 1;
5267
 
5268
+ // Check if product was already excluded from the feed
5269
+ $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
5270
 
5271
+ if( $product_excluded == "Yes"){
5272
+ $allowed = 0;
5273
+ }
5274
 
5275
+ foreach ($project_rules as $pr_key => $pr_array){
5276
 
5277
+ if($pr_array['attribute'] == "categories"){
5278
+ $pr_array['attribute'] = "raw_categories";
5279
+ }
5280
 
5281
+ //if(array_key_exists($pr_array['attribute'], $product_data)){
5282
 
5283
+ if(!array_key_exists($pr_array['attribute'], $product_data)) {
5284
+ $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
5285
+ }
5286
 
5287
+ foreach ($product_data as $pd_key => $pd_value){
5288
+ // Check is there is a rule on specific attributes
5289
+ if(in_array($pd_key, $pr_array, TRUE)){
5290
+ if($pd_key == "price" || $pd_key == "regular_price"){
5291
+ //$pd_value = @number_format($pd_value,2);
5292
+ $pd_value = wc_format_decimal($pd_value);
5293
+ }
5294
 
5295
+ if (is_numeric($pd_value)){
5296
+ $old_value = $pd_value;
5297
+ if($pd_key == "price" || $pd_key == "regular_price"){
5298
+ $pd_value = @number_format($pd_value,2);
5299
+ }
5300
 
5301
+ // Rules for numeric values
5302
+ switch ($pr_array['condition']) {
5303
+ case($pr_array['condition'] = "contains"):
5304
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5305
+ $allowed = 0;
5306
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5307
+ $allowed = 0;
5308
+ }
5309
+ break;
5310
+ case($pr_array['condition'] = "containsnot"):
5311
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5312
+ $allowed = 0;
5313
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5314
+ $allowed = 0;
5315
+ }
5316
+ break;
 
 
 
 
 
 
 
 
 
 
 
5317
  case($pr_array['condition'] = "="):
5318
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5319
+ $allowed = 0;
5320
+ } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5321
+ $allowed = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5322
  }
5323
+ break;
5324
+ case($pr_array['condition'] = "!="):
5325
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5326
+ if($allowed <> 0){
5327
+ $allowed = 1;
5328
+ }
5329
+ } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5330
+ $allowed = 0;
5331
+ }
5332
+ break;
5333
+ case($pr_array['condition'] = ">"):
5334
+ if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5335
+ $allowed = 0;
5336
+ } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5337
+ $allowed = 0;
5338
+ }
5339
+ break;
5340
+ case($pr_array['condition'] = ">="):
5341
+ if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5342
+ $allowed = 0;
5343
+ } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5344
+ $allowed = 0;
5345
+ }
5346
+ break;
5347
+ case($pr_array['condition'] = "<"):
5348
+ if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5349
+ $allowed = 0;
5350
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5351
+ $allowed = 0;
5352
+ }
5353
+ break;
5354
+ case($pr_array['condition'] = "=<"):
5355
+ if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5356
+ $allowed = 0;
5357
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5358
+ $allowed = 0;
5359
+ }
5360
+ break;
5361
+ case($pr_array['condition'] = "empty"):
5362
+ if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5363
+ $allowed = 0;
5364
+ } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5365
+ $allowed = 0;
5366
+ }
5367
+ break;
5368
+ default:
5369
+ break;
5370
+ }
5371
+ } elseif (is_array($pd_value)){
5372
+ // Tis can either be a shipping or product_tag array
5373
+ if($pr_array['attribute'] == "product_tag"){
5374
+ $in_tag_array = "not";
5375
+
5376
+ foreach($pd_value as $pt_key => $pt_value){
5377
+ // Rules for string values
5378
+ if (!array_key_exists('cs', $pr_array)){
5379
+ $pt_value = strtolower($pt_value);
5380
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5381
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5382
 
5383
+ if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5384
+ $in_tag_array = "yes";
5385
+ }
5386
+ }
5387
+
5388
+ if($in_tag_array == "yes"){
5389
+ //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5390
+ $v = $pr_array['criteria'];
5391
+ switch ($pr_array['condition']) {
5392
+ case($pr_array['condition'] = "contains"):
5393
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5394
+ if($pr_array['than'] == "include_only"){
5395
+ if($allowed <> 0){
5396
+ $allowed = 1;
5397
+ }
5398
+ } else {
5399
+ $allowed = 0;
5400
+ }
5401
+ } else {
5402
+ $allowed = 0;
5403
+ }
5404
+ break;
5405
+ case($pr_array['condition'] = "containsnot"):
5406
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5407
+ if($pr_array['than'] == "include_only"){
5408
+ if($allowed <> 0){
5409
+ $allowed = 1;
5410
+ }
5411
+ } else {
5412
+ $allowed = 0;
5413
+ }
5414
+ } else {
5415
+ $allowed = 0;
5416
+ }
5417
+ break;
5418
+ case($pr_array['condition'] = "="):
5419
+ if (($v == $pr_array['criteria'])){
5420
+ if($pr_array['than'] == "include_only"){
5421
+ if($allowed <> 0){
5422
+ $allowed = 1;
5423
+ }
5424
+ } else {
5425
+ $allowed = 0;
5426
+ }
5427
+ } else {
5428
+ $allowed = 0;
5429
+ }
5430
+ break;
5431
+ case($pr_array['condition'] = "!="):
5432
+ if (($v != $pr_array['criteria'])){
5433
+ if($pr_array['than'] == "include_only"){
5434
+ if($allowed <> 0){
5435
+ $allowed = 1;
5436
+ }
5437
+ } else {
5438
+ $allowed = 0;
5439
+ }
5440
+ }
5441
+ break;
5442
+ case($pr_array['condition'] = ">"):
5443
+ if (($v > $pr_array['criteria'])){
5444
+ if($pr_array['than'] == "include_only"){
5445
+ if($allowed <> 0){
5446
+ $allowed = 1;
5447
+ }
5448
+ } else {
5449
+ $allowed = 0;
5450
+ }
5451
+ }
5452
+ break;
5453
+ case($pr_array['condition'] = ">="):
5454
+ if (($v >= $pr_array['criteria'])){
5455
+ if($pr_array['than'] == "include_only"){
5456
+ if($allowed <> 0){
5457
+ $allowed = 1;
5458
+ }
5459
+ } else {
5460
+ $allowed = 0;
5461
+ }
5462
+ }
5463
+ break;
5464
+ case($pr_array['condition'] = "<"):
5465
+ if (($v < $pr_array['criteria'])){
5466
+ if($pr_array['than'] == "include_only"){
5467
+ if($allowed <> 0){
5468
+ $allowed = 1;
5469
+ }
5470
+ } else {
5471
+ $allowed = 0;
5472
+ }
5473
+ }
5474
+ break;
5475
+ case($pr_array['condition'] = "=<"):
5476
+ if (($v <= $pr_array['criteria'])){
5477
+ if($pr_array['than'] == "include_only"){
5478
+ if($allowed <> 0){
5479
+ $allowed = 1;
5480
+ }
5481
+ } else {
5482
+ $allowed = 0;
5483
+ }
5484
+ }
5485
+ break;
5486
+ case($pr_array['condition'] = "empty"):
5487
+ if (strlen($v) < 1){
5488
+ if($pr_array['than'] == "include_only"){
5489
+ if($allowed <> 0){
5490
+ $allowed = 1;
5491
+ }
5492
+ } else {
5493
+ if(!empty($pt_value)){
5494
+ $allowed = 1;
5495
+ } else {
5496
+ $allowed = 0;
5497
+ }
5498
+ }
5499
+ }
5500
+ break;
5501
+ default:
5502
+ break;
5503
+ }
5504
+ } else {
5505
+ switch ($pr_array['condition']) {
5506
+ case($pr_array['condition'] = "contains"):
5507
+ if($pr_array['than'] == "include_only"){
5508
+ $allowed = 0;
5509
+ } else {
5510
+ if($allowed <> 0){
5511
+ $allowed = 1;
5512
+ }
5513
+ }
5514
+ break;
5515
+ case($pr_array['condition'] = "containsnot"):
5516
+ if($pr_array['than'] == "include_only"){
5517
+ if($allowed <> 0){
5518
+ $allowed = 1;
5519
+ }
5520
+ } else {
5521
+ $allowed = 0;
5522
+ }
5523
+ break;
5524
+ case($pr_array['condition'] = "="):
5525
+ if($pr_array['than'] == "include_only"){
5526
+ $allowed = 0;
5527
+ } else {
5528
+ if($allowed <> 0){
5529
+ $allowed = 1;
5530
+ }
5531
+ }
5532
+ break;
5533
+ case($pr_array['condition'] = "!="):
5534
+ if($pr_array['than'] == "include_only"){
5535
+ if($allowed <> 0){
5536
+ $allowed = 1;
5537
+ }
5538
+ } else {
5539
+ $allowed = 0;
5540
+ }
5541
+ break;
5542
+ case($pr_array['condition'] = ">"):
5543
+ if($pr_array['than'] == "include_only"){
5544
+ $allowed = 0;
5545
+ } else {
5546
+ $allowed = 0;
5547
+ }
5548
+ break;
5549
+ case($pr_array['condition'] = ">="):
5550
+ if($pr_array['than'] == "include_only"){
5551
+ $allowed = 0;
5552
+ } else {
5553
+ $allowed = 0;
5554
+ }
5555
+ break;
5556
+ case($pr_array['condition'] = "<"):
5557
+ if($pr_array['than'] == "include_only"){
5558
+ $allowed = 0;
5559
+ } else {
5560
+ $allowed = 0;
5561
+ }
5562
+ break;
5563
+ case($pr_array['condition'] = "=<"):
5564
+ if($pr_array['than'] == "include_only"){
5565
+ $allowed = 0;
5566
+ } else {
5567
+ $allowed = 0;
5568
+ }
5569
+ break;
5570
+ case($pr_array['condition'] = "empty"):
5571
+ if($pr_array['than'] == "include_only"){
5572
+ if($allowed <> 0){
5573
+ $allowed = 1;
5574
+ }
5575
+ } else {
5576
+ $allowed = 0;
5577
+ }
5578
+ break;
5579
+ default:
5580
+ break;
5581
+ }
5582
+ }
5583
+ } else {
5584
+ // For now only shipping details are in an array
5585
+ foreach ($pd_value as $k => $v){
5586
+ foreach ($v as $kk => $vv){
5587
+ // Only shipping detail rule can be on price for now
5588
+ if($kk == "price"){
5589
+ switch ($pr_array['condition']) {
5590
+ case($pr_array['condition'] = "contains"):
5591
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5592
+ $allowed = 0;
5593
+ }
5594
+ break;
5595
+ case($pr_array['condition'] = "containsnot"):
5596
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5597
+ $allowed = 0;
5598
+ }
5599
+ break;
5600
+ case($pr_array['condition'] = "="):
5601
+ if (($vv == $pr_array['criteria'])){
5602
+ $allowed = 0;
5603
+ }
5604
+ break;
5605
+ case($pr_array['condition'] = "!="):
5606
+ if (($vv != $pr_array['criteria'])){
5607
+ $allowed = 0;
5608
+ }
5609
+ break;
5610
+ case($pr_array['condition'] = ">"):
5611
+ if (($vv > $pr_array['criteria'])){
5612
+ $allowed = 0;
5613
+ }
5614
+ break;
5615
+ case($pr_array['condition'] = ">="):
5616
+ if (($vv >= $pr_array['criteria'])){
5617
+ $allowed = 0;
5618
+ }
5619
+ break;
5620
+ case($pr_array['condition'] = "<"):
5621
+ if (($vv < $pr_array['criteria'])){
5622
+ $allowed = 0;
5623
+ }
5624
+ break;
5625
+ case($pr_array['condition'] = "=<"):
5626
+ if (($vv <= $pr_array['criteria'])){
5627
+ $allowed = 0;
5628
+ }
5629
+ break;
5630
+ case($pr_array['condition'] = "empty"):
5631
+ if (strlen($vv) < 1){
5632
+ $allowed = 0;
5633
+ }
5634
+ break;
5635
+ default:
5636
+ break;
5637
+ }
5638
+ }
5639
+ }
5640
+ }
5641
+ }
5642
+ } else {
5643
+ // Filters for string values
5644
+ // If case-sensitve is off than lowercase both the criteria and attribute value
5645
+ if (array_key_exists('cs', $pr_array)){
5646
+ if ($pr_array['cs'] != "on"){
5647
+ $pd_value = strtolower($pd_value);
5648
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5649
+ }
5650
+ }
5651
+ $pos = strpos($pd_value, '&amp;');
5652
+ $pos_slash = strpos($pr_array['criteria'], '\\');
5653
+ if($pos !== false){
5654
+ $pd_value = str_replace("&amp;","&",$pd_value);
5655
+ }
5656
+ if($pos_slash !== false){
5657
+ $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5658
+ }
5659
+
5660
+ switch ($pr_array['condition']) {
5661
+ case($pr_array['condition'] = "contains"):
5662
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5663
+ $allowed = 0;
5664
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5665
+ $allowed = 0;
5666
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5667
+ if($allowed <> 0){
5668
+ $allowed = 1;
5669
+ }
5670
+ }
5671
+ break;
5672
+ case($pr_array['condition'] = "containsnot"):
5673
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5674
+ $allowed = 0;
5675
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5676
+ $allowed = 0;
5677
+ }
5678
+ break;
5679
  case($pr_array['condition'] = "="):
5680
+ if (($pr_array['criteria'] == "$pd_value") AND ($pr_array['than'] == "exclude")){
5681
  $allowed = 0;
5682
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
5683
+ $found = strpos($pd_value,$pr_array['criteria']);
5684
+ if ($found !== false) {
5685
+ //for category mapping check if its an array
5686
+ if($pr_array['attribute'] == "raw_categories"){
5687
+ $raw_cats_arr = explode("||",$pd_value);
5688
+ if(is_array($raw_cats_arr)){
5689
+ if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
5690
+ if($allowed <> 0){
5691
+ $allowed = 1;
5692
+ }
5693
+ } else {
5694
+ $allowed = 0;
5695
+ }
5696
+ }
5697
+ } else {
5698
+ if($allowed <> 0){
5699
+ $allowed = 1;
5700
+ }
5701
+ }
5702
+ } else {
5703
+ $allowed = 0;
5704
+ }
5705
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5706
+ if($allowed <> 0){
5707
+ $allowed = 1;
5708
+ }
5709
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5710
+ // $allowed = 0;
5711
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5712
+ $allowed = 1;
5713
+ } else {
5714
+ // $allowed = 1; // Change made on February 24th 2021
5715
+ }
5716
+ break;
5717
+ case($pr_array['condition'] = "!="):
5718
+ if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5719
+ if($allowed <> 0){
5720
+ $allowed = 1;
5721
+ }
5722
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5723
+ $allowed = 0;
5724
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
5725
+ $allowed = 0;
5726
+ }
5727
+ break;
5728
+ case($pr_array['condition'] = ">"):
5729
+ // Use a lexical order on relational string operators
5730
+ if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5731
+ $allowed = 0;
5732
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5733
+ $allowed = 0;
5734
+ }
5735
+ break;
5736
+ case($pr_array['condition'] = ">="):
5737
+ // Use a lexical order on relational string operators
5738
+ if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5739
+ $allowed = 0;
5740
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5741
+ $allowed = 0;
5742
+ }
5743
+ break;
5744
+ case($pr_array['condition'] = "<"):
5745
+ // Use a lexical order on relational string operators
5746
+ if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5747
+ $allowed = 0;
5748
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5749
+ $allowed = 0;
5750
+ }
5751
+ break;
5752
+ case($pr_array['condition'] = "=<"):
5753
+ // Use a lexical order on relational string operators
5754
+ if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5755
+ $allowed = 0;
5756
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5757
+ $allowed = 0;
5758
+ }
5759
+ break;
5760
+ case($pr_array['condition'] = "empty"):
5761
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5762
+ $allowed = 0;
5763
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
5764
+ if($allowed <> 0){
5765
+ $allowed = 1;
5766
+ }
5767
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
5768
+ $allowed = 0;
5769
+ }
5770
+ break;
5771
+ default:
5772
+ break;
5773
+ }
5774
+ }
5775
+ }
5776
+ }
5777
+ }
5778
 
5779
+ if ($allowed < 1){
5780
+ $product_data = array();
5781
+ $product_data = null;
5782
+ } else {
5783
+ return $product_data;
5784
+ }
5785
+ }
5786
  }
js/woosea_add_cart.js CHANGED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+
3
+ console.log("Yes in script");
4
+
5
+ $( "select" ).change(function() {
6
+ //localStorage.removeItem("attributes");
7
+ var productId = $('input[name=product_id]').val();
8
+ var selectedValue = this.selectedOptions[0].value;
9
+ var selectedName = $(this).attr("name");
10
+ var storedAttributes = JSON.parse(localStorage.getItem("attributes"));
11
+
12
+ // Already saved a selection in local storage
13
+ if(storedAttributes){
14
+ // Only add new selections to the local storage
15
+ var len_value = selectedValue.length;
16
+ if(len_value > 0){
17
+ storedAttributes[selectedName] = selectedValue;
18
+ localStorage.setItem("attributes", JSON.stringify(storedAttributes));
19
+ }
20
+ } else {
21
+ var json_attributes = new Object();
22
+ json_attributes.productId = productId;
23
+ json_attributes[selectedName] = selectedValue;
24
+ localStorage.setItem("attributes", JSON.stringify(json_attributes));
25
+ }
26
+
27
+ var storedAttributes = JSON.parse(localStorage.getItem("attributes"));
28
+
29
+ // Now AJAX call to save in options
30
+ var inputdata = {
31
+ 'action': 'woosea_storedattributes_details',
32
+ 'data_to_pass': productId,
33
+ 'storedAttributes': storedAttributes,
34
+ 'nonce': frontEndAjax.nonce
35
+ }
36
+
37
+ $.post(frontEndAjax.ajaxurl, inputdata, function( response ) {
38
+ }, 'json' );
39
+
40
+ console.log(storedAttributes);
41
+ });
42
+
43
+ // For shop pages
44
+ $(".add_to_cart_button").click(function(){
45
+ var productId = $(this).attr('data-product_id');
46
+
47
+ // Ajax frontend
48
+ var inputdata = {
49
+ 'action': 'woosea_addtocart_details',
50
+ 'data_to_pass': productId,
51
+ 'nonce': frontEndAjax.nonce
52
+ }
53
+
54
+ $.post(frontEndAjax.ajaxurl, inputdata, function( response ) {
55
+ fbq('track', 'AddToCart', {
56
+ content_ids: response.product_id,
57
+ content_name: response.product_name,
58
+ content_category: response.product_cats,
59
+ content_type: 'product',
60
+ value: response.product_price,
61
+ currency: response.product_currency,
62
+ });
63
+ }, 'json' );
64
+ });
65
+
66
+ // For product pages
67
+ $(".single_add_to_cart_button").click(function(){
68
+ var productId = $('input[name=product_id]').val();
69
+
70
+ console.log("single product page");
71
+
72
+ if(!productId){
73
+ productId = $(this).attr('value');
74
+ }
75
+
76
+ // Ajax frontend
77
+ var inputdata = {
78
+ 'action': 'woosea_addtocart_details',
79
+ 'data_to_pass': productId,
80
+ 'nonce': frontEndAjax.nonce
81
+ }
82
+
83
+ $.post(frontEndAjax.ajaxurl, inputdata, function( response ) {
84
+
85
+ fbq('track', 'AddToCart', {
86
+ content_ids: response.product_id,
87
+ content_name: response.product_name,
88
+ content_category: response.product_cats,
89
+ content_type: 'product',
90
+ value: response.product_price,
91
+ currency: response.product_currency,
92
+ });
93
+ }, 'json' );
94
+ });
95
+ });
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=10.1.8',
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){
@@ -276,6 +296,26 @@ jQuery(function($) {
276
  }
277
  })
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  // Check if user would like to add a Facebook Pixel to their website
280
  $('#woosea_content_ids').on('change', function(){ // on change of state
281
  var content_ids = $('#woosea_content_ids').val();
@@ -414,7 +454,7 @@ jQuery(function($) {
414
  // Save Google Dynamic Remarketing pixel ID
415
  jQuery("#save_conversion_id").on('click',function(){
416
  var adwords_conversion_id = $('#adwords_conv_id').val();
417
- var re = /^[0-9]*$/;
418
 
419
  var woosea_valid_conversion_id=re.test(adwords_conversion_id);
420
  // Check for allowed characters
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){
296
  }
297
  })
298
 
299
+ // Check if user would like to enable addition of CDATA
300
+ $('#add_woosea_cdata').on('change', function(){ // on change of state
301
+ if(this.checked){
302
+
303
+ // Checkbox is on
304
+ jQuery.ajax({
305
+ method: "POST",
306
+ url: ajaxurl,
307
+ data: { 'action': 'woosea_add_woosea_cdata', 'status': "on" }
308
+ })
309
+ } else {
310
+ // Checkbox is off
311
+ jQuery.ajax({
312
+ method: "POST",
313
+ url: ajaxurl,
314
+ data: { 'action': 'woosea_add_woosea_cdata', 'status': "off" }
315
+ })
316
+ }
317
+ })
318
+
319
  // Check if user would like to add a Facebook Pixel to their website
320
  $('#woosea_content_ids').on('change', function(){ // on change of state
321
  var content_ids = $('#woosea_content_ids').val();
454
  // Save Google Dynamic Remarketing pixel ID
455
  jQuery("#save_conversion_id").on('click',function(){
456
  var adwords_conversion_id = $('#adwords_conv_id').val();
457
+ var re = /^[0-9,-]*$/;
458
 
459
  var woosea_valid_conversion_id=re.test(adwords_conversion_id);
460
  // Check for allowed characters
pages/admin/woosea-generate-feed-step-0.php CHANGED
@@ -395,7 +395,7 @@ if (array_key_exists('project_hash', $_GET)){
395
  </td>
396
  </tr>
397
  <tr id="product_variations">
398
- <td><span><?php _e('Include all product variations','woo-product-feed-pro' );?>:</span></td>
399
  <td>
400
  <label class="woo-product-feed-pro-switch">
401
  <?php
@@ -410,7 +410,7 @@ if (array_key_exists('project_hash', $_GET)){
410
  </td>
411
  </tr>
412
  <tr id="default_variation">
413
- <td><span><?php _e( 'Only include default product variation','woo-product-feed-pro' );?>:</span></td>
414
  <td>
415
  <label class="woo-product-feed-pro-switch">
416
  <?php
@@ -425,7 +425,7 @@ if (array_key_exists('project_hash', $_GET)){
425
  </td>
426
  </tr>
427
  <tr id="lowest_price_variation">
428
- <td><span><?php _e( 'Only include lowest priced product variation(s)','woo-product-feed-pro' );?>:</span></td>
429
  <td>
430
  <label class="woo-product-feed-pro-switch">
431
  <?php
395
  </td>
396
  </tr>
397
  <tr id="product_variations">
398
+ <td><span><?php _e('Include product variations','woo-product-feed-pro' );?>:</span></td>
399
  <td>
400
  <label class="woo-product-feed-pro-switch">
401
  <?php
410
  </td>
411
  </tr>
412
  <tr id="default_variation">
413
+ <td><span><?php _e( 'And only include default product variation','woo-product-feed-pro' );?>:</span></td>
414
  <td>
415
  <label class="woo-product-feed-pro-switch">
416
  <?php
425
  </td>
426
  </tr>
427
  <tr id="lowest_price_variation">
428
+ <td><span><?php _e( 'And only include lowest priced product variation(s)','woo-product-feed-pro' );?>:</span></td>
429
  <td>
430
  <label class="woo-product-feed-pro-switch">
431
  <?php
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">
@@ -96,7 +97,15 @@ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
96
  foreach($cron_projects as $key => $value){
97
  $cron_projects[$key]['active'] = "true";
98
  }
99
- update_option('cron_projects', $cron_projects,'no');
 
 
 
 
 
 
 
 
100
  } else {
101
  // Set default notification to show
102
  $getelite_notice = get_option('woosea_getelite_notification');
@@ -124,6 +133,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">
97
  foreach($cron_projects as $key => $value){
98
  $cron_projects[$key]['active'] = "true";
99
  }
100
+ update_option('cron_projects', $cron_projects,'no');
101
+ } elseif (array_key_exists('force-clean', $_GET)){
102
+ // Forcefully remove all feed and plugin configurations
103
+ delete_option( 'cron_projects' );
104
+ delete_option( 'channel_statics' );
105
+ delete_option( 'woosea_getelite_notification' );
106
+ delete_option( 'woosea_license_notification_closed' );
107
+ wp_clear_scheduled_hook( 'woosea_cron_hook' );
108
+ wp_clear_scheduled_hook( 'woosea_check_license' );
109
  } else {
110
  // Set default notification to show
111
  $getelite_notice = get_option('woosea_getelite_notification');
133
  <?php
134
  }
135
  }
136
+
137
+
138
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
139
+ ?>
140
+ <div class="notice notice-error is-dismissible">
141
+ <p>
142
+ <strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
143
+ 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>.
144
+ </p>
145
+ </div>
146
+ <?php
147
+ }
148
  ?>
149
 
150
  <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">
@@ -161,7 +175,7 @@ if(isset($_GET["tab"])) {
161
  </tr>
162
  <tr class="<?php print"$elite_disable";?>" id="identifier_option">
163
  <td>
164
- <span><?php _e( 'Add GTIN, MPN, UPC, EAN, Product condition, Optimised title, Installment, Unit measure and Brand attributes to your store:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/add-gtin-mpn-upc-ean-product-condition-optimised-title-and-brand-attributes/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=adding fields" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
165
  </td>
166
  <td>
167
  <label class="woo-product-feed-pro-switch">
@@ -179,7 +193,7 @@ if(isset($_GET["tab"])) {
179
  </tr>
180
  <tr class="<?php print"$elite_disable";?>" id="manipulation_option">
181
  <td>
182
- <span><?php _e( 'Enable Product data manipulation feature:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/feature-product-data-manipulation/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=wpml support" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
183
  </td>
184
  <td>
185
  <label class="woo-product-feed-pro-switch">
@@ -238,7 +252,7 @@ if(isset($_GET["tab"])) {
238
  ?>
239
  <tr>
240
  <td>
241
- <span><?php _e( 'Use mother main image for variations', 'woo-product-feed-pro');?></span>
242
  </td>
243
  <td>
244
  <label class="woo-product-feed-pro-switch">
@@ -256,7 +270,7 @@ if(isset($_GET["tab"])) {
256
  </tr>
257
  <tr>
258
  <td>
259
- <span><?php _e( 'Add shipping costs for all countries to feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
260
  </td>
261
  <td>
262
  <label class="woo-product-feed-pro-switch">
@@ -292,7 +306,25 @@ if(isset($_GET["tab"])) {
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  </td>
297
  <td>
298
  <label class="woo-product-feed-pro-switch">
@@ -326,6 +358,24 @@ if(isset($_GET["tab"])) {
326
  </label>
327
  </td>
328
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
 
330
  <tr id="facebook_pixel">
331
  <td>
@@ -423,7 +473,7 @@ if(isset($_GET["tab"])) {
423
  if($add_batch == "yes"){
424
  $woosea_batch_size = get_option('woosea_batch_size');
425
 
426
- print "<tr id=\"woosea_batch_size\"><td colspan=\"2\"><span>Insert batch size:</span>&nbsp;<input type=\"text\" class=\"input-field-medium\" id=\"batch_size\" name=\"batch_size\" value=\"$woosea_batch_size\">&nbsp;<input type=\"submit\" id=\"save_batch_size\" value=\"Save\"></td></tr>";
427
  }
428
  ?>
429
  </form>
@@ -440,70 +490,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,10 +584,14 @@ 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>";
521
- print "<tr><td>PHP-version sufficient</td><td>$php_validation ($versions[PHP])</td></tr>";
522
  print "<tr><td>Product feed directory writable</td><td>$directory_perm</td></tr>";
523
  print "<tr><td>Product feed XML directory writable</td><td>$directory_perm_xml</td></tr>";
524
  print "<tr><td>Product feed CSV directory writable</td><td>$directory_perm_csv</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">
175
  </tr>
176
  <tr class="<?php print"$elite_disable";?>" id="identifier_option">
177
  <td>
178
+ <span><?php _e( 'Add GTIN, MPN, UPC, EAN, Product condition, Optimised title, Installment, Unit measure, Brand and many more attributes to your store:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/add-gtin-mpn-upc-ean-product-condition-optimised-title-and-brand-attributes/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=adding fields" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
179
  </td>
180
  <td>
181
  <label class="woo-product-feed-pro-switch">
193
  </tr>
194
  <tr class="<?php print"$elite_disable";?>" id="manipulation_option">
195
  <td>
196
+ <span><?php _e( 'Enable the Product Data Manipulation feature:', 'woo-product-feed-pro' );?> (<a href="https://adtribes.io/feature-product-data-manipulation/?utm_source=<?php print "$host";?>&utm_medium=manage-settings&utm_content=wpml support" target="_blank"><?php _e( 'Read more about this', 'woo-product-feed-pro' );?>)</a></span>
197
  </td>
198
  <td>
199
  <label class="woo-product-feed-pro-switch">
252
  ?>
253
  <tr>
254
  <td>
255
+ <span><?php _e( 'Use parent variable product image for variations', 'woo-product-feed-pro');?></span>
256
  </td>
257
  <td>
258
  <label class="woo-product-feed-pro-switch">
270
  </tr>
271
  <tr>
272
  <td>
273
+ <span><?php _e( 'Add shipping costs for all countries to your feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
274
  </td>
275
  <td>
276
  <label class="woo-product-feed-pro-switch">
306
  </tr>
307
  <tr>
308
  <td>
309
+ <span><?php _e( 'Remove the free shipping zone from your 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 your feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
328
  </td>
329
  <td>
330
  <label class="woo-product-feed-pro-switch">
358
  </label>
359
  </td>
360
  </tr>
361
+ <tr>
362
+ <td>
363
+ <span><?php _e( 'Add CDATA to title, description and short description:', 'woo-product-feed-pro');?></span>
364
+ </td>
365
+ <td>
366
+ <label class="woo-product-feed-pro-switch">
367
+ <?php
368
+ $add_woosea_cdata = get_option ('add_woosea_cdata');
369
+ if($add_woosea_cdata == "yes"){
370
+ print "<input type=\"checkbox\" id=\"add_woosea_cdata\" name=\"add_woosea_cdata\" class=\"checkbox-field\" checked>";
371
+ } else {
372
+ print "<input type=\"checkbox\" id=\"add_woosea_cdata\" name=\"add_woosea_cdata\" class=\"checkbox-field\">";
373
+ }
374
+ ?>
375
+ <div class="woo-product-feed-pro-slider round"></div>
376
+ </label>
377
+ </td>
378
+ </tr>
379
 
380
  <tr id="facebook_pixel">
381
  <td>
473
  if($add_batch == "yes"){
474
  $woosea_batch_size = get_option('woosea_batch_size');
475
 
476
+ print "<tr id=\"woosea_batch_size\"><td colspan=\"2\"><span>Insert batch size:</span>&nbsp;<input type=\"text\" class=\"input-field-medium\" id=\"batch_size\" name=\"batch_size\" value=\"$woosea_batch_size\">&nbsp;<input type=\"button\" id=\"save_batch_size\" value=\"Save\"></td></tr>";
477
  }
478
  ?>
479
  </form>
490
  $external_path_tsv = $external_base . "/woo-product-feed-pro/";
491
  $external_path_logs = $external_base . "/woo-product-feed-pro/";
492
  $test_file = $external_path . "/tesfile.txt";
493
+ $test_file_xml = $external_path . "xml/tesfile.txt";
494
+ $test_file_csv = $external_path . "csv/tesfile.txt";
495
+ $test_file_txt = $external_path . "txt/tesfile.txt";
496
+ $test_file_tsv = $external_path . "tsv/tesfile.txt";
497
+ $test_file_logs = $external_path . "logs/tesfile.txt";
498
 
499
  if (is_writable($external_path)) {
500
+ // Normal root category
501
+ $fp = @fopen($test_file, 'w');
502
+ @fwrite($fp, 'Cats chase mice');
503
+ @fclose($fp);
504
+ if(is_file($test_file)){
505
+ $directory_perm = "True";
506
+ }
507
+
508
+ // XML subcategory
509
+ $fp = @fopen($test_file_xml, 'w');
510
+ if(!is_bool($fp)){
511
+ @fwrite($fp, 'Cats chase mice');
512
+ @fclose($fp);
513
+ if(is_file($test_file_xml)){
514
+ $directory_perm_xml = "True";
515
+ } else {
516
+ $directory_perm_xml = "False";
517
+ }
518
+ } else {
519
+ $directory_perm_xml = "Unknown";
520
+ }
521
+
522
+ // CSV subcategory
523
+ $fp = @fopen($test_file_csv, 'w');
524
+ if(!is_bool($fp)){
525
+ @fwrite($fp, 'Cats chase mice');
526
+ @fclose($fp);
527
+ if(is_file($test_file_csv)){
528
+ $directory_perm_csv = "True";
529
+ } else {
530
+ $directory_perm_csv = "False";
531
+ }
532
+ } else {
533
+ $directory_perm_csv = "Unknown";
534
+ }
535
+
536
+ // TXT subcategory
537
+ $fp = @fopen($test_file_txt, 'w');
538
+ if(!is_bool($fp)){
539
+ @fwrite($fp, 'Cats chase mice');
540
+ @fclose($fp);
541
+ if(is_file($test_file_txt)){
542
+ $directory_perm_txt = "True";
543
+ } else {
544
+ $directory_perm_txt = "False";
545
+ }
546
+ } else {
547
+ $directory_perm_txt = "Unknown";
548
+ }
549
+ // TSV subcategory
550
+ $fp = @fopen($test_file_tsv, 'w');
551
+ if(!is_bool($fp)){
552
+ @fwrite($fp, 'Cats chase mice');
553
+ @fclose($fp);
554
+ if(is_file($test_file_tsv)){
555
+ $directory_perm_tsv = "True";
556
+ } else {
557
+ $directory_perm_tsv = "False";
558
+ }
559
+ } else {
560
+ $directory_perm_tsv = "Uknown";
561
+ }
562
+
563
+ // Logs subcategory
564
+ $fp = @fopen($test_file_logs, 'w');
565
+ if(!is_bool($fp)){
566
+ @fwrite($fp, 'Cats chase mice');
567
+ @fclose($fp);
568
+ if(is_file($test_file_logs)){
569
+ $directory_perm_logs = "True";
570
+ } else {
571
+ $directory_perm_logs = "False";
572
+ }
573
+ } else {
574
+ $directory_perm_logs = "Unknown";
575
+ }
576
  } else {
577
  $directory_perm = "False";
578
  }
584
  $cron_enabled = "True";
585
  }
586
 
587
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
588
+ $cron_enabled = "<strong>False</strong>";
589
+ }
590
+
591
  print "<table class=\"woo-product-feed-pro-table\">";
592
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
593
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
594
+ print "<tr><td>PHP-version</td><td>$php_validation ($versions[PHP])</td></tr>";
595
  print "<tr><td>Product feed directory writable</td><td>$directory_perm</td></tr>";
596
  print "<tr><td>Product feed XML directory writable</td><td>$directory_perm_xml</td></tr>";
597
  print "<tr><td>Product feed CSV directory writable</td><td>$directory_perm_csv</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;
@@ -125,6 +130,7 @@ Our plugin supports Polylang
125
  * Google Analytics support: add Google Analytics UTM parameters to your product feed and individual products.
126
  * Supports the official Facebook for WooCommerce plugin (SKU_ID parameter)
127
  * Supports Yoasts primary category feature
 
128
  * Supports the official "WooCommerce Brands" plugin
129
  * Supports Yith brand attributes
130
  * Supports the official "WooCommerce Product Bundles" plugin
@@ -134,19 +140,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
@@ -158,8 +164,9 @@ Some of the above mentioned feature can only be used by users who upgraded to th
158
  * Google Local Products
159
  * Google Local Products Inventory
160
  * Google Shopping Actions
161
- * Facebook Dynamic Ads / 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 +182,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 +237,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 +258,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 +331,261 @@ 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 +3252,261 @@ 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: 10.1.8
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;
130
  * Google Analytics support: add Google Analytics UTM parameters to your product feed and individual products.
131
  * Supports the official Facebook for WooCommerce plugin (SKU_ID parameter)
132
  * Supports Yoasts primary category feature
133
+ * Supports Rankmaths primary category feature
134
  * Supports the official "WooCommerce Brands" plugin
135
  * Supports Yith brand attributes
136
  * Supports the official "WooCommerce Product Bundles" plugin
140
  * Supports WooCommerce Dynamic Pricing & Discounts from RightPress
141
  * Supports the Discount Rules for WooCommerce plugin from FlyCart
142
  * Supports WC Fields Factory
143
+ * Supports Table Rate Shipping for WooCommerce from WooCommerce
144
  * Supports Table Rate Shipping for WooCommerce from Bolder Elements
145
  * Supports usage of the All In One SEO pack title and description attributes
146
 
147
  Some of the above mentioned feature can only be used by users who upgraded to the Elite version of our plugin
148
 
149
  === Elite paid features ===
150
+ * WPML / WCML support
151
  * Aelia currency switcher support
152
  * Polylang support
153
  * Addition of the extra fields on your product edit pages
154
  * Data manipulation feature
155
  * WooCommerce structured data bug fix
 
156
 
157
  === Channels ===
158
  * Custom feeds
164
  * Google Local Products
165
  * Google Local Products Inventory
166
  * Google Shopping Actions
167
+ * Facebook Dynamic Ad's / remarketing
168
  * Bing Shopping
169
+ * Bing Shopping Promotions
170
  * Pinterest
171
  * <a href="https://businesshelp.snapchat.com/en-US/a/product-catalog-specs" target="_blank">Snapchat</a>
172
  * <a href="https://yandex.com/support/market-tech-requirements/index.html" target="_blank">Yandex</a>
182
  * <a href="https://www.beslist.nl" target="_blank" rel="nofollow">Beslist.nl</a>
183
  * <a href="https://www.beslist.be" target="_blank" rel="nofollow">Beslist.be</a>
184
  * <a href="https://www.fashionchick.nl" target="_blank">Fashionchick.nl</a>
185
+ * <a href="https://www.boetiek.nl" target="_blank">Boetiek.nl</a>
186
  * Bol.com
187
  * Stylight
188
  * Incurvy
237
  * <a href="https://www.guenstiger.de" target="_blank" rel="nofollow">Guenstiger.de</a>
238
  * Hood.de
239
  * Ladenzeile.de
240
+ * <a href="https://connect.idealo.de/import/en/csv/#_attributes_documentation" target="_blank">Idealo.de</a>
241
  * Livingo.de
242
  * Medizinfuchs.de
243
  * <a href="https://www.moebel.de" target="_blank">Moebel.de</a>
258
  == Installation ==
259
 
260
  === From within Wordpress ===
261
+ 1. Visit Plugins > Add New;
262
+ 1. Search for Product Feed PRO for WooCommerce;
263
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
264
 
265
  === Manually ===
266
  1. Upload the woo-product-feed-pro folder to your /wp-content/plugins/ directory;
267
+ 1. Activate Product Feed PRO for WooCommerce from your plugins page.
268
 
269
  == Frequently Asked Questions ==
270
 
331
 
332
  === Changelog ===
333
 
334
+ = 10.1.8 (2021-05-31) =
335
+ * When the identifier exists field mapping is removed from the field mapping also remove it from the feed
336
+ * Some minor textual changes in the feed configuration forms
337
+
338
+ = 10.1.7 (2021-05-27) =
339
+ * Fixed a bug: The Facebook pixel addToCart, initiateCheckout and Purchase event does not accept comma's in prices. Fixed.
340
+
341
+ = 10.1.6 (2021-05-27) =
342
+ * Fixed a bug: The Facebook pixel viewContent event does not accept comma's in prices. Fixed.
343
+
344
+ = 10.1.5 (2021-05-24) =
345
+ * Fixed a bug: exclude filters on regular prices did not work
346
+
347
+ = 10.1.4 (2021-05-24) =
348
+ * Adding CDATA feature so CDATA can be added to the title, description and short description fields
349
+
350
+ = 10.1.3 (2021-05-24) =
351
+ * Fixed an issue with taxes being added in the system sale prices
352
+
353
+ = 10.1.2 (2021-05-14) =
354
+ * Added the product type field mapping as default mapping for Google Shopping feeds
355
+
356
+ = 10.1.1 (2021-05-12) =
357
+ * Added support for Mix and Match minimum and maximum prices
358
+ * Removed the item_group_id for Mix and Match products
359
+
360
+ = 10.1.0 (2021-05-12) =
361
+ * Tested for compatibility with WooCommerce 5.3
362
+ * Changed UI when saving new plugin batch size so it shows the correct batch number immediatly
363
+
364
+ = 10.0.9 (2021-05-04) =
365
+ * Added extra fields for Google's local storefront shopping feeds
366
+
367
+ = 10.0.8 (2021-04-28) =
368
+ * Fixed an issue with the image field for custom feeds, it was added as image_link. This has been fixed now.
369
+
370
+ = 10.0.7 (2021-04-27) =
371
+ * Added support for ACF image fields (make sure to use image or bild in your field name)
372
+
373
+ = 10.0.6 (2021-04-27) =
374
+ * Added support for the WooCommerce Shipping & Tax plugin
375
+
376
+ = 10.0.5 (2021-04-21) =
377
+ * Added the "pickup today / merchant hosted local storefront" fields for Google Shopping
378
+
379
+ = 10.0.4 (2021-04-19) =
380
+ * Fixed an issue where shipping costs where missing from feeds
381
+ * Lowest shipping costs did not return the lowest price when prices where not numeric. This has been fixed now.
382
+
383
+ = 10.0.3 (2021-04-19) =
384
+ * When variations are out of stock we remove them from the parent product for Skroutz feeds
385
+
386
+ = 10.0.2 (2021-04-18) =
387
+ * Fixed a bug: rules that where set on attributes that were empty accidently added values to the product data. This has been fixed now.
388
+
389
+ = 10.0.1 (2021-04-16) =
390
+ * Fixed a bug: the multiple standard tax rates are now also taken into account for shipping costs
391
+
392
+ = 10.0.0 (2021-04-15) =
393
+ * Fixed a bug: when multiple standard tax rates for multiple countries where configured the plugin did not pick the correct tax rate when a feed was configured for a country other then the base country. This has been fixed now.
394
+
395
+ = 9.9.9 (2021-04-12) =
396
+ * Added a "force clean-up" feature that in one go removes all feed configurations and scheduled jobs
397
+
398
+ = 9.9.8 (2021-04-12) =
399
+ * Added support for non numeric characters in the AW Dynamic tracking ID
400
+
401
+ = 9.9.7 (2021-04-11) =
402
+ * Fixed helptexts and notifications
403
+
404
+ = 9.9.6 (2021-04-08) =
405
+ * Added support for the Rankmath primary category
406
+
407
+ = 9.9.5 (2021-04-08) =
408
+ * Fixed an issue with the product_url field for Google review feeds. The & charcater was shown as AND. Issue fixed now.
409
+
410
+ = 9.9.4 (2021-03-30) =
411
+ * Added lowest shipping costs attribute
412
+
413
+ = 9.9.3 (2021-03-29) =
414
+ * Removed currency from shipping costs of Heureka feeds
415
+
416
+ = 9.9.2 (2021-03-27) =
417
+ * Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
418
+
419
+ = 9.9.1 (2021-03-25) =
420
+ * Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
421
+
422
+ = 9.9.0 (2021-03-24) =
423
+ * Added product type field mapping to the Facebook template
424
+ * Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
425
+
426
+ = 9.8.9 (2021-03-22) =
427
+ * Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
428
+
429
+ = 9.8.8 (2021-03-22) =
430
+ * Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
431
+
432
+ = 9.8.7 (2021-03-22) =
433
+ * Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
434
+
435
+ = 9.8.6 (2021-03-19) =
436
+ * Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
437
+
438
+ = 9.8.5 (2021-03-18) =
439
+ * Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
440
+
441
+ = 9.8.4 (2021-03-18) =
442
+ * Added the Idealo.de Germany template, including their Direktkauf fields
443
+
444
+ = 9.8.3 (2021-03-15) =
445
+ * Solved a rounding issue for sale prices including VAT
446
+
447
+ = 9.8.2 (2021-03-15) =
448
+ * 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
449
+
450
+ = 9.8.1 (2021-03-13) =
451
+ * The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
452
+
453
+ = 9.8.0 (2021-03-11) =
454
+ * Only reviews that are approved make it to the review feeds, disapproved reviews are removed
455
+
456
+ = 9.7.9 (2021-03-10) =
457
+ * Checked for compatibility with WordPress 5.7
458
+ * Checked for compatibility with WooCommerce 5.1
459
+
460
+ = 9.7.8 (2021-03-10) =
461
+ * Added a boolean check on the review feed creation
462
+
463
+ = 9.7.7 (2021-03-09) =
464
+ * Removed the woosea_add_cart.js from the source as it was an empty file
465
+
466
+ = 9.7.6 (2021-03-08) =
467
+ * Fixed an issue with the Facebook Purchase event that did not track the order value correct
468
+
469
+ = 9.7.5 (2021-03-07) =
470
+ * Another recode of the lowest price variation feature
471
+
472
+ = 9.7.4 (2021-03-05) =
473
+ * Added Bing Shopping Promotions template
474
+
475
+ = 9.7.3 (2021-03-04) =
476
+ * Added a new attribute "Stock Status WooCommerce"
477
+ * Fixed another quote issue with the Facebook pixel
478
+
479
+ = 9.7.2 (2021-03-03) =
480
+ * Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
481
+
482
+ = 9.7.1 (2021-03-03) =
483
+ * Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
484
+
485
+ = 9.7.0 (2021-03-03) =
486
+ * Fixed a bug where lowest priced variations where not making it to feeds
487
+
488
+ = 9.6.9 (2021-02-28) =
489
+ * Added product name parent hyphen attribute
490
+
491
+ = 9.6.8 (2021-02-25) =
492
+ * Added Google category taxonomy mapping for Snapchat feeds
493
+
494
+ = 9.6.7 (2021-02-25) =
495
+ * When suffixes and prefixes are used for the Heureka URL fields spaces are removed
496
+
497
+ = 9.6.6 (2021-02-24) =
498
+ * Added support for PHP 8.0
499
+
500
+ = 9.6.5 (2021-02-24) =
501
+ * Do not add Skroutz variable products to the feed when they do not have item_group_id's
502
+
503
+ = 9.6.4 (2021-02-24) =
504
+ * Fixed an issue with rules and filters
505
+ * When a rule was set on an image link, no longer lowercase the image link
506
+
507
+ = 9.6.3 (2021-02-23) =
508
+ * Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
509
+ * Reverted back some changes in filters and rules
510
+
511
+ = 9.6.2 (2021-02-22) =
512
+ * For Skroutz feed removing sizes from feeds when they are out-of-stock
513
+
514
+ = 9.6.1 (2021-02-19) =
515
+ * Added attribute that will allow you to uppercase every first character of a string in product names
516
+
517
+ = 9.6.0 (2021-02-19) =
518
+ * Changed g:itemid to g:id for the Google Local Product Feeds
519
+
520
+ = 9.5.9 (2021-02-19) =
521
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
522
+
523
+ = 9.5.8 (2021-02-18) =
524
+ * Added shipping class name attribute
525
+
526
+ = 9.5.7 (2021-02-17) =
527
+ * Dynamic attribute values are now also added to parent variable products for Skroutz feeds
528
+
529
+ = 9.5.6 (2021-02-17) =
530
+ * Changed attribute name primary category to Yoast primary category as it caused lots of confussion
531
+
532
+ = 9.5.5 (2021-02-11) =
533
+ * Fixed a PHP notice that showed when creating a new rule
534
+ * Tested for compatibility with WooCommerce 5.0
535
+
536
+ = 9.5.4 (2021-02-09) =
537
+ * When free shipping zones are removed do not remove the other shipping zones
538
+
539
+ = 9.5.3 (2021-02-08) =
540
+ * Added a feature to remove free shipping zones from Google and Facebook feeds
541
+
542
+ = 9.5.2 (2021-02-08) =
543
+ * Fixed a minor issue in exclude rules for WooCommerce category names
544
+
545
+ = 9.5.1 (2021-02-02) =
546
+ * Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
547
+
548
+ = 9.5.0 (2021-02-01) =
549
+ * Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
550
+
551
+ = 9.4.9 (2021-01-31) =
552
+ * Added a seperate sale price attribute for bundled products
553
+ * Reviews for parent variable products are removed, the reviews are attached to its variations
554
+
555
+ = 9.4.8 (2021-01-30) =
556
+ * Fixed an issue with the ecomm_prodid on the cart page
557
+
558
+ = 9.4.7 (2021-01-29) =
559
+ * Solved an issue that shipping costs to the first product in a custom feed where empty
560
+
561
+ = 9.4.6 (2021-01-28) =
562
+ * Added a new attribute: product description parent product
563
+
564
+ = 9.4.5 (2021-01-28) =
565
+ * Added a Google Shopping field to their template: g:ship_from_country
566
+ * Stripping & characters from review names as it breaks the review feeds
567
+
568
+ = 9.4.4 (2021-01-27) =
569
+ * 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.
570
+
571
+ = 9.4.3 (2021-01-27) =
572
+ * Fixed an issue with an undefined ecomm_price variable on product variable pages
573
+
574
+ = 9.4.2 (2021-01-26) =
575
+ * Added the Dutch Boetiek.nl template
576
+
577
+ = 9.4.1 (2021-01-19) =
578
+ * Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
579
+
580
+ = 9.4.0 (2021-01-14) =
581
+ * Added a WP-cron check and notifications
582
+
583
+ = 9.3.9 (2021-01-14) =
584
+ * Bestprice.gr apparel products are now grouped by color
585
+
586
+ = 9.3.8 (2021-01-13) =
587
+ * Tested for compatibility with WooCommerce 4.9
588
+
589
  = 9.3.7 (2021-01-12) =
590
  * Added the Bestprice.gr template
591
 
3252
 
3253
  == Upgrade Notice ==
3254
 
3255
+ = 10.1.8 =
3256
+ When the identifier exists field mapping is removed from the field mapping also remove it from the feed
3257
+ Some minor textual changes in the feed configuration forms
3258
+
3259
+ = 10.1.7 =
3260
+ Fixed a bug: The Facebook pixel addToCart, initiateCheckout and Purchase event does not accept comma's in prices. Fixed.
3261
+
3262
+ = 10.1.6 =
3263
+ Fixed a bug: The Facebook pixel viewContent event does not accept comma's in prices. Fixed.
3264
+
3265
+ = 10.1.5 =
3266
+ Fixed a bug: exclude filters on regular prices did not work
3267
+
3268
+ = 10.1.4 =
3269
+ Adding CDATA feature so CDATA can be added to the title, description and short description fields
3270
+
3271
+ = 10.1.3 =
3272
+ Fixed an issue with taxes being added in the system sale prices
3273
+
3274
+ = 10.1.2 =
3275
+ Added the product type field mapping as default mapping for Google Shopping feeds
3276
+
3277
+ = 10.1.1 =
3278
+ Added support for Mix and Match minimum and maximum prices
3279
+ Removed the item_group_id for Mix and Match products
3280
+
3281
+ = 10.1.0 =
3282
+ Tested for compatibility with WooCommerce 5.3
3283
+ Changed UI when saving new plugin batch size so it shows the correct batch number immediatly
3284
+
3285
+ = 10.0.9 =
3286
+ Added extra fields for Google's local storefront shopping feeds
3287
+
3288
+ = 10.0.8 =
3289
+ Fixed an issue with the image field for custom feeds, it was added as image_link. This has been fixed now.
3290
+
3291
+ = 10.0.7 =
3292
+ Added support for ACF image fields (make sure to use image or bild in your field name)
3293
+
3294
+ = 10.0.6 =
3295
+ Added support for the WooCommerce Shipping & Tax plugin
3296
+
3297
+ = 10.0.5 =
3298
+ Added the "pickup today / merchant hosted local storefront" fields for Google Shopping
3299
+
3300
+ = 10.0.4 =
3301
+ Fixed an issue where shipping costs where missing from feeds
3302
+ Lowest shipping costs did not return the lowest price when prices where not numeric. This has been fixed now.
3303
+
3304
+ = 10.0.3 =
3305
+ When variations are out of stock we remove them from the parent product for Skroutz feeds
3306
+
3307
+ = 10.0.2 =
3308
+ Fixed a bug: rules that where set on attributes that were empty accidently added values to the product data. This has been fixed now.
3309
+
3310
+ = 10.0.1 =
3311
+ Fixed a bug: the multiple standard tax rates are now also taken into account for shipping costs
3312
+
3313
+ = 10.0.0 =
3314
+ Fixed a bug: when multiple standard tax rates for multiple countries where configured the plugin did not pick the correct tax rate when a feed was configured for a country other then the base country. This has been fixed now.
3315
+
3316
+ = 9.9.9 =
3317
+ Added a "force clean-up" feature that in one go removes all feed configurations and scheduled jobs
3318
+
3319
+ = 9.9.8 =
3320
+ Added support for non numeric characters in the AW Dynamic tracking ID
3321
+
3322
+ = 9.9.7 =
3323
+ Fixed helptexts and notifications
3324
+
3325
+ = 9.9.6 =
3326
+ Added support for the Rankmath primary category
3327
+
3328
+ = 9.9.5 =
3329
+ Fixed an issue with the product_url field for Google review feeds. The & charcater was shown as AND. Issue fixed now.
3330
+
3331
+ = 9.9.4 =
3332
+ Added lowest shipping costs attribute
3333
+
3334
+ = 9.9.3 =
3335
+ Removed currency from shipping costs of Heureka feeds
3336
+
3337
+ = 9.9.2 =
3338
+ Fixed an issue for the shipping table rate plugin, when multiple where configured only one price made it to the feed. Issue is fixed.
3339
+
3340
+ = 9.9.1 =
3341
+ Added support for the official WooCommerce Table Rate plugin (by WooCommerce)
3342
+
3343
+ = 9.9.0 =
3344
+ Added product type field mapping to the Facebook template
3345
+ Change the default field mapping for title to "product name parent product" so grouping on variable products works better in Facebook
3346
+
3347
+ = 9.8.9 =
3348
+ Fixed a Table Rate shipping issue that overwrote shipping costs for Flat Rates.
3349
+
3350
+ = 9.8.8 =
3351
+ Fixed an UI issue with filters and rules, apostrofs were not showing. Issue is fixed now.
3352
+
3353
+ = 9.8.7 =
3354
+ Bundle and composite products should not get an item group ID in the feed, removed it from the feed.
3355
+
3356
+ = 9.8.6 =
3357
+ Fixed an issue where shipping tax was not added for WooCommerce table rate shipping costs
3358
+
3359
+ = 9.8.5 =
3360
+ Affiliate / external product types got an item_group_id of 0 in the feed whereas it should be empty. Issue is fixed now.
3361
+
3362
+ = 9.8.4 =
3363
+ Added the Idealo.de Germany template, including their Direktkauf fields
3364
+
3365
+ = 9.8.3 =
3366
+ Solved a rounding issue for sale prices including VAT
3367
+
3368
+ = 9.8.2 =
3369
+ 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
3370
+
3371
+ = 9.8.1 =
3372
+ The plugin systems check showed a critical error for users that are on PHP 8. Issue is fixed now.
3373
+
3374
+ = 9.8.0 =
3375
+ Only reviews that are approved make it to the review feeds, disapproved reviews are removed
3376
+
3377
+ = 9.7.9 =
3378
+ Checked for compatibility with WordPress 5.7
3379
+ Checked for compatibility with WooCommerce 5.1.0
3380
+
3381
+ = 9.7.8 =
3382
+ Added a boolean check on the review feed creation
3383
+
3384
+ = 9.7.7 =
3385
+ Removed the woosea_add_cart.js from the source as it was an empty file
3386
+
3387
+ = 9.7.6 =
3388
+ Fixed an issue with the Facebook Purchase event that did not track the order value correct
3389
+
3390
+ = 9.7.5 =
3391
+ Another recode of the lowest price variation feature
3392
+
3393
+ = 9.7.4 =
3394
+ Added Bing Shopping Promotions template
3395
+
3396
+ = 9.7.3 =
3397
+ Added a new attribute "Stock Status WooCommerce"
3398
+ Fixed another quote issue with the Facebook pixel
3399
+
3400
+ = 9.7.2 =
3401
+ Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
3402
+
3403
+ = 9.7.1 =
3404
+ Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
3405
+
3406
+ = 9.7.0 =
3407
+ Fixed a bug where lowest priced variations where not making it to feeds
3408
+
3409
+ = 9.6.9 =
3410
+ Added product name parent hyphen attribute
3411
+
3412
+ = 9.6.8 =
3413
+ Added Google category taxonomy mapping for Snapchat feeds
3414
+
3415
+ = 9.6.7 =
3416
+ When suffixes and prefixes are used for the Heureka URL fields spaces are removed
3417
+
3418
+ = 9.6.6 =
3419
+ Added support for PHP 8.0
3420
+
3421
+ = 9.6.5 =
3422
+ Do not add Skroutz variable products to the feed when they do not have item_group_id's
3423
+
3424
+ = 9.6.4 =
3425
+ Fixed an issue with rules and filters
3426
+ When a rule was set on an image link, no longer lowercase the image link
3427
+
3428
+ = 9.6.3 =
3429
+ Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
3430
+ Reverted back some changes in filters and rules
3431
+
3432
+ = 9.6.2 =
3433
+ For Skroutz feed removing sizes from feeds when they are out-of-stock
3434
+
3435
+ = 9.6.1 =
3436
+ Added attribute that will allow you to uppercase every first character of a string in product names
3437
+
3438
+ = 9.6.0 =
3439
+ Changed g:itemid to g:id for the Google Local Product Feeds
3440
+
3441
+ = 9.5.9 =
3442
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
3443
+
3444
+ = 9.5.8 =
3445
+ Added shipping class name attribute
3446
+
3447
+ = 9.5.7 =
3448
+ Dynamic attribute values are now also added to parent variable products for Skroutz feeds
3449
+
3450
+ = 9.5.6 =
3451
+ Changed attribute name primary category to Yoast primary category as it caused lots of confussion
3452
+
3453
+ = 9.5.5 =
3454
+ Fixed a PHP notice that showed when creating a new rule
3455
+ Tested for compatibility with WooCommerce 5.0
3456
+
3457
+ = 9.5.4 =
3458
+ When free shipping zones are removed do not remove the other shipping zones
3459
+
3460
+ = 9.5.3 =
3461
+ Added a feature to remove free shipping zones from Google and Facebook feeds
3462
+
3463
+ = 9.5.2 =
3464
+ Fixed a minor issue in exclude rules for WooCommerce category names
3465
+
3466
+ = 9.5.1 =
3467
+ Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
3468
+
3469
+ = 9.5.0 =
3470
+ Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
3471
+
3472
+ = 9.4.9 =
3473
+ Added a seperate sale price attribute for bundled products
3474
+ Reviews for parent variable products are removed, the reviews are attached to its variations
3475
+
3476
+ = 9.4.8 =
3477
+ Fixed an issue with the ecomm_prodid on the cart page
3478
+
3479
+ = 9.4.7 =
3480
+ Solved an issue that shipping costs to the first product in a custom feed where empty
3481
+
3482
+ = 9.4.6 =
3483
+ Added a new attribute: product description parent product
3484
+
3485
+ = 9.4.5 =
3486
+ Added a Google Shopping field to their template: g:ship_from_country
3487
+ Stripping & characters from review names as it breaks the review feeds
3488
+
3489
+ = 9.4.4 =
3490
+ 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.
3491
+
3492
+ = 9.4.3 =
3493
+ Fixed an issue with an undefined ecomm_price variable on product variable pages
3494
+
3495
+ = 9.4.2 =
3496
+ Added the Dutch Boetiek.nl template
3497
+
3498
+ = 9.4.1 =
3499
+ Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
3500
+
3501
+ = 9.4.0 =
3502
+ Added a WP-cron check and notifications
3503
+
3504
+ = 9.3.9 =
3505
+ Bestprice.gr apparel products are now grouped by color
3506
+
3507
+ = 9.3.8 =
3508
+ Tested for compatibility with WooCommerce 4.9
3509
+
3510
  = 9.3.7 =
3511
  Added the Bestprice.gr template
3512
 
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
@@ -138,6 +138,9 @@ function woosea_scripts($hook) {
138
  wp_register_script( 'woosea_key-js', plugin_dir_url( __FILE__ ) . 'js/woosea_key.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
139
  wp_enqueue_script( 'woosea_key-js' );
140
 
 
 
 
141
  }
142
  // JS for manage projects page
143
  wp_register_script( 'woosea_manage-js', plugin_dir_url( __FILE__ ) . 'js/woosea_manage.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
@@ -279,7 +282,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 +305,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 +338,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 +351,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
  }
@@ -384,6 +391,7 @@ function woosea_add_facebook_pixel( $product = null ){
384
  $fb_price = $fb_lowprice;
385
  }
386
  }
 
387
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
388
  } else {
389
  // This is a parent variable product
@@ -415,11 +423,13 @@ function woosea_add_facebook_pixel( $product = null ){
415
  $fb_highprice = wc_format_localized_price( $highest );
416
  $fb_price = $fb_lowprice;
417
  }
 
418
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product_group\", content_ids:[$content], value:\"$fb_price\", currency:\"$currency\"});";
419
  }
420
  } else {
421
  // This is a simple product page
422
- $fb_price = wc_format_localized_price( $product->get_price() );
 
423
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
424
  }
425
  }
@@ -433,8 +443,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,17 +453,12 @@ 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
  }
456
  $contents = rtrim($contents, ",");
 
457
  $viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$order_real', content_type:'product', contents:[$contents]});";
458
  }
459
  } else {
@@ -463,6 +468,9 @@ 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 +485,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 +526,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 +556,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 +625,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 +662,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 +676,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 +813,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 +2295,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
@@ -2300,6 +2325,20 @@ function woosea_add_woosea_logging (){
2300
  }
2301
  add_action( 'wp_ajax_woosea_add_woosea_logging', 'woosea_add_woosea_logging' );
2302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2303
  /**
2304
  * This function enables the setting to add
2305
  * the Faceook pixel
@@ -4618,13 +4657,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 +4675,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: 10.1.8
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.3
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', '10.1.8' );
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
138
  wp_register_script( 'woosea_key-js', plugin_dir_url( __FILE__ ) . 'js/woosea_key.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
139
  wp_enqueue_script( 'woosea_key-js' );
140
 
141
+ // JS for managing addToCart event
142
+ // wp_register_script( 'woosea_addcart-js', plugin_dir_url( __FILE__ ) . 'js/woosea_add_cart.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
143
+ // wp_enqueue_script( 'woosea_addcart-js' );
144
  }
145
  // JS for manage projects page
146
  wp_register_script( 'woosea_manage-js', plugin_dir_url( __FILE__ ) . 'js/woosea_manage.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
282
  /**
283
  * Get category path for Facebook pixel
284
  */
285
+ function woosea_get_term_parents( $id, $taxonomy, $project_taxonomy, $link = false, $nicename = false, $visited = array() ) {
286
  // Only add Home to the beginning of the chain when we start buildin the chain
287
  if(empty($visited)){
288
  $chain = 'Home';
305
 
306
  if ($parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited, TRUE )){
307
  $visited[] = $parent->parent;
308
+ $chain .= woosea_get_term_parents( $parent->parent, $taxonomy, $separator, $link = false, $nicename, $visited );
309
  }
310
 
311
  if ($link){
338
 
339
  $fb_prodid = get_the_id();
340
  $product_name = $product->get_name();
341
+ $product_name = str_replace("\"","",$product_name);
342
+ $product_name = str_replace("'","",$product_name);
343
+
344
  $cats = "";
345
  $all_cats = get_the_terms( $fb_prodid, 'product_cat' );
346
  if(!empty($all_cats)){
351
  // strip last comma
352
  $cats = rtrim($cats, ",");
353
  $cats = str_replace("&amp;","&", $cats);
354
+ $cats = str_replace("\"","",$cats);
355
+ $cats = str_replace("'","",$cats);
356
 
357
  if(!empty($fb_prodid)){
 
358
  if(!$product) {
359
  return -1;
360
  }
391
  $fb_price = $fb_lowprice;
392
  }
393
  }
394
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
395
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
396
  } else {
397
  // This is a parent variable product
423
  $fb_highprice = wc_format_localized_price( $highest );
424
  $fb_price = $fb_lowprice;
425
  }
426
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
427
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product_group\", content_ids:[$content], value:\"$fb_price\", currency:\"$currency\"});";
428
  }
429
  } else {
430
  // This is a simple product page
431
+ $fb_price = wc_format_localized_price( $product->get_price() );
432
+ $fb_price = floatval(str_replace(',', '.', str_replace(',', '.', $fb_price)));
433
  $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:\"$cats\", content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
434
  }
435
  }
443
  $order = wc_get_order( $order_id );
444
  $order_items = $order->get_items();
445
  $currency = get_woocommerce_currency();
 
446
  $contents = "";
447
+ $order_real = wc_format_localized_price($order->get_total());
448
 
449
  if ( !is_wp_error( $order_items )) {
450
  foreach( $order_items as $item_id => $order_item) {
453
  if($variation_id > 0){
454
  $prod_id = $variation_id;
455
  }
 
456
  $prod_quantity = $order_item->get_quantity();
 
 
 
 
 
457
  $contents .= "{'id': '$prod_id', 'quantity': $prod_quantity},";
458
  }
459
  }
460
  $contents = rtrim($contents, ",");
461
+ $order_real = floatval(str_replace(',', '.', str_replace(',', '.', $order_real)));
462
  $viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$order_real', content_type:'product', contents:[$contents]});";
463
  }
464
  } else {
468
  $cart_real = 0;
469
  $contents = "";
470
 
471
+ $cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
472
+ $cart_total_amount = floatval(str_replace(',', '.', str_replace(',', '.', $cart_total_amount)));
473
+
474
  $checkoutpage = wc_get_checkout_url();
475
  $current_url = get_permalink(get_the_ID());
476
 
485
  //$contents .= "$prod_id,";
486
 
487
  $cart_real = wc_format_localized_price( $cart_item['line_total'] );
 
 
 
 
 
488
  }
489
  $contents = rtrim($contents, ",");
490
 
491
  // User is on the billing pages
492
  if($checkoutpage == $current_url){
493
+ $viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
494
  } else {
495
  // User is on the basket page
496
+ $viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
497
  }
498
  }
499
  }
526
  }
527
  $fb_prodid = rtrim($fb_prodid, ",");
528
  $category_name = $term->name;
529
+ $category_path = woosea_get_term_parents( $term->term_id, 'product_cat', $project_taxonomy = false, $link = false, $nicename = false, $visited = array() );
530
+ $viewContent = "fbq(\"track\",\"ViewCategory\",{content_category:'$category_path', content_name:'$category_name', content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
531
  } elseif ($fb_pagetype == "searchresults"){
532
  $term = get_queried_object();
533
  $search_string = sanitize_text_field($_GET['s']);
556
  }
557
  }
558
  $fb_prodid = rtrim($fb_prodid, ",");
559
+ $viewContent = "fbq(\"trackCustom\",\"Search\",{search_string:\"$search_string\", content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
560
  } else {
561
  // This is another page than a product page
562
  $viewContent = "";
625
  // In that case we need to put in the AggregateOffer structured data
626
  $variation_id = woosea_find_matching_product_variation( $product, $_GET );
627
  $nr_get = count($_GET);
628
+
629
  if($nr_get > 0){
630
  $variable_product = wc_get_product($variation_id);
631
 
662
  $ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
663
  } else {
664
  $ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
665
+ $ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
666
+ $ecomm_price = $ecomm_lowprice;
667
+
668
  }
669
  }
670
  } else {
676
  var google_tag_params = {
677
  ecomm_prodid: <?php print "$ecomm_prodid";?>,
678
  ecomm_pagetype: '<?php print "$ecomm_pagetype";?>',
679
+ ecomm_totalvalue: <?php print "$ecomm_price";?>,
680
  };
681
  </script>
682
 
683
  <?php
684
  }
685
  } elseif ($ecomm_pagetype == "cart"){
686
+ // Get the first product from cart and use that product ID
687
+ foreach( WC()->cart->get_cart() as $cart_item ){
688
+ $ecomm_prodid = $cart_item['product_id'];
689
+ break;
690
+ }
691
  ?>
692
  <script type="text/javascript">
693
  var google_tag_params = {
813
  }
814
  add_action('admin_notices', 'woosea_request_review');
815
 
816
+
817
  /**
818
  * Create a seperate MySql table for saving conversion information
819
  */
2295
  }
2296
  add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
2297
 
2298
+ /**
2299
+ * This function enables the setting to remove
2300
+ * free shipping zones
2301
+ */
2302
+ function woosea_remove_free_shipping (){
2303
+ $status = sanitize_text_field($_POST['status']);
2304
+
2305
+ if ($status == "off"){
2306
+ update_option( 'remove_free_shipping', 'no', 'yes');
2307
+ } else {
2308
+ update_option( 'remove_free_shipping', 'yes', 'yes');
2309
+ }
2310
+ }
2311
+ add_action( 'wp_ajax_woosea_remove_free_shipping', 'woosea_remove_free_shipping' );
2312
+
2313
  /**
2314
  * This function enables the setting to use
2315
  * logging
2325
  }
2326
  add_action( 'wp_ajax_woosea_add_woosea_logging', 'woosea_add_woosea_logging' );
2327
 
2328
+ /**
2329
+ * This function enables the setting to add CDATA to title and descriptions
2330
+ */
2331
+ function woosea_add_woosea_cdata (){
2332
+ $status = sanitize_text_field($_POST['status']);
2333
+
2334
+ if ($status == "off"){
2335
+ update_option( 'add_woosea_cdata', 'no', 'yes');
2336
+ } else {
2337
+ update_option( 'add_woosea_cdata', 'yes', 'yes');
2338
+ }
2339
+ }
2340
+ add_action( 'wp_ajax_woosea_add_woosea_cdata', 'woosea_add_woosea_cdata' );
2341
+
2342
  /**
2343
  * This function enables the setting to add
2344
  * the Faceook pixel
4657
 
4658
  add_meta_box('woosea_rss_dashboard_widget', __('Latest Product Feed Pro Tutorials', 'rc_mdm'), 'woosea_my_rss_box','dashboard','side','high');
4659
  }
4660
+ //add_action('wp_dashboard_setup', 'woosea_blog_widgets');
4661
 
4662
  /**
4663
  * Creates the RSS metabox
4664
  */
4665
+ function woosea_feed_interval( $seconds ) {
4666
+ return 172800; // Cache the feed for 2 days
4667
+ }
4668
+
4669
  function woosea_my_rss_box() {
 
4670
  // Get RSS Feed(s)
4671
  include_once(ABSPATH . WPINC . '/feed.php');
4672
  $domain = $_SERVER['HTTP_HOST'];
4675
  $my_feeds = array(
4676
  'https://www.adtribes.io/feed/'
4677
  );
4678
+
4679
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'woosea_feed_interval' );
4680
 
4681
  // Loop through Feeds
4682
  foreach ( $my_feeds as $feed) :