Product Feed PRO for WooCommerce - Version 9.7.2

Version Description

Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.

Download this release

Release Info

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

Code changes from version 9.3.7 to 9.7.2

TODO.txt CHANGED
@@ -5,18 +5,18 @@ Tutorial / Blog posts:
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
 
7
  Priority issues:
 
8
  - License key input field needs to be a password field (asterixes)
 
9
  - Add a preview option so only 5-10 products are being generated
10
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
11
  - Google local product feed inventory in XML format (not just TXT like it is now)
12
  - Add support for Multisites
13
  - Add a filter on review score (and amount of reviews)
14
  - Make extra woosea fields available for front-end usage
15
- - Only update feed when changes to products have been made
16
  - Add header to extra fields on product edit pages
17
  - Add possibility to create OR rules
18
  - Add support for Google My Business product feeds
19
- - Build a better WP Cron check, current one is not good enough
20
  - AMAZON integration:
21
  - requires a professional seller account, 39 dollar a month, before being able to create a developer account
22
  - only than we can use their MWS service needed to connect our plugin
5
  - Explain all the different fields/attributes that can be selected from the drop-downs
6
 
7
  Priority issues:
8
+ - Add Pinterest Tag; https://help.pinterest.com/nl/business/article/install-the-pinterest-tag
9
  - License key input field needs to be a password field (asterixes)
10
+ - A seperate FB pixel per WPML website / language
11
  - Add a preview option so only 5-10 products are being generated
12
  - Own hosted plugin updating: https://rudrastyh.com/wordpress/self-hosted-plugin-update.html
13
  - Google local product feed inventory in XML format (not just TXT like it is now)
14
  - Add support for Multisites
15
  - Add a filter on review score (and amount of reviews)
16
  - Make extra woosea fields available for front-end usage
 
17
  - Add header to extra fields on product edit pages
18
  - Add possibility to create OR rules
19
  - Add support for Google My Business product feeds
 
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
classes/channels/class-google_local_products.php CHANGED
@@ -12,8 +12,8 @@ class WooSEA_google_local_products {
12
  $google_local_products = array(
13
  "Local products fields" => array(
14
  "Itemid" => array(
15
- "name" => "Itemid",
16
- "feed_name" => "g:itemid",
17
  "format" => "required",
18
  "woo_suggest" => "id",
19
  ),
12
  $google_local_products = array(
13
  "Local products fields" => array(
14
  "Itemid" => array(
15
+ "name" => "Id",
16
+ "feed_name" => "g:id",
17
  "format" => "required",
18
  "woo_suggest" => "id",
19
  ),
classes/channels/class-google_shopping.php CHANGED
@@ -356,6 +356,11 @@ class WooSEA_google_shopping {
356
  "feed_name" => "g:max_handling_time",
357
  "format" => "optional",
358
  ),
 
 
 
 
 
359
  ),
360
  "Tax" => array(
361
  "Tax" => array(
356
  "feed_name" => "g:max_handling_time",
357
  "format" => "optional",
358
  ),
359
+ "Ships from country" => array(
360
+ "name" => "ships_from_country",
361
+ "feed_name" => "g:ships_from_country",
362
+ "format" => "optional",
363
+ ),
364
  ),
365
  "Tax" => array(
366
  "Tax" => array(
classes/class-activate.php CHANGED
@@ -90,7 +90,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
  ),
@@ -1112,6 +1112,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",
90
  "channel_hash" => md5("Snapchat Product Catalog"),
91
  "name" => "Snapchat Product Catalog",
92
  "fields" => "snapchat",
93
+ "taxonomy" => "google_shopping",
94
  "utm_source" => "snapchat",
95
  "type" => "Advertising" ),
96
  ),
1112
  "taxonomy" => "none",
1113
  "utm_source" => "Tweakers.nl",
1114
  "type" => "Comparison shopping engine" ),
1115
+ "Boetiek.nl" => array (
1116
+ "channel_hash" => md5("Boetiek.nl"),
1117
+ "name" => "Boetiek.nl",
1118
+ "fields" => "boetiek",
1119
+ "taxonomy" => "none",
1120
+ "utm_source" => "Boetiek.nl",
1121
+ "type" => "Comparison shopping engine" ),
1122
  "Fashionchick.nl" => array (
1123
  "channel_hash" => md5("Fashionchick.nl"),
1124
  "name" => "Fashionchick.nl",
classes/class-attributes.php CHANGED
@@ -48,7 +48,7 @@ private function get_dynamic_attributes(){
48
  global $wpdb;
49
  $list = array();
50
 
51
- $no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","yst_prominent_words","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
52
  $taxonomies = get_taxonomies();
53
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
54
 
@@ -205,13 +205,17 @@ public function get_mapping_attributes_dropdown() {
205
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
206
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
207
  "title" => "Product name",
208
- "mother_title" => "Product name parent product",
209
  "title_hyphen" => "Product name hyphen",
 
 
210
  "title_lc" => "Product name lowercase",
 
211
  "description" => "Product description",
212
  "short_description" => "Product short description",
213
  "raw_description" => "Unfiltered product description",
214
  "raw_short_description" => "Unfiltered product short description",
 
 
215
  "price" => "Price",
216
  "regular_price" => "Regular price",
217
  "sale_price" => "Sale price",
@@ -247,7 +251,7 @@ 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]",
@@ -267,7 +271,8 @@ public function get_mapping_attributes_dropdown() {
267
  "length" => "Length",
268
  "shipping" => "Shipping",
269
  "shipping_price" => "Shipping cost",
270
- "shipping_label" => "Shipping label",
 
271
  "visibility" => "Visibility",
272
  "rating_total" => "Total rating",
273
  "rating_average" => "Average rating",
@@ -350,9 +355,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 +404,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,7 +439,7 @@ 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]",
@@ -464,7 +474,8 @@ public function get_mapping_attributes_dropdown() {
464
  "length" => "Length",
465
  "shipping" => "Shipping",
466
  "shipping_price" => "Shipping cost",
467
- "shipping_label" => "Shipping label",
 
468
  "visibility" => "Visibility",
469
  "rating_total" => "Total rating",
470
  "rating_average" => "Average rating",
48
  global $wpdb;
49
  $list = array();
50
 
51
+ $no_taxonomies = array("portfolio_category","portfolio_skills","portfolio_tags","nav_menu","post_format","slide-page","element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
52
  $taxonomies = get_taxonomies();
53
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
54
 
205
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
206
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
207
  "title" => "Product name",
 
208
  "title_hyphen" => "Product name hyphen",
209
+ "mother_title" => "Product name parent product",
210
+ "mother_title_hyphen" => "Product name parent product hyphen",
211
  "title_lc" => "Product name lowercase",
212
+ "title_lcw" => "Product name uppercase first characters",
213
  "description" => "Product description",
214
  "short_description" => "Product short description",
215
  "raw_description" => "Unfiltered product description",
216
  "raw_short_description" => "Unfiltered product short description",
217
+ "mother_description" => "Product description parent product",
218
+ "mother_short_description" => "Product short description parent product",
219
  "price" => "Price",
220
  "regular_price" => "Regular price",
221
  "sale_price" => "Sale price",
251
  "category_path" => "Category path",
252
  "category_path_short" => "Category path short",
253
  "category_path_skroutz" => "Category path Skroutz",
254
+ "one_category" => "Yoast primary category",
255
  "condition" => "Condition",
256
  "availability" => "Availability",
257
  "quantity" => "Quantity [Stock]",
271
  "length" => "Length",
272
  "shipping" => "Shipping",
273
  "shipping_price" => "Shipping cost",
274
+ "shipping_label" => "Shipping class slug",
275
+ "shipping_label_name" => "Shipping class name",
276
  "visibility" => "Visibility",
277
  "rating_total" => "Total rating",
278
  "rating_average" => "Average rating",
355
 
356
  foreach ($custom_attributes as $key => $value) {
357
  if (!preg_match("/pyre|sbg|fusion/i",$value)){
358
+ $value = ltrim($value);
359
+ if (!empty($value)){
360
  $dropdown .= "<option value='$key'>" . ucfirst($value) . "</option>";
361
+ }
362
  }
363
  }
364
 
404
  "parent_sku" => "SKU parent variable product",
405
  "sku_item_group_id" => "SKU_ITEM_GROUP_ID (Facebook)",
406
  "wc_post_id_product_id" => "Wc_post_id_product_id (Facebook)",
407
+ "title" => "Product name",
408
+ "title_hyphen" => "Product name hyphen",
409
+ "mother_title" => "Product name parent product",
410
+ "mother_title_hyphen" => "Product name parent product hyphen",
411
  "title_lc" => "Product name lowercase",
412
+ "title_lcw" => "Product name uppercase first characters",
413
  "description" => "Product description",
414
  "short_description" => "Product short description",
415
  "raw_description" => "Unfiltered product description",
416
  "raw_short_description" => "Unfiltered product short description",
417
+ "mother_description" => "Product description parent product",
418
+ "mother_short_description" => "Product short description parent product",
419
+ "link" => "Link",
420
  "variable_link" => "Product variable link",
421
  "add_to_cart_link" => "Add to cart link",
422
  "image" => "Main image",
439
  "category_path" => "Category path",
440
  "category_path_short" => "Category path short",
441
  "category_path_skroutz" => "Category path Skroutz",
442
+ "one_category" => "Yoast primary category",
443
  "condition" => "Condition",
444
  "availability" => "Availability",
445
  "quantity" => "Quantity [Stock]",
474
  "length" => "Length",
475
  "shipping" => "Shipping",
476
  "shipping_price" => "Shipping cost",
477
+ "shipping_label" => "Shipping class slug",
478
+ "shipping_label_name" => "Shipping class name",
479
  "visibility" => "Visibility",
480
  "rating_total" => "Total rating",
481
  "rating_average" => "Average rating",
classes/class-get-products.php CHANGED
@@ -26,7 +26,6 @@ class WooSEA_Get_Products {
26
  return "<![CDATA[ $string ]]>";
27
  }
28
 
29
-
30
  /**
31
  * Check if a plugin is active
32
  */
@@ -57,6 +56,11 @@ class WooSEA_Get_Products {
57
  * Get all approved product review comments for Google's Product Review Feeds
58
  */
59
  public function woosea_get_reviews ( $product_data, $product ) {
 
 
 
 
 
60
  $approved_reviews = array();
61
  $prod_id = $product_data['id'];
62
 
@@ -84,8 +88,10 @@ class WooSEA_Get_Products {
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++;
@@ -96,7 +102,7 @@ class WooSEA_Get_Products {
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;
@@ -324,7 +330,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';
@@ -931,6 +937,16 @@ class WooSEA_Get_Products {
931
  unset($shipping_cost);
932
  }
933
  }
 
 
 
 
 
 
 
 
 
 
934
  }
935
 
936
  if(isset($zone_details)){
@@ -957,12 +973,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 +1005,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 +1025,6 @@ class WooSEA_Get_Products {
1005
  // Fix empty services
1006
  foreach($shipping_arr as $k => $v){
1007
  if(empty($v['service'])){
1008
- // $lalala = get_option( 'woocommerce_default_country' );
1009
- // $shipping_arr[$k]['country'] = get_option( 'woocommerce_default_country' );
1010
  unset($shipping_arr[$k]);
1011
  }
1012
  }
@@ -1145,16 +1163,19 @@ class WooSEA_Get_Products {
1145
  } elseif (preg_match("/g:product_detail/i",$k)){
1146
  if(!empty($v)){
1147
  $product_detail_split = explode("#", $v);
1148
- $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1149
- $name = str_replace("_", " ", $product_detail_split[0]);
1150
-
1151
- $section_name = explode(":", $name);
1152
- $section_name_start = ucfirst($section_name[0]);
1153
- $name = ucfirst(trim($section_name[1]));
1154
-
1155
- $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1156
- $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1157
- $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
 
 
 
1158
  }
1159
  } elseif ($k == "g:installment"){
1160
  if(!empty($v)){
@@ -1993,7 +2014,7 @@ class WooSEA_Get_Products {
1993
  $xml_piece = "";
1994
 
1995
  // Get taxonomies
1996
- $no_taxonomies = array("element_category","template_category","portfolio_category","portfolio_skills","portfolio_tags","faq_category","slide-page","yst_prominent_words","category","post_tag","nav_menu","link_category","post_format","product_type","product_visibility","product_cat","product_shipping_class","product_tag");
1997
  $taxonomies = get_taxonomies();
1998
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
1999
 
@@ -2325,6 +2346,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
  */
@@ -2439,6 +2464,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()));
@@ -2451,7 +2480,8 @@ class WooSEA_Get_Products {
2451
  // Untouched raw system pricing - DO NOT CHANGE THESE
2452
  $product_data['system_net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
2453
  $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2454
- $product_data['system_regular_price'] = round($product->get_regular_price(),2);
 
2455
  $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2456
 
2457
  $product_data['system_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
@@ -2485,6 +2515,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);
@@ -2582,6 +2613,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);
@@ -2722,9 +2754,12 @@ class WooSEA_Get_Products {
2722
  $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
2723
 
2724
  // Add rounded price options
2725
- $product_data['rounded_price'] = round($product_data['price']);
2726
- $product_data['rounded_regular_price'] = round($product_data['regular_price']);
2727
- $product_data['rounded_sale_price'] = round($product_data['sale_price']);
 
 
 
2728
 
2729
  // Calculate discount percentage
2730
  if($product_data['sale_price'] > 0){
@@ -2742,7 +2777,7 @@ class WooSEA_Get_Products {
2742
  }
2743
  }
2744
 
2745
- if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi")){
2746
  $product_data['shipping'] = $this->woosea_get_shipping_cost($class_cost_id, $project_config, $product_data['price'], $tax_rates, $shipping_zones, $product_data['id'], $product_data['item_group_id']);
2747
  $shipping_str = $product_data['shipping'];
2748
  }
@@ -2838,7 +2873,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 +2883,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 +2897,6 @@ class WooSEA_Get_Products {
2862
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
2863
  }
2864
  }
2865
-
2866
  foreach($skroutz_att_array as $skrtz_value){
2867
  $product_data[$taxo] .= ",". $skrtz_value;
2868
  }
@@ -2977,7 +3011,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 +3029,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 +3062,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 +3140,23 @@ 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 +3294,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 +3328,7 @@ class WooSEA_Get_Products {
3292
 
3293
  // Add attribute values to the variation product names to make them unique
3294
  $product_data['title_hyphen'] = $product_data['title']." - ";
 
3295
 
3296
  foreach($variations as $kk => $vv){
3297
  $custom_key = $kk;
@@ -3440,6 +3477,8 @@ class WooSEA_Get_Products {
3440
  * we will add CDATA brackets to the title and description attributes
3441
  */
3442
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
 
 
3443
  //$product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3444
  //$product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
3445
 
@@ -3448,6 +3487,17 @@ class WooSEA_Get_Products {
3448
  */
3449
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3450
 
 
 
 
 
 
 
 
 
 
 
 
3451
  /**
3452
  * Check if individual products need to be excluded
3453
  */
@@ -3513,16 +3563,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
@@ -3549,6 +3602,49 @@ 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 +3678,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 +3750,7 @@ class WooSEA_Get_Products {
3654
  }
3655
  } else {
3656
  if(strlen($product_data[$attr_value['mapfrom']])){
3657
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "g:link_template") OR ($attr_value['attribute'] == "g:image_link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "Final URL") OR ($attr_value['attribute'] == "SKU")){
3658
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3659
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3660
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
@@ -3874,7 +3970,7 @@ class WooSEA_Get_Products {
3874
  }
3875
  } else {
3876
  if(strlen($product_data[$attr_value['mapfrom']])){
3877
- if(($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
3878
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3879
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3880
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
@@ -4404,479 +4500,482 @@ class WooSEA_Get_Products {
4404
  return $product_data;
4405
  }
4406
 
4407
- /**
4408
- * Execute project rules
4409
- */
4410
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
4411
- $aantal_prods = count($product_data);
4412
- if($aantal_prods > 0){
4413
 
4414
- foreach ($project_rules2 as $pr_key => $pr_array){
4415
 
4416
- foreach ($product_data as $pd_key => $pd_value){
4417
 
4418
- // Check is there is a rule on specific attributes
4419
- if($pd_key == $pr_array['attribute']){
4420
 
4421
- // This is because for data manipulation the than attribute is empty
4422
- if(!array_key_exists('than_attribute', $pr_array)){
4423
- $pr_array['than_attribute'] = $pd_key;
4424
- }
4425
 
4426
  // Check if a rule has been set for Google categories
4427
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
4428
-
4429
- $pr_array['than_attribute'] = "categories";
4430
  $category_id = explode("-", $pr_array['newvalue']);
4431
  $pr_array['newvalue'] = $category_id[0];
4432
- $product_data['categories'] = $pr_array['newvalue'];
4433
- }
4434
 
4435
- // Make sure that rules on numerics are on true numerics
4436
- if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
4437
- $pd_value = strtr($pd_value, ',', '.');
4438
- }
4439
 
4440
 
4441
- // Make sure the price or sale price is numeric
4442
- if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
4443
- settype($pd_value, "double");
4444
- }
4445
 
4446
- if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
4447
 
4448
- // Rules for numeric values
4449
- switch ($pr_array['condition']) {
4450
- case($pr_array['condition'] = "contains"):
4451
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4452
- $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
4453
- }
4454
- break;
4455
- case($pr_array['condition'] = "containsnot"):
4456
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4457
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4458
- }
4459
- break;
4460
- case($pr_array['condition'] = "="):
4461
- if (($pd_value == $pr_array['criteria'])){
4462
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4463
- }
4464
- break;
4465
- case($pr_array['condition'] = "!="):
4466
- if (($pd_value != $pr_array['criteria'])){
4467
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4468
- }
4469
- break;
4470
- case($pr_array['condition'] = ">"):
4471
- if (($pd_value > $pr_array['criteria'])){
4472
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4473
- }
4474
- break;
4475
- case($pr_array['condition'] = ">="):
4476
- if (($pd_value >= $pr_array['criteria'])){
4477
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4478
- }
4479
- break;
4480
- case($pr_array['condition'] = "<"):
4481
- if (($pd_value < $pr_array['criteria'])){
4482
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4483
- }
4484
- break;
4485
- case($pr_array['condition'] = "=<"):
4486
- if (($pd_value <= $pr_array['criteria'])){
4487
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4488
- }
4489
- break;
4490
- case($pr_array['condition'] = "empty"):
4491
- if(empty($product_data[$pr_array['attribute']])){
4492
- if ((strlen($pd_value) < 1)){
4493
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4494
- } else {
4495
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4496
- }
4497
- }
4498
- break;
4499
- case($pr_array['condition'] = "multiply"):
4500
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4501
- $convert_back = "false";
4502
- $pos = strpos($pd_value, ',');
4503
- if($pos !== false){
4504
- $convert_back = "true";
4505
- }
4506
- $pd_value = strtr($pd_value, ',', '.');
4507
- $newvalue = $pd_value*$pr_array['criteria'];
4508
- $newvalue = round($newvalue, 2);
4509
- if($convert_back == "true"){
4510
- $newvalue = strtr($newvalue, '.',',');
4511
- }
4512
- $product_data[$pr_array['attribute']] = $newvalue;
4513
- break;
4514
- case($pr_array['condition'] = "divide"):
4515
- $newvalue = ($pd_value / $pr_array['criteria']);
4516
- $newvalue = round($newvalue, 2);
4517
- $newvalue = strtr($newvalue, '.',',');
4518
- $product_data[$pr_array['attribute']] = $newvalue;
4519
- break;
4520
- case($pr_array['condition'] = "plus"):
4521
- $newvalue = ($pd_value + $pr_array['criteria']);
4522
- $product_data[$pr_array['attribute']] = $newvalue;
4523
- break;
4524
- case($pr_array['condition'] = "minus"):
4525
- $newvalue = ($pd_value - $pr_array['criteria']);
4526
- $product_data[$pr_array['attribute']] = $newvalue;
4527
- break;
4528
- case($pr_array['condition'] = "findreplace"):
4529
- if (strpos($pd_value, $pr_array['criteria']) !== false){
4530
  // Make sure that a new value has been set
4531
- if(!empty($pr_array['newvalue'])){
4532
- // Find and replace only work on same attribute field, otherwise create a contains rule
4533
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4534
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4535
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4536
  }
4537
- }
4538
- }
4539
- break;
4540
- default:
4541
- break;
4542
- }
4543
- } elseif (is_array($pd_value)) {
4544
-
4545
- // For now only shipping details are in an array
4546
- foreach ($pd_value as $k => $v){
4547
- if(is_array($v)){
4548
- foreach ($v as $kk => $vv){
4549
- // Only shipping detail rule can be on price for now
4550
- if($kk == "price"){
4551
- switch ($pr_array['condition']) {
4552
- case($pr_array['condition'] = "contains"):
4553
- if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
4554
- $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
4555
- $product_data[$pr_array['than_attribute']] = $pd_value;
4556
- }
4557
- break;
4558
- case($pr_array['condition'] = "containsnot"):
4559
- if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
4560
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4561
- $product_data[$pr_array['than_attribute']] = $pd_value;
4562
- }
4563
- break;
4564
- case($pr_array['condition'] = "="):
4565
- if (($vv == $pr_array['criteria'])){
4566
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4567
- $product_data[$pr_array['than_attribute']] = $pd_value;
4568
- }
4569
- break;
4570
- case($pr_array['condition'] = "!="):
4571
- if (($vv != $pr_array['criteria'])){
4572
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4573
- $product_data[$pr_array['than_attribute']] = $pd_value;
4574
- }
4575
- break;
4576
- case($pr_array['condition'] = ">"):
4577
- if (($vv > $pr_array['criteria'])){
4578
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4579
- $product_data[$pr_array['than_attribute']] = $pd_value;
4580
- }
4581
- break;
4582
- case($pr_array['condition'] = ">="):
4583
- if (($vv >= $pr_array['criteria'])){
4584
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4585
- $product_data[$pr_array['than_attribute']] = $pd_value;
4586
- }
4587
- break;
4588
- case($pr_array['condition'] = "<"):
4589
- if (($vv < $pr_array['criteria'])){
4590
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4591
- $product_data[$pr_array['than_attribute']] = $pd_value;
4592
- }
4593
- break;
4594
- case($pr_array['condition'] = "=<"):
4595
- if (($vv <= $pr_array['criteria'])){
4596
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4597
- $product_data[$pr_array['than_attribute']] = $pd_value;
4598
- }
4599
- break;
4600
- case($pr_array['condition'] = "empty"):
4601
- if ((strlen($vv) < 1)){
4602
- $pd_value[$k]['price'] = $pr_array['newvalue'];
4603
- $product_data[$pr_array['than_attribute']] = $pd_value;
4604
- }
4605
- break;
4606
- case($pr_array['condition'] = "multiply"):
4607
- // Only shipping array
4608
- if(is_array($pd_value)){
4609
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4610
- foreach ($pd_value as $ship_a_key => $shipping_arr){
4611
- foreach($shipping_arr as $ship_key => $ship_value){
4612
- if($ship_key == "price"){
4613
- $ship_pieces = explode(" ", $ship_value);
4614
- $pd_value = strtr($ship_pieces[1], ',', '.');
4615
- $newvalue = $pd_value*$pr_array['criteria'];
4616
- $newvalue = round($newvalue, 2);
4617
- $newvalue = strtr($newvalue, '.',',');
4618
- $newvalue = $ship_pieces[0]." ".$newvalue;
4619
- $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4620
- }
4621
- }
4622
- }
4623
- }
4624
- break;
4625
- default:
4626
- break;
4627
- }
4628
- }
4629
- }
4630
- } else {
4631
- // Rules on product tags
4632
- foreach ($pd_value as $k => $v){
4633
-
4634
- // Rules for string values
4635
- if (!array_key_exists('cs', $pr_array)){
4636
- $v = strtolower($v);
4637
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
4638
- }
4639
-
4640
- switch ($pr_array['condition']) {
4641
- case($pr_array['condition'] = "contains"):
4642
- if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
4643
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4644
- }
4645
- break;
4646
- case($pr_array['condition'] = "containsnot"):
4647
- if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
4648
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4649
- }
4650
- break;
4651
- case($pr_array['condition'] = "="):
4652
- if (($v == $pr_array['criteria'])){
4653
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4654
- }
4655
- break;
4656
- case($pr_array['condition'] = "!="):
4657
- if (($v != $pr_array['criteria'])){
4658
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4659
- }
4660
- break;
4661
- case($pr_array['condition'] = ">"):
4662
- if (($v > $pr_array['criteria'])){
4663
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4664
- }
4665
- break;
4666
- case($pr_array['condition'] = ">="):
4667
- if (($v >= $pr_array['criteria'])){
4668
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4669
- }
4670
- break;
4671
- case($pr_array['condition'] = "<"):
4672
- if (($v < $pr_array['criteria'])){
4673
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4674
- }
4675
- break;
4676
- case($pr_array['condition'] = "=<"):
4677
- if (($v <= $pr_array['criteria'])){
4678
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4679
- }
4680
- break;
4681
- case($pr_array['condition'] = "empty"):
4682
- if ((strlen($v) < 1)){
4683
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4684
- }
4685
- break;
4686
- case($pr_array['condition'] = "multiply"):
4687
- // Only shipping array
4688
- if(is_array($v)){
4689
- $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4690
- foreach ($v as $ship_a_key => $shipping_arr){
4691
- foreach($shipping_arr as $ship_key => $ship_value){
4692
- if($ship_key == "price"){
4693
- $ship_pieces = explode(" ", $ship_value);
4694
- $pd_value = strtr($ship_pieces[1], ',', '.');
4695
- $newvalue = $pd_value*$pr_array['criteria'];
4696
- $newvalue = round($newvalue, 2);
4697
- $newvalue = strtr($newvalue, '.',',');
4698
- $newvalue = $ship_pieces[0]." ".$newvalue;
4699
- $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4700
- }
4701
- }
4702
- }
4703
- }
4704
- break;
4705
- default:
4706
- break;
4707
- }
4708
- }
4709
- }
4710
- }
4711
- } else {
4712
- // Rules for string values
4713
  if (!array_key_exists('cs', $pr_array)){
4714
- $pd_value = strtolower($pd_value);
4715
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
4716
- }
4717
-
4718
- switch ($pr_array['condition']) {
4719
- case($pr_array['condition'] = "contains"):
4720
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4721
- // Specifically for shipping price rules
4722
- if(!empty($product_data[$pr_array['than_attribute']])){
4723
- if(is_array($product_data[$pr_array['than_attribute']])){
4724
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4725
- for ($x = 0; $x <= $arr_size; $x++) {
4726
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4727
- }
4728
- } else {
4729
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4730
- }
4731
- } else {
4732
- // This attribute value is empty for this product
4733
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4734
- }
4735
- }
4736
- break;
4737
- case($pr_array['condition'] = "containsnot"):
4738
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4739
- // Specifically for shipping price rules
4740
- if(is_array($product_data[$pr_array['than_attribute']])){
4741
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4742
- for ($x = 0; $x <= $arr_size; $x++) {
4743
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4744
- }
4745
- } else {
4746
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4747
- }
4748
- }
4749
- break;
4750
- case($pr_array['condition'] = "="):
4751
- if (($pr_array['criteria'] == "$pd_value")){
4752
- // Specifically for shipping price rules
4753
- if(is_array($product_data[$pr_array['than_attribute']])){
4754
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4755
- for ($x = 0; $x <= $arr_size; $x++) {
4756
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4757
- }
4758
- } else {
4759
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4760
- }
4761
- }
4762
- $ship = $product_data['shipping'];
4763
- break;
4764
- case($pr_array['condition'] = "!="):
4765
- if (($pr_array['criteria'] != "$pd_value")){
4766
- // Specifically for shipping price rules
4767
- if(is_array($product_data[$pr_array['than_attribute']])){
4768
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4769
- for ($x = 0; $x <= $arr_size; $x++) {
4770
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4771
- }
4772
- } else {
4773
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4774
- }
4775
- }
4776
- break;
4777
- case($pr_array['condition'] = ">"):
4778
- // Use a lexical order on relational string operators
4779
- if (($pd_value > $pr_array['criteria'])){
4780
- // Specifically for shipping price rules
4781
- if(is_array($product_data[$pr_array['than_attribute']])){
4782
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4783
- for ($x = 0; $x <= $arr_size; $x++) {
4784
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4785
- }
4786
- } else {
4787
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4788
- }
4789
- }
4790
- break;
4791
- case($pr_array['condition'] = ">="):
4792
- // Use a lexical order on relational string operators
4793
- if (($pd_value >= $pr_array['criteria'])){
4794
- // Specifically for shipping price rules
4795
- if(is_array($product_data[$pr_array['than_attribute']])){
4796
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4797
- for ($x = 0; $x <= $arr_size; $x++) {
4798
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4799
- }
4800
- } else {
4801
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4802
- }
4803
- }
4804
- break;
4805
- case($pr_array['condition'] = "<"):
4806
- // Use a lexical order on relational string operators
4807
- if (($pd_value < $pr_array['criteria'])){
4808
- // Specifically for shipping price rules
4809
- if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
4810
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4811
- for ($x = 0; $x <= $arr_size; $x++) {
4812
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4813
- }
4814
- } else {
4815
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4816
- }
4817
- }
4818
- break;
4819
- case($pr_array['condition'] = "=<"):
4820
- // Use a lexical order on relational string operators
4821
- if (($pd_value <= $pr_array['criteria'])){
4822
- // Specifically for shipping price rules
4823
- if(is_array($product_data[$pr_array['than_attribute']])){
4824
- $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4825
- for ($x = 0; $x <= $arr_size; $x++) {
4826
- $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4827
- }
4828
- } else {
4829
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4830
- }
4831
- }
4832
- break;
4833
 
4834
- case($pr_array['condition'] = "empty"):
4835
- if(empty($product_data[$pr_array['attribute']])){
4836
- if(empty($product_data[$pr_array['than_attribute']])){
4837
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4838
- } else {
4839
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4840
- }
4841
- }
4842
- break;
4843
- case($pr_array['condition'] = "replace"):
4844
- $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
4845
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4846
  case($pr_array['condition'] = "findreplace"):
4847
  if (strpos($pd_value, $pr_array['criteria']) !== false){
4848
- // Make sure that a new value has been set
4849
- if(!empty($pr_array['newvalue'])){
4850
- // Find and replace only work on same attribute field, otherwise create a contains rule
4851
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4852
- $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4853
- $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4854
- }
4855
- }
4856
- }
 
4857
  break;
4858
- default:
4859
- break;
4860
- }
4861
- }
4862
- } else {
4863
- // When a rule has been set on an attribute that is not in product_data
4864
- // Add the newvalue to product_data
4865
- if (!array_key_exists($pr_array['attribute'], $product_data)){
4866
- if(!empty($pr_array['newvalue'])){
4867
- $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4868
- } else {
4869
- if(array_key_exists($pr_array['than_attribute'], $product_data)){
4870
- $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4871
- }
4872
- }
4873
- }
4874
- }
4875
- }
4876
- }
4877
- }
4878
- return $product_data;
4879
- }
4880
 
4881
  /**
4882
  * Function to exclude products based on individual product exclusions
@@ -4899,525 +4998,530 @@ class WooSEA_Get_Products {
4899
  }
4900
  }
4901
 
4902
- /**
4903
- * Execute project filters (include / exclude)
4904
- */
 
4905
  private function woocommerce_sea_filters( $project_rules, $product_data ){
4906
- $allowed = 1;
4907
 
4908
- // Check if product was already excluded from the feed
4909
- $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
4910
 
4911
- if( $product_excluded == "Yes"){
4912
- $allowed = 0;
4913
- }
4914
 
4915
- foreach ($project_rules as $pr_key => $pr_array){
4916
 
4917
- if($pr_array['attribute'] == "categories"){
4918
- $pr_array['attribute'] = "raw_categories";
4919
- }
4920
 
4921
- //if(array_key_exists($pr_array['attribute'], $product_data)){
4922
 
4923
- if(!array_key_exists($pr_array['attribute'], $product_data)) {
4924
- $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
4925
- }
4926
 
4927
- foreach ($product_data as $pd_key => $pd_value){
4928
- // Check is there is a rule on specific attributes
 
4929
 
4930
- if(in_array($pd_key, $pr_array, TRUE)){
 
 
 
4931
 
4932
- if($pd_key == "price"){
4933
- //$pd_value = @number_format($pd_value,2);
4934
- $pd_value = wc_format_decimal($pd_value);
4935
- }
4936
-
4937
- if (is_numeric($pd_value)){
4938
- $old_value = $pd_value;
4939
- if($pd_key == "price"){
4940
- $pd_value = @number_format($pd_value,2);
4941
- }
4942
-
4943
- // Rules for numeric values
4944
- switch ($pr_array['condition']) {
4945
- case($pr_array['condition'] = "contains"):
4946
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
4947
- $allowed = 0;
4948
- } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
4949
- $allowed = 0;
4950
- }
4951
- break;
4952
- case($pr_array['condition'] = "containsnot"):
4953
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
4954
- $allowed = 0;
4955
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
4956
- $allowed = 0;
4957
- }
4958
- break;
4959
  case($pr_array['condition'] = "="):
4960
- if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4961
- $allowed = 0;
4962
- } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4963
- $allowed = 0;
4964
- }
4965
- break;
4966
- case($pr_array['condition'] = "!="):
4967
- if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4968
- if($allowed <> 0){
4969
- $allowed = 1;
4970
- }
4971
- } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4972
- $allowed = 0;
4973
- }
4974
- break;
4975
- case($pr_array['condition'] = ">"):
4976
- if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4977
- $allowed = 0;
4978
- } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4979
- $allowed = 0;
4980
- }
4981
- break;
4982
- case($pr_array['condition'] = ">="):
4983
- if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4984
- $allowed = 0;
4985
- } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4986
- $allowed = 0;
4987
- }
4988
- break;
4989
- case($pr_array['condition'] = "<"):
4990
- if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4991
- $allowed = 0;
4992
- } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
4993
- $allowed = 0;
4994
- }
4995
- break;
4996
- case($pr_array['condition'] = "=<"):
4997
- if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
4998
- $allowed = 0;
4999
- } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5000
- $allowed = 0;
5001
- }
5002
- break;
5003
- case($pr_array['condition'] = "empty"):
5004
- if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5005
- $allowed = 0;
5006
- } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5007
- $allowed = 0;
5008
- }
5009
- break;
5010
- default:
5011
- break;
5012
- }
5013
- } elseif (is_array($pd_value)){
5014
- // Tis can either be a shipping or product_tag array
5015
- if($pr_array['attribute'] == "product_tag"){
5016
- $in_tag_array = "not";
5017
-
5018
- foreach($pd_value as $pt_key => $pt_value){
5019
- // Rules for string values
5020
- if (!array_key_exists('cs', $pr_array)){
5021
- $pt_value = strtolower($pt_value);
5022
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
5023
- }
5024
-
5025
- if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5026
- $in_tag_array = "yes";
5027
- }
5028
- }
5029
-
5030
- if($in_tag_array == "yes"){
5031
- //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5032
- $v = $pr_array['criteria'];
5033
-
5034
- switch ($pr_array['condition']) {
5035
- case($pr_array['condition'] = "contains"):
5036
- if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5037
- if($pr_array['than'] == "include_only"){
5038
- if($allowed <> 0){
5039
- $allowed = 1;
5040
- }
5041
- } else {
5042
- $allowed = 0;
5043
- }
5044
- } else {
5045
- $allowed = 0;
5046
- }
5047
- break;
5048
- case($pr_array['condition'] = "containsnot"):
5049
- if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5050
- if($pr_array['than'] == "include_only"){
5051
- if($allowed <> 0){
5052
- $allowed = 1;
5053
- }
5054
- } else {
5055
- $allowed = 0;
5056
- }
5057
- } else {
5058
- $allowed = 0;
5059
- }
5060
- break;
5061
- case($pr_array['condition'] = "="):
5062
- if (($v == $pr_array['criteria'])){
5063
- if($pr_array['than'] == "include_only"){
5064
- if($allowed <> 0){
5065
- $allowed = 1;
5066
- }
5067
- } else {
5068
- $allowed = 0;
5069
- }
5070
- } else {
5071
- $allowed = 0;
5072
- }
5073
- break;
5074
- case($pr_array['condition'] = "!="):
5075
- if (($v != $pr_array['criteria'])){
5076
- if($pr_array['than'] == "include_only"){
5077
- if($allowed <> 0){
5078
- $allowed = 1;
5079
- }
5080
- } else {
5081
- $allowed = 0;
5082
- }
5083
- }
5084
- break;
5085
- case($pr_array['condition'] = ">"):
5086
- if (($v > $pr_array['criteria'])){
5087
- if($pr_array['than'] == "include_only"){
5088
- if($allowed <> 0){
5089
- $allowed = 1;
5090
- }
5091
- } else {
5092
- $allowed = 0;
5093
- }
5094
- }
5095
- break;
5096
- case($pr_array['condition'] = ">="):
5097
- if (($v >= $pr_array['criteria'])){
5098
- if($pr_array['than'] == "include_only"){
5099
- if($allowed <> 0){
5100
- $allowed = 1;
5101
- }
5102
- } else {
5103
- $allowed = 0;
5104
- }
5105
- }
5106
- break;
5107
- case($pr_array['condition'] = "<"):
5108
- if (($v < $pr_array['criteria'])){
5109
- if($pr_array['than'] == "include_only"){
5110
- if($allowed <> 0){
5111
- $allowed = 1;
5112
- }
5113
- } else {
5114
- $allowed = 0;
5115
- }
5116
- }
5117
- break;
5118
- case($pr_array['condition'] = "=<"):
5119
- if (($v <= $pr_array['criteria'])){
5120
- if($pr_array['than'] == "include_only"){
5121
- if($allowed <> 0){
5122
- $allowed = 1;
5123
- }
5124
- } else {
5125
- $allowed = 0;
5126
- }
5127
- }
5128
- break;
5129
- case($pr_array['condition'] = "empty"):
5130
- if (strlen($v) < 1){
5131
- if($pr_array['than'] == "include_only"){
5132
- if($allowed <> 0){
5133
- $allowed = 1;
5134
- }
5135
- } else {
5136
- $allowed = 0;
5137
- }
5138
- }
5139
- break;
5140
- default:
5141
- break;
5142
- }
5143
- } else {
5144
- switch ($pr_array['condition']) {
5145
- case($pr_array['condition'] = "contains"):
5146
- if($pr_array['than'] == "include_only"){
5147
- $allowed = 0;
5148
- } else {
5149
- if($allowed <> 0){
5150
- $allowed = 1;
5151
- }
5152
- }
5153
- break;
5154
- case($pr_array['condition'] = "containsnot"):
5155
- if($pr_array['than'] == "include_only"){
5156
- if($allowed <> 0){
5157
- $allowed = 1;
5158
- }
5159
- } else {
5160
- $allowed = 0;
5161
- }
5162
- break;
5163
- case($pr_array['condition'] = "="):
5164
- if($pr_array['than'] == "include_only"){
5165
- $allowed = 0;
5166
- } else {
5167
- if($allowed <> 0){
5168
- $allowed = 1;
5169
- }
5170
- }
5171
- break;
5172
- case($pr_array['condition'] = "!="):
5173
- if($pr_array['than'] == "include_only"){
5174
- if($allowed <> 0){
5175
- $allowed = 1;
5176
- }
5177
- } else {
5178
- $allowed = 0;
5179
- }
5180
- break;
5181
- case($pr_array['condition'] = ">"):
5182
- if($pr_array['than'] == "include_only"){
5183
- $allowed = 0;
5184
- } else {
5185
- $allowed = 0;
5186
- }
5187
- break;
5188
- case($pr_array['condition'] = ">="):
5189
- if($pr_array['than'] == "include_only"){
5190
- $allowed = 0;
5191
- } else {
5192
- $allowed = 0;
5193
- }
5194
- break;
5195
- case($pr_array['condition'] = "<"):
5196
- if($pr_array['than'] == "include_only"){
5197
- $allowed = 0;
5198
- } else {
5199
- $allowed = 0;
5200
- }
5201
- break;
5202
- case($pr_array['condition'] = "=<"):
5203
- if($pr_array['than'] == "include_only"){
5204
- $allowed = 0;
5205
- } else {
5206
- $allowed = 0;
5207
- }
5208
- break;
5209
- case($pr_array['condition'] = "empty"):
5210
- if($pr_array['than'] == "include_only"){
5211
- if($allowed <> 0){
5212
- $allowed = 1;
5213
- }
5214
- } else {
5215
- $allowed = 0;
5216
- }
5217
- break;
5218
- default:
5219
- break;
5220
- }
5221
- }
5222
- } else {
5223
- // For now only shipping details are in an array
5224
- foreach ($pd_value as $k => $v){
5225
- foreach ($v as $kk => $vv){
5226
- // Only shipping detail rule can be on price for now
5227
- if($kk == "price"){
5228
- switch ($pr_array['condition']) {
5229
- case($pr_array['condition'] = "contains"):
5230
- if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5231
- $allowed = 0;
5232
- }
5233
- break;
5234
- case($pr_array['condition'] = "containsnot"):
5235
- if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5236
- $allowed = 0;
5237
- }
5238
- break;
5239
- case($pr_array['condition'] = "="):
5240
- if (($vv == $pr_array['criteria'])){
5241
- $allowed = 0;
5242
- }
5243
- break;
5244
- case($pr_array['condition'] = "!="):
5245
- if (($vv != $pr_array['criteria'])){
5246
- $allowed = 0;
5247
- }
5248
- break;
5249
- case($pr_array['condition'] = ">"):
5250
- if (($vv > $pr_array['criteria'])){
5251
- $allowed = 0;
5252
- }
5253
- break;
5254
- case($pr_array['condition'] = ">="):
5255
- if (($vv >= $pr_array['criteria'])){
5256
- $allowed = 0;
5257
- }
5258
- break;
5259
- case($pr_array['condition'] = "<"):
5260
- if (($vv < $pr_array['criteria'])){
5261
- $allowed = 0;
5262
- }
5263
- break;
5264
- case($pr_array['condition'] = "=<"):
5265
- if (($vv <= $pr_array['criteria'])){
5266
- $allowed = 0;
5267
- }
5268
- break;
5269
- case($pr_array['condition'] = "empty"):
5270
- if (strlen($vv) < 1){
5271
- $allowed = 0;
5272
- }
5273
- break;
5274
- default:
5275
- break;
5276
- }
5277
- }
5278
  }
5279
- }
5280
- }
5281
- } else {
5282
- // Filters for string values
5283
- // If case-sensitve is off than lowercase both the criteria and attribute value
5284
- if (array_key_exists('cs', $pr_array)){
5285
- if ($pr_array['cs'] != "on"){
5286
- $pd_value = strtolower($pd_value);
5287
- $pr_array['criteria'] = strtolower($pr_array['criteria']);
5288
- }
5289
- }
5290
- $pos = strpos($pd_value, '&amp;');
5291
- $pos_slash = strpos($pr_array['criteria'], '\\');
5292
- if($pos !== false){
5293
- $pd_value = str_replace("&amp;","&",$pd_value);
5294
- }
5295
- if($pos_slash !== false){
5296
- $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5297
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5298
 
5299
- switch ($pr_array['condition']) {
5300
- case($pr_array['condition'] = "contains"):
5301
- if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5302
- $allowed = 0;
5303
- } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5304
- $allowed = 0;
5305
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5306
- if($allowed <> 0){
5307
- $allowed = 1;
5308
- }
5309
- }
5310
- break;
5311
- case($pr_array['condition'] = "containsnot"):
5312
- if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5313
- $allowed = 0;
5314
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5315
- $allowed = 0;
5316
- }
5317
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5318
  case($pr_array['condition'] = "="):
5319
- if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5320
  $allowed = 0;
5321
- } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
5322
- $found = strpos($pd_value,$pr_array['criteria']);
5323
- if ($found !== false) {
5324
- //for category mapping check if its an array
5325
- if($pr_array['attribute'] == "raw_categories"){
5326
- $raw_cats_arr = explode("||",$pd_value);
5327
- if(is_array($raw_cats_arr)){
5328
- if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
5329
- if($allowed <> 0){
5330
- $allowed = 1;
5331
- }
5332
- } else {
5333
- $allowed = 0;
5334
- }
5335
- }
5336
- } else {
5337
- if($allowed <> 0){
5338
- $allowed = 1;
5339
- }
5340
- }
5341
- } else {
5342
- $allowed = 0;
5343
- }
5344
- } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5345
- if($allowed <> 0){
5346
- $allowed = 1;
5347
- }
5348
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5349
- $allowed = 0;
5350
- } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5351
- $allowed = 1;
5352
- }
5353
- break;
5354
- case($pr_array['condition'] = "!="):
5355
- if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5356
- if($allowed <> 0){
5357
- $allowed = 1;
5358
- }
5359
- } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5360
- $allowed = 0;
5361
- } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
5362
- $allowed = 0;
5363
- }
5364
- break;
5365
- case($pr_array['condition'] = ">"):
5366
- // Use a lexical order on relational string operators
5367
- if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5368
- $allowed = 0;
5369
- } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5370
- $allowed = 0;
5371
- }
5372
- break;
5373
- case($pr_array['condition'] = ">="):
5374
- // Use a lexical order on relational string operators
5375
- if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5376
- $allowed = 0;
5377
- } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5378
- $allowed = 0;
5379
- }
5380
- break;
5381
- case($pr_array['condition'] = "<"):
5382
- // Use a lexical order on relational string operators
5383
- if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5384
- $allowed = 0;
5385
- } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5386
- $allowed = 0;
5387
- }
5388
- break;
5389
- case($pr_array['condition'] = "=<"):
5390
- // Use a lexical order on relational string operators
5391
- if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5392
- $allowed = 0;
5393
- } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5394
- $allowed = 0;
5395
- }
5396
- break;
5397
- case($pr_array['condition'] = "empty"):
 
 
5398
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5399
- $allowed = 0;
5400
- } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
5401
- if($allowed <> 0){
5402
- $allowed = 1;
5403
- }
5404
- } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
5405
- $allowed = 0;
5406
- }
5407
- break;
5408
- default:
5409
- break;
5410
- }
5411
- }
5412
- }
5413
- }
5414
- }
5415
 
5416
- if ($allowed < 1){
5417
- $product_data = array();
5418
- $product_data = null;
5419
- } else {
5420
- return $product_data;
5421
- }
5422
- }
5423
  }
26
  return "<![CDATA[ $string ]]>";
27
  }
28
 
 
29
  /**
30
  * Check if a plugin is active
31
  */
56
  * Get all approved product review comments for Google's Product Review Feeds
57
  */
58
  public function woosea_get_reviews ( $product_data, $product ) {
59
+ // Rwviews for the parent variable product itself can be skipped, the review is added for the variation
60
+ if($product_data['product_type'] == "variable"){
61
+ return;
62
+ }
63
+
64
  $approved_reviews = array();
65
  $prod_id = $product_data['id'];
66
 
88
  $cnt = 0;
89
  $name = "";
90
  foreach($name_pieces as $n_piece){
91
+ $n_piece = str_replace("&amp;", "", $n_piece);
92
+
93
  if($cnt > 0){
94
+ $n_piece = ucfirst(substr($n_piece, 0, 1));
95
  }
96
  $name .= $n_piece." ";
97
  $cnt++;
102
  $review['reviewer_name'] = html_entity_decode((str_replace("\r", "", $review['reviewer_name'])), ENT_QUOTES | ENT_XML1, 'UTF-8');
103
  $review['reviewer_name'] = preg_replace( '/\[(.*?)\]/', ' ', $review['reviewer_name'] );
104
  $review['reviewer_name'] = str_replace("&#xa0;", "", $review['reviewer_name']);
105
+ $review['reviewer_name'] = $this->woosea_utf8_for_xml( $review['reviewer_name'] );
106
 
107
  $review['reviewer_id'] = $review_raw->user_id;
108
  $review['review_timestamp'] = $review_raw->comment_date;
330
  /**
331
  * Get category path (needed for Prisjakt)
332
  */
333
+ public function woosea_get_term_parents( $id, $taxonomy, string $link = null, $project_taxonomy, $nicename = false, $visited = array() ) {
334
  // Only add Home to the beginning of the chain when we start buildin the chain
335
  if(empty($visited)){
336
  $chain = 'Home';
937
  unset($shipping_cost);
938
  }
939
  }
940
+
941
+ // User do not want to have free shipping in their feed
942
+ $remove_free_shipping = "no";
943
+ $remove_free_shipping = get_option ('remove_free_shipping');
944
+
945
+ if($remove_free_shipping == "yes"){
946
+ unset($zone_details['service']);
947
+ unset($zone_details['price']);
948
+ unset($shipping_cost);
949
+ }
950
  }
951
 
952
  if(isset($zone_details)){
973
  $zone_details['price'] = trim($shipping_cost);
974
  }
975
  } else {
 
976
  if(isset($shipping_cost)){
977
  $zone_details['price'] = trim($currency." ".$shipping_cost);
978
  }
 
 
979
  }
980
  }
981
  }
1005
 
1006
  // Remove other shipping classes when free shipping is relevant
1007
  $free_check = "yes";
 
1008
 
1009
  if(in_array($free_check, array_column($shipping_arr, 'free'))) { // search value in the array
1010
  foreach($shipping_arr as $k => $v) {
1011
  if(!in_array($free_check, $v)){
1012
+
1013
+ // User do not want to have free shipping in their feed
1014
+ // Only remove the other shipping classes when free shipping is not being removed
1015
+ $remove_free_shipping = "no";
1016
+ $remove_free_shipping = get_option ('remove_free_shipping');
1017
+
1018
+ if($remove_free_shipping == "no"){
1019
+ unset($shipping_arr[$k]);
1020
+ }
1021
  }
1022
  }
1023
  }
1025
  // Fix empty services
1026
  foreach($shipping_arr as $k => $v){
1027
  if(empty($v['service'])){
 
 
1028
  unset($shipping_arr[$k]);
1029
  }
1030
  }
1163
  } elseif (preg_match("/g:product_detail/i",$k)){
1164
  if(!empty($v)){
1165
  $product_detail_split = explode("#", $v);
1166
+ $detail_complete = count($product_detail_split);
1167
+ if($detail_complete == 2){
1168
+ $product_detail = $product->addChild('g:product_detail', '', $namespace['g']);
1169
+ $name = str_replace("_", " ", $product_detail_split[0]);
1170
+
1171
+ $section_name = explode(":", $name);
1172
+ $section_name_start = ucfirst($section_name[0]);
1173
+ $name = ucfirst(trim($section_name[1]));
1174
+
1175
+ $section_name = $product_detail->addChild('g:section_name', "General", $namespace['g']);
1176
+ $product_detail_name = $product_detail->addChild('g:attribute_name', $section_name_start, $namespace['g']);
1177
+ $product_detail_value = $product_detail->addChild('g:attribute_value', $product_detail_split[1], $namespace['g']);
1178
+ }
1179
  }
1180
  } elseif ($k == "g:installment"){
1181
  if(!empty($v)){
2014
  $xml_piece = "";
2015
 
2016
  // Get taxonomies
2017
+ $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");
2018
  $taxonomies = get_taxonomies();
2019
  $diff_taxonomies = array_diff($taxonomies, $no_taxonomies);
2020
 
2346
  $product_data['raw_description'] = substr($product_data['raw_description'], 0, 5000);
2347
  $product_data['raw_short_description'] = substr($product_data['raw_short_description'], 0, 5000);
2348
 
2349
+ // Parent variable description
2350
+ $product_data['mother_description'] = $product_data['description'];
2351
+ $product_data['mother_short_description'] = $product_data['short_description'];
2352
+
2353
  /**
2354
  * Check of we need to add Google Analytics UTM parameters
2355
  */
2464
  }
2465
 
2466
  $product_data['shipping_label'] = $product->get_shipping_class();
2467
+ $term = get_term_by( 'slug', $product->get_shipping_class(), 'product_shipping_class' );
2468
+ if(is_object($term)){
2469
+ $product_data['shipping_label_name'] = $term->name;
2470
+ }
2471
 
2472
  // Get product prices
2473
  $product_data['price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2480
  // Untouched raw system pricing - DO NOT CHANGE THESE
2481
  $product_data['system_net_price'] = round(wc_get_price_excluding_tax( $product ), 2);
2482
  $product_data['system_net_price'] = wc_format_decimal($product_data['system_net_price'],2);
2483
+ $float_system_regular_price = floatval($product->get_regular_price());
2484
+ $product_data['system_regular_price'] = round($float_system_regular_price,2);
2485
  $product_data['system_regular_price'] = wc_format_decimal($product_data['system_regular_price'],2);
2486
 
2487
  $product_data['system_price'] = wc_get_price_including_tax($product, array('price'=> $product->get_price()));
2515
  if($product->get_type() == "bundle"){
2516
  if ($this->woosea_is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php')){
2517
  $product_data['price'] = get_post_meta($product_data['id'], '_price', true);
2518
+ $product_data['sale_price'] = get_post_meta($product_data['id'], '_sale_price', true);
2519
  if(is_numeric($tax_rates[1]['rate'])){
2520
  $product_data['price_forced'] = round(get_post_meta($product_data['id'], '_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2521
  $product_data['regular_price'] = round(get_post_meta($product_data['id'], '_regular_price', true) * (100+$tax_rates[1]['rate'])/100,2);
2613
  $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);
2614
  if($discount !== false){
2615
  $product_data['sale_price'] = $discount;
2616
+ $product_data['price'] = $discount;
2617
  $price_incl_tax = get_option( 'woocommerce_prices_include_tax' );
2618
  if($price_incl_tax == "yes"){
2619
  $product_data['price_forced'] = $product_data['price']*($fullrate/100);
2754
  $product_data['system_sale_price'] = wc_format_localized_price($product_data['system_sale_price']);
2755
 
2756
  // Add rounded price options
2757
+ $float_price = floatval($product_data['price']);
2758
+ $float_regular_price = floatval($product_data['regular_price']);
2759
+ $float_sale_price = floatval($product_data['sale_price']);
2760
+ $product_data['rounded_price'] = round($float_price,0);
2761
+ $product_data['rounded_regular_price'] = round($float_regular_price,0);
2762
+ $product_data['rounded_sale_price'] = round($float_sale_price,0);
2763
 
2764
  // Calculate discount percentage
2765
  if($product_data['sale_price'] > 0){
2777
  }
2778
  }
2779
 
2780
+ if ((array_key_exists('shipping', $project_config['attributes'])) OR (array_key_exists('shipping_price', $project_config['attributes'])) OR ($project_config['fields'] == "trovaprezzi") OR ($project_config['fields'] == "customfeed")){
2781
  $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']);
2782
  $shipping_str = $product_data['shipping'];
2783
  }
2873
 
2874
  foreach($diff_taxonomies as $taxo){
2875
  $term_value = get_the_terms($product_data['id'], $taxo);
2876
+ $product_data["$taxo"] = "";
2877
 
2878
  if(is_array($term_value)){
2879
  // Do not add variation values to the feed when they are out of stock
2883
  $variations = $product_skroutz->get_available_variations();
2884
  $variations_id = wp_list_pluck( $variations, 'variation_id' );
2885
  $skroutz_att_array = array();
2886
+
2887
  foreach($variations_id as $var_id){
2888
  $stock_value = get_post_meta( $var_id, "_stock_status", true );
2889
  if($stock_value == "instock"){
2897
  $product_data[$taxo] = rtrim($product_data[$taxo],',');
2898
  }
2899
  }
 
2900
  foreach($skroutz_att_array as $skrtz_value){
2901
  $product_data[$taxo] .= ",". $skrtz_value;
2902
  }
3011
  $data = $wpdb->get_results($sql);
3012
  if (count($data)) {
3013
  foreach ($data as $key => $value) {
3014
+ $value_display = str_replace("_", " ",$value->name);
3015
  if (preg_match("/_product_attributes/i",$value->name)){
3016
  $product_attr = unserialize($value->type);
3017
  if(!empty($product_attr)){
3029
 
3030
  /**
3031
  * Get Product Attributes for Single products
3032
+ * These are the attributes users create themselves in WooCommerce
3033
  */
3034
+ 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')))){
3035
  $single_attributes = $product->get_attributes();
 
3036
  foreach ($single_attributes as $attribute){
3037
+ $attr_name = strtolower($attribute->get_name());
3038
+ $attr_value = $product->get_attribute($attr_name);
3039
+ $product_data[$attr_name] = $attr_value;
3040
  }
3041
  }
3042
 
3062
  $product_variations = new WC_Product_Variation( $product_data['id'] );
3063
  $variations = $product_variations->get_variation_attributes();
3064
 
3065
+ // For Skroutz and Bestprice apparal products we can only append colours to the product name
3066
  // When a product has both a size and color attribute we assume its an apparal product
3067
+ if(($project_config['fields'] == "skroutz") OR ($project_config['fields'] == "bestprice")){
3068
  $size_found = "no";
3069
  $color_found = "no";
3070
 
3140
  }
3141
  }
3142
 
 
 
3143
  if((isset($project_config['lowest_price_variations'])) OR (isset($project_config['default_variations']))){
 
3144
  // Determine the default variation product
3145
  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"))){
3146
  $mother_product = wc_get_product($product_data['item_group_id']);
3147
  $def_attributes = $mother_product->get_default_attributes();
3148
 
3149
  if(isset($project_config['lowest_price_variations'])){
3150
+
3151
  // Determine lowest priced variation
3152
  $variation_min_price = $mother_product->get_variation_price('min');
3153
  $variation_min_price = wc_format_decimal($variation_min_price,2);
3154
  $variation_min_price = wc_format_localized_price($variation_min_price);
3155
+ $var_price = get_post_meta($product_data['id'], '_price', true);
3156
+ $var_price = wc_format_decimal($var_price,2);
3157
+ $var_price = wc_format_localized_price($var_price);
3158
 
3159
+ if(($var_price == $variation_min_price) OR ($product_data['system_regular_price'] == $variation_min_price) OR ($product_data['system_net_price'] == $variation_min_price)){
3160
  $variation_pass = "true";
3161
  } else {
3162
  $variation_pass = "false";
3294
  /**
3295
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
3296
  */
3297
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3298
+ //if($stock_value == "instock"){
3299
  foreach($diff_taxonomies as $taxo){
3300
  $term_value = get_the_terms($product_data['item_group_id'], $taxo);
3301
  unset($product_data[$taxo]);
3302
  if(is_array($term_value)){
3303
  foreach($term_value as $term){
3304
  if(empty($product_data[$taxo])){
3305
+ $product_data[$taxo] = $term->name;
3306
  } else {
3307
+ $product_data[$taxo] .= " ".$term->name;
3308
  }
3309
  }
3310
  }
3311
+ }
3312
 
3313
  /**
3314
  * Add product tags to the product data array
3328
 
3329
  // Add attribute values to the variation product names to make them unique
3330
  $product_data['title_hyphen'] = $product_data['title']." - ";
3331
+ $product_data['mother_title_hyphen'] = $product_data['mother_title']." - ";
3332
 
3333
  foreach($variations as $kk => $vv){
3334
  $custom_key = $kk;
3477
  * we will add CDATA brackets to the title and description attributes
3478
  */
3479
  $product_data['title_lc'] = ucfirst(strtolower($product_data['title']));
3480
+ $product_data['title_lcw'] = ucwords(strtolower($product_data['title']));
3481
+
3482
  //$product_data['description'] = $this->woosea_append_cdata ( $product_data['description'] );
3483
  //$product_data['short_description'] = $this->woosea_append_cdata ( $product_data['short_description'] );
3484
 
3487
  */
3488
  $product_data['reviews'] = $this->woosea_get_reviews( $product_data, $product );
3489
 
3490
+ /**
3491
+ * Filter out reviews that do not have text
3492
+ */
3493
+ if(!empty($product_data['reviews'])){
3494
+ foreach($product_data['reviews'] as $review_id => $review_details){
3495
+ if(empty($review_details['content'])){
3496
+ unset($product_data['reviews'][$review_id]);
3497
+ }
3498
+ }
3499
+ }
3500
+
3501
  /**
3502
  * Check if individual products need to be excluded
3503
  */
3563
  // For these channels parent products are allowed
3564
  $allowed_channel_parents = array(
3565
  "skroutz",
3566
+ "bestprice",
3567
  "google_dsa",
3568
  "google_product_review",
3569
  );
3570
 
3571
+ if(array_key_exists('fields', $project_config)){
3572
+ if (!in_array($project_config['fields'], $allowed_channel_parents)){
3573
+ if(($product->is_type('variable')) AND ($product_data['item_group_id'] == 0)){
3574
+ $product_data = array();
3575
+ $product_data = null;
3576
+ }
3577
+ }
3578
+ }
3579
 
3580
  /**
3581
  * Remove variation products that are not THE default variation product
3602
  }
3603
  }
3604
 
3605
+ /**
3606
+ * Do final check on Skroutz out of stock sizes
3607
+ * When a size is not on stock remove it
3608
+ */
3609
+ if($project_config['fields'] == "skroutz"){
3610
+ if(isset($product_data['id'])){
3611
+ foreach($project_config['attributes'] as $ky => $vy){
3612
+ if(isset($vy['attribute'])){
3613
+ if($vy['attribute'] == "size"){
3614
+ $size_found = "yes";
3615
+ $sz_attribute = $vy['mapfrom'];
3616
+ }
3617
+ if($vy['attribute'] == "color"){
3618
+ $color_found = "yes";
3619
+ $clr_attribute = $vy['mapfrom'];
3620
+ }
3621
+ }
3622
+ }
3623
+
3624
+ $stock_value = get_post_meta( $product_data['id'], "_stock_status", true );
3625
+ $sz_attr_value = get_post_meta( $product_data['id'], $sz_attribute, true );
3626
+ $clr_attr_value = get_post_meta( $product_data['id'], "attribute_".$clr_attribute, true );
3627
+ if(isset($product_data['item_group_id']) AND ($product_data['item_group_id'] > 0)){
3628
+ $product_skroutz = wc_get_product($product_data['item_group_id']);
3629
+ $variations = $product_skroutz->get_available_variations();
3630
+ $variations_id = wp_list_pluck( $variations, 'variation_id' );
3631
+
3632
+ foreach($variations_id as $var_id){
3633
+ $clr_variation = get_post_meta( $var_id, "attribute_".$clr_attribute, true );
3634
+ $size_variation = get_post_meta( $var_id, "attribute_".$sz_attribute, true );
3635
+ $stock_variation = get_post_meta( $var_id, "_stock_status", true );
3636
+
3637
+ if($clr_variation == $clr_attr_value){
3638
+ if($stock_variation == "outofstock"){
3639
+ // Remove this size as it is not on stock
3640
+ $product_data[$sz_attribute] = str_replace(ucfirst($size_variation),"",$product_data[$sz_attribute]);
3641
+ }
3642
+ }
3643
+ }
3644
+ }
3645
+ }
3646
+ }
3647
+
3648
  /**
3649
  * When product has passed the filter rules it can continue with the rest
3650
  */
3678
  }
3679
  } else {
3680
  if((strlen($attr_value['mapfrom'])) AND (array_key_exists($attr_value['mapfrom'], $product_data))){
3681
+ 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")){
3682
  $attr_line = "'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
3683
  } else {
3684
  $attr_line = "'".$attr_value['prefix']. "".$product_data[$attr_value['mapfrom']]."" .$attr_value['suffix']."'";
3750
  }
3751
  } else {
3752
  if(strlen($product_data[$attr_value['mapfrom']])){
3753
+ 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")){
3754
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3755
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3756
  $attr_line .= ",'".$attr_value['prefix']."".$product_data[$attr_value['mapfrom']]."".$attr_value['suffix']."'";
3970
  }
3971
  } else {
3972
  if(strlen($product_data[$attr_value['mapfrom']])){
3973
+ if(($attr_value['attribute'] == "URL") OR ($attr_value['attribute'] == "g:link") OR ($attr_value['attribute'] == "link") OR ($attr_value['attribute'] == "g:link_template")){
3974
  if(($product_data['product_type'] == "variation") AND (preg_match("/aelia_cs_currency/", $attr_value['suffix']))){
3975
  $attr_value['suffix'] = str_replace("?","&",$attr_value['suffix']);
3976
  $xml_product[$attr_value['attribute']] = "$attr_value[prefix]". $product_data[$attr_value['mapfrom']] ."$attr_value[suffix]";
4500
  return $product_data;
4501
  }
4502
 
4503
+ /**
4504
+ * Execute project rules
4505
+ */
4506
  private function woocommerce_sea_rules( $project_rules2, $product_data ){
4507
+ $aantal_prods = count($product_data);
4508
+ if($aantal_prods > 0){
4509
 
4510
+ foreach ($project_rules2 as $pr_key => $pr_array){
4511
 
4512
+ foreach ($product_data as $pd_key => $pd_value){
4513
 
4514
+ // Check is there is a rule on specific attributes
4515
+ if($pd_key == $pr_array['attribute']){
4516
 
4517
+ // This is because for data manipulation the than attribute is empty
4518
+ if(!array_key_exists('than_attribute', $pr_array)){
4519
+ $pr_array['than_attribute'] = $pd_key;
4520
+ }
4521
 
4522
  // Check if a rule has been set for Google categories
4523
  if (!empty($product_data['categories']) AND ($pr_array['than_attribute'] == "google_category") AND ($product_data[$pr_array['attribute']] == $pr_array['criteria'])){
4524
+
4525
+ $pr_array['than_attribute'] = "categories";
4526
  $category_id = explode("-", $pr_array['newvalue']);
4527
  $pr_array['newvalue'] = $category_id[0];
4528
+ $product_data['categories'] = $pr_array['newvalue'];
4529
+ }
4530
 
4531
+ // Make sure that rules on numerics are on true numerics
4532
+ if (!is_array($pd_value) AND (!preg_match('/[A-Za-z]/', $pd_value))){
4533
+ $pd_value = strtr($pd_value, ',', '.');
4534
+ }
4535
 
4536
 
4537
+ // Make sure the price or sale price is numeric
4538
+ if(($pr_array['attribute'] == "sale_price") OR ($pr_array['attribute'] == "price")){
4539
+ settype($pd_value, "double");
4540
+ }
4541
 
4542
+ if (((is_numeric($pd_value)) AND ($pr_array['than_attribute'] != "shipping"))){
4543
 
4544
+ // Rules for numeric values
4545
+ switch ($pr_array['condition']) {
4546
+ case($pr_array['condition'] = "contains"):
4547
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4548
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $pd_value);
4549
+ }
4550
+ break;
4551
+ case($pr_array['condition'] = "containsnot"):
4552
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4553
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4554
+ }
4555
+ break;
4556
+ case($pr_array['condition'] = "="):
4557
+ if (($pd_value == $pr_array['criteria'])){
4558
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4559
+ }
4560
+ break;
4561
+ case($pr_array['condition'] = "!="):
4562
+ if (($pd_value != $pr_array['criteria'])){
4563
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4564
+ }
4565
+ break;
4566
+ case($pr_array['condition'] = ">"):
4567
+ if (($pd_value > $pr_array['criteria'])){
4568
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4569
+ }
4570
+ break;
4571
+ case($pr_array['condition'] = ">="):
4572
+ if (($pd_value >= $pr_array['criteria'])){
4573
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4574
+ }
4575
+ break;
4576
+ case($pr_array['condition'] = "<"):
4577
+ if (($pd_value < $pr_array['criteria'])){
4578
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4579
+ }
4580
+ break;
4581
+ case($pr_array['condition'] = "=<"):
4582
+ if (($pd_value <= $pr_array['criteria'])){
4583
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4584
+ }
4585
+ break;
4586
+ case($pr_array['condition'] = "empty"):
4587
+ if(empty($product_data[$pr_array['attribute']])){
4588
+ if ((strlen($pd_value) < 1)){
4589
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4590
+ } else {
4591
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4592
+ }
4593
+ }
4594
+ break;
4595
+ case($pr_array['condition'] = "multiply"):
4596
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4597
+ $convert_back = "false";
4598
+ $pos = strpos($pd_value, ',');
4599
+ if($pos !== false){
4600
+ $convert_back = "true";
4601
+ }
4602
+ $pd_value = strtr($pd_value, ',', '.');
4603
+ $newvalue = $pd_value*$pr_array['criteria'];
4604
+ $newvalue = round($newvalue, 2);
4605
+ if($convert_back == "true"){
4606
+ $newvalue = strtr($newvalue, '.',',');
4607
+ }
4608
+ $product_data[$pr_array['attribute']] = $newvalue;
4609
+ break;
4610
+ case($pr_array['condition'] = "divide"):
4611
+ $newvalue = ($pd_value / $pr_array['criteria']);
4612
+ $newvalue = round($newvalue, 2);
4613
+ $newvalue = strtr($newvalue, '.',',');
4614
+ $product_data[$pr_array['attribute']] = $newvalue;
4615
+ break;
4616
+ case($pr_array['condition'] = "plus"):
4617
+ $newvalue = ($pd_value + $pr_array['criteria']);
4618
+ $product_data[$pr_array['attribute']] = $newvalue;
4619
+ break;
4620
+ case($pr_array['condition'] = "minus"):
4621
+ $newvalue = ($pd_value - $pr_array['criteria']);
4622
+ $product_data[$pr_array['attribute']] = $newvalue;
4623
+ break;
4624
+ case($pr_array['condition'] = "findreplace"):
4625
+ if (strpos($pd_value, $pr_array['criteria']) !== false){
4626
  // Make sure that a new value has been set
4627
+ if(!empty($pr_array['newvalue'])){
4628
+ // Find and replace only work on same attribute field, otherwise create a contains rule
4629
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4630
  $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4631
  $product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4632
  }
4633
+ }
4634
+ }
4635
+ break;
4636
+ default:
4637
+ break;
4638
+ }
4639
+ } elseif (is_array($pd_value)) {
4640
+
4641
+ // For now only shipping details are in an array
4642
+ foreach ($pd_value as $k => $v){
4643
+ if(is_array($v)){
4644
+ foreach ($v as $kk => $vv){
4645
+ // Only shipping detail rule can be on price for now
4646
+ if($kk == "price"){
4647
+ switch ($pr_array['condition']) {
4648
+ case($pr_array['condition'] = "contains"):
4649
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
4650
+ $pd_value[$k]['price'] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $vv);
4651
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4652
+ }
4653
+ break;
4654
+ case($pr_array['condition'] = "containsnot"):
4655
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
4656
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4657
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4658
+ }
4659
+ break;
4660
+ case($pr_array['condition'] = "="):
4661
+ if (($vv == $pr_array['criteria'])){
4662
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4663
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4664
+ }
4665
+ break;
4666
+ case($pr_array['condition'] = "!="):
4667
+ if (($vv != $pr_array['criteria'])){
4668
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4669
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4670
+ }
4671
+ break;
4672
+ case($pr_array['condition'] = ">"):
4673
+ if (($vv > $pr_array['criteria'])){
4674
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4675
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4676
+ }
4677
+ break;
4678
+ case($pr_array['condition'] = ">="):
4679
+ if (($vv >= $pr_array['criteria'])){
4680
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4681
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4682
+ }
4683
+ break;
4684
+ case($pr_array['condition'] = "<"):
4685
+ if (($vv < $pr_array['criteria'])){
4686
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4687
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4688
+ }
4689
+ break;
4690
+ case($pr_array['condition'] = "=<"):
4691
+ if (($vv <= $pr_array['criteria'])){
4692
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4693
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4694
+ }
4695
+ break;
4696
+ case($pr_array['condition'] = "empty"):
4697
+ if ((strlen($vv) < 1)){
4698
+ $pd_value[$k]['price'] = $pr_array['newvalue'];
4699
+ $product_data[$pr_array['than_attribute']] = $pd_value;
4700
+ }
4701
+ break;
4702
+ case($pr_array['condition'] = "multiply"):
4703
+ // Only shipping array
4704
+ if(is_array($pd_value)){
4705
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4706
+ foreach ($pd_value as $ship_a_key => $shipping_arr){
4707
+ foreach($shipping_arr as $ship_key => $ship_value){
4708
+ if($ship_key == "price"){
4709
+ $ship_pieces = explode(" ", $ship_value);
4710
+ $pd_value = strtr($ship_pieces[1], ',', '.');
4711
+ $newvalue = $pd_value*$pr_array['criteria'];
4712
+ $newvalue = round($newvalue, 2);
4713
+ $newvalue = strtr($newvalue, '.',',');
4714
+ $newvalue = $ship_pieces[0]." ".$newvalue;
4715
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4716
+ }
4717
+ }
4718
+ }
4719
+ }
4720
+ break;
4721
+ default:
4722
+ break;
4723
+ }
4724
+ }
4725
+ }
4726
+ } else {
4727
+ // Rules on product tags
4728
+ foreach ($pd_value as $k => $v){
4729
+
4730
+ // Rules for string values
4731
+ if (!array_key_exists('cs', $pr_array)){
4732
+ $v = strtolower($v);
4733
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
4734
+ }
4735
+
4736
+ switch ($pr_array['condition']) {
4737
+ case($pr_array['condition'] = "contains"):
4738
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
4739
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4740
+ }
4741
+ break;
4742
+ case($pr_array['condition'] = "containsnot"):
4743
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
4744
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4745
+ }
4746
+ break;
4747
+ case($pr_array['condition'] = "="):
4748
+ if (($v == $pr_array['criteria'])){
4749
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4750
+ }
4751
+ break;
4752
+ case($pr_array['condition'] = "!="):
4753
+ if (($v != $pr_array['criteria'])){
4754
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4755
+ }
4756
+ break;
4757
+ case($pr_array['condition'] = ">"):
4758
+ if (($v > $pr_array['criteria'])){
4759
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4760
+ }
4761
+ break;
4762
+ case($pr_array['condition'] = ">="):
4763
+ if (($v >= $pr_array['criteria'])){
4764
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4765
+ }
4766
+ break;
4767
+ case($pr_array['condition'] = "<"):
4768
+ if (($v < $pr_array['criteria'])){
4769
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4770
+ }
4771
+ break;
4772
+ case($pr_array['condition'] = "=<"):
4773
+ if (($v <= $pr_array['criteria'])){
4774
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4775
+ }
4776
+ break;
4777
+ case($pr_array['condition'] = "empty"):
4778
+ if ((strlen($v) < 1)){
4779
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4780
+ }
4781
+ break;
4782
+ case($pr_array['condition'] = "multiply"):
4783
+ // Only shipping array
4784
+ if(is_array($v)){
4785
+ $pr_array['criteria'] = strtr($pr_array['criteria'], ',', '.');
4786
+ foreach ($v as $ship_a_key => $shipping_arr){
4787
+ foreach($shipping_arr as $ship_key => $ship_value){
4788
+ if($ship_key == "price"){
4789
+ $ship_pieces = explode(" ", $ship_value);
4790
+ $pd_value = strtr($ship_pieces[1], ',', '.');
4791
+ $newvalue = $pd_value*$pr_array['criteria'];
4792
+ $newvalue = round($newvalue, 2);
4793
+ $newvalue = strtr($newvalue, '.',',');
4794
+ $newvalue = $ship_pieces[0]." ".$newvalue;
4795
+ $product_data[$pr_array['than_attribute']][$ship_a_key]['price'] = $newvalue;
4796
+ }
4797
+ }
4798
+ }
4799
+ }
4800
+ break;
4801
+ default:
4802
+ break;
4803
+ }
4804
+ }
4805
+ }
4806
+ }
4807
+ } else {
4808
+ // Rules for string values
4809
  if (!array_key_exists('cs', $pr_array)){
4810
+ if($pr_array['attribute'] != "image"){
4811
+ $pd_value = strtolower($pd_value);
4812
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
4813
+ }
4814
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4815
 
4816
+ switch ($pr_array['condition']) {
4817
+ case($pr_array['condition'] = "contains"):
4818
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4819
+ // Specifically for shipping price rules
4820
+ if(!empty($product_data[$pr_array['than_attribute']])){
4821
+ if(is_array($product_data[$pr_array['than_attribute']])){
4822
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4823
+ for ($x = 0; $x <= $arr_size; $x++) {
4824
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4825
+ }
4826
+ } else {
4827
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4828
+ }
4829
+ } else {
4830
+ // This attribute value is empty for this product
4831
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4832
+ }
4833
+ }
4834
+ break;
4835
+ case($pr_array['condition'] = "containsnot"):
4836
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value))){
4837
+ // Specifically for shipping price rules
4838
+ if(is_array($product_data[$pr_array['than_attribute']])){
4839
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4840
+ for ($x = 0; $x <= $arr_size; $x++) {
4841
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4842
+ }
4843
+ } else {
4844
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4845
+ }
4846
+ }
4847
+ break;
4848
+ case($pr_array['condition'] = "="):
4849
+ if (($pr_array['criteria'] == "$pd_value")){
4850
+ // Specifically for shipping price rules
4851
+ if(is_array($product_data[$pr_array['than_attribute']])){
4852
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4853
+ for ($x = 0; $x <= $arr_size; $x++) {
4854
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4855
+ }
4856
+ } else {
4857
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4858
+ }
4859
+ }
4860
+ $ship = $product_data['shipping'];
4861
+ break;
4862
+ case($pr_array['condition'] = "!="):
4863
+ if (($pr_array['criteria'] != "$pd_value")){
4864
+ // Specifically for shipping price rules
4865
+ if(is_array($product_data[$pr_array['than_attribute']])){
4866
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4867
+ for ($x = 0; $x <= $arr_size; $x++) {
4868
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4869
+ }
4870
+ } else {
4871
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4872
+ }
4873
+ }
4874
+ break;
4875
+ case($pr_array['condition'] = ">"):
4876
+ // Use a lexical order on relational string operators
4877
+ if (($pd_value > $pr_array['criteria'])){
4878
+ // Specifically for shipping price rules
4879
+ if(is_array($product_data[$pr_array['than_attribute']])){
4880
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4881
+ for ($x = 0; $x <= $arr_size; $x++) {
4882
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4883
+ }
4884
+ } else {
4885
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4886
+ }
4887
+ }
4888
+ break;
4889
+ case($pr_array['condition'] = ">="):
4890
+ // Use a lexical order on relational string operators
4891
+ if (($pd_value >= $pr_array['criteria'])){
4892
+ // Specifically for shipping price rules
4893
+ if(is_array($product_data[$pr_array['than_attribute']])){
4894
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4895
+ for ($x = 0; $x <= $arr_size; $x++) {
4896
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4897
+ }
4898
+ } else {
4899
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4900
+ }
4901
+ }
4902
+ break;
4903
+ case($pr_array['condition'] = "<"):
4904
+ // Use a lexical order on relational string operators
4905
+ if (($pd_value < $pr_array['criteria'])){
4906
+ // Specifically for shipping price rules
4907
+ if(isset($product_data[$pr_array['than_attribute']]) AND (is_array($product_data[$pr_array['than_attribute']]))){
4908
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4909
+ for ($x = 0; $x <= $arr_size; $x++) {
4910
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4911
+ }
4912
+ } else {
4913
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4914
+ }
4915
+ }
4916
+ break;
4917
+ case($pr_array['condition'] = "=<"):
4918
+ // Use a lexical order on relational string operators
4919
+ if (($pd_value <= $pr_array['criteria'])){
4920
+ // Specifically for shipping price rules
4921
+ if(is_array($product_data[$pr_array['than_attribute']])){
4922
+ $arr_size = (count($product_data[$pr_array['than_attribute']])-1);
4923
+ for ($x = 0; $x <= $arr_size; $x++) {
4924
+ $product_data[$pr_array['than_attribute']][$x]['price'] = $pr_array['newvalue'];
4925
+ }
4926
+ } else {
4927
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4928
+ }
4929
+ }
4930
+ break;
4931
+
4932
+ case($pr_array['condition'] = "empty"):
4933
+ if(empty($product_data[$pr_array['attribute']])){
4934
+ if(empty($product_data[$pr_array['than_attribute']])){
4935
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4936
+ } else {
4937
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4938
+ }
4939
+ }
4940
+ break;
4941
+ case($pr_array['condition'] = "replace"):
4942
+ $product_data[$pr_array['than_attribute']] = str_replace($pr_array['criteria'], $pr_array['newvalue'], $product_data[$pr_array['than_attribute']]);
4943
+ break;
4944
  case($pr_array['condition'] = "findreplace"):
4945
  if (strpos($pd_value, $pr_array['criteria']) !== false){
4946
+ // Make sure that a new value has been set
4947
+ if(!empty($pr_array['newvalue'])){
4948
+ // Find and replace only work on same attribute field, otherwise create a contains rule
4949
  if($pr_array['attribute'] == $pr_array['than_attribute']){
4950
+ $newvalue = str_replace($pr_array['criteria'],$pr_array['newvalue'], $pd_value);
4951
+ //$product_data[$pr_array['than_attribute']] = ucfirst($newvalue);
4952
+ $product_data[$pr_array['than_attribute']] = $newvalue;
4953
+ }
4954
+ }
4955
+ }
4956
  break;
4957
+ default:
4958
+ break;
4959
+ }
4960
+ }
4961
+ } else {
4962
+ // When a rule has been set on an attribute that is not in product_data
4963
+ // Add the newvalue to product_data
4964
+ if (!array_key_exists($pr_array['attribute'], $product_data)){
4965
+ if(!empty($pr_array['newvalue'])){
4966
+ $product_data[$pr_array['than_attribute']] = $pr_array['newvalue'];
4967
+ } else {
4968
+ if(array_key_exists($pr_array['than_attribute'], $product_data)){
4969
+ $product_data[$pr_array['attribute']] = $product_data[$pr_array['than_attribute']];
4970
+ }
4971
+ }
4972
+ }
4973
+ }
4974
+ }
4975
+ }
4976
+ }
4977
+ return $product_data;
4978
+ }
4979
 
4980
  /**
4981
  * Function to exclude products based on individual product exclusions
4998
  }
4999
  }
5000
 
5001
+
5002
+ /**
5003
+ * Execute project filters (include / exclude)
5004
+ */
5005
  private function woocommerce_sea_filters( $project_rules, $product_data ){
5006
+ $allowed = 1;
5007
 
5008
+ // Check if product was already excluded from the feed
5009
+ $product_excluded = ucfirst( get_post_meta( $product_data['id'], '_woosea_exclude_product', true ) );
5010
 
5011
+ if( $product_excluded == "Yes"){
5012
+ $allowed = 0;
5013
+ }
5014
 
5015
+ foreach ($project_rules as $pr_key => $pr_array){
5016
 
5017
+ if($pr_array['attribute'] == "categories"){
5018
+ $pr_array['attribute'] = "raw_categories";
5019
+ }
5020
 
5021
+ //if(array_key_exists($pr_array['attribute'], $product_data)){
5022
 
5023
+ if(!array_key_exists($pr_array['attribute'], $product_data)) {
5024
+ $product_data[$pr_array['attribute']] = ""; // Sets an empty postmeta value in place of a missing one.
5025
+ }
5026
 
5027
+ foreach ($product_data as $pd_key => $pd_value){
5028
+ // Check is there is a rule on specific attributes
5029
+ if(in_array($pd_key, $pr_array, TRUE)){
5030
 
5031
+ if($pd_key == "price"){
5032
+ //$pd_value = @number_format($pd_value,2);
5033
+ $pd_value = wc_format_decimal($pd_value);
5034
+ }
5035
 
5036
+ if (is_numeric($pd_value)){
5037
+ $old_value = $pd_value;
5038
+ if($pd_key == "price"){
5039
+ $pd_value = @number_format($pd_value,2);
5040
+ }
5041
+
5042
+ // Rules for numeric values
5043
+ switch ($pr_array['condition']) {
5044
+ case($pr_array['condition'] = "contains"):
5045
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5046
+ $allowed = 0;
5047
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5048
+ $allowed = 0;
5049
+ }
5050
+ break;
5051
+ case($pr_array['condition'] = "containsnot"):
5052
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5053
+ $allowed = 0;
5054
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5055
+ $allowed = 0;
5056
+ }
5057
+ break;
 
 
 
 
 
5058
  case($pr_array['condition'] = "="):
5059
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5060
+ $allowed = 0;
5061
+ } elseif (($old_value != $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5062
+ $allowed = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5063
  }
5064
+ break;
5065
+ case($pr_array['condition'] = "!="):
5066
+ if (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5067
+ if($allowed <> 0){
5068
+ $allowed = 1;
5069
+ }
5070
+ } elseif (($old_value == $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5071
+ $allowed = 0;
5072
+ }
5073
+ break;
5074
+ case($pr_array['condition'] = ">"):
5075
+ if (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5076
+ $allowed = 0;
5077
+ } elseif (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5078
+ $allowed = 0;
5079
+ }
5080
+ break;
5081
+ case($pr_array['condition'] = ">="):
5082
+ if (($old_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5083
+ $allowed = 0;
5084
+ } elseif (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5085
+ $allowed = 0;
5086
+ }
5087
+ break;
5088
+ case($pr_array['condition'] = "<"):
5089
+ if (($old_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5090
+ $allowed = 0;
5091
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5092
+ $allowed = 0;
5093
+ }
5094
+ break;
5095
+ case($pr_array['condition'] = "=<"):
5096
+ if (($old_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5097
+ $allowed = 0;
5098
+ } elseif (($old_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5099
+ $allowed = 0;
5100
+ }
5101
+ break;
5102
+ case($pr_array['condition'] = "empty"):
5103
+ if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5104
+ $allowed = 0;
5105
+ } elseif ((strlen($pd_value > 0)) && ($pr_array['than'] == "include_only")){
5106
+ $allowed = 0;
5107
+ }
5108
+ break;
5109
+ default:
5110
+ break;
5111
+ }
5112
+ } elseif (is_array($pd_value)){
5113
+ // Tis can either be a shipping or product_tag array
5114
+ if($pr_array['attribute'] == "product_tag"){
5115
+ $in_tag_array = "not";
5116
+
5117
+ foreach($pd_value as $pt_key => $pt_value){
5118
+ // Rules for string values
5119
+ if (!array_key_exists('cs', $pr_array)){
5120
+ $pt_value = strtolower($pt_value);
5121
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5122
+ }
5123
 
5124
+ if(preg_match('/'.$pr_array['criteria'].'/', $pt_value)){
5125
+ $in_tag_array = "yes";
5126
+ }
5127
+ }
5128
+
5129
+ if($in_tag_array == "yes"){
5130
+ //if(in_array($pr_array['criteria'], $pd_value, TRUE)) {
5131
+ $v = $pr_array['criteria'];
5132
+ switch ($pr_array['condition']) {
5133
+ case($pr_array['condition'] = "contains"):
5134
+ if ((preg_match('/'.$pr_array['criteria'].'/', $v))){
5135
+ if($pr_array['than'] == "include_only"){
5136
+ if($allowed <> 0){
5137
+ $allowed = 1;
5138
+ }
5139
+ } else {
5140
+ $allowed = 0;
5141
+ }
5142
+ } else {
5143
+ $allowed = 0;
5144
+ }
5145
+ break;
5146
+ case($pr_array['condition'] = "containsnot"):
5147
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $v))){
5148
+ if($pr_array['than'] == "include_only"){
5149
+ if($allowed <> 0){
5150
+ $allowed = 1;
5151
+ }
5152
+ } else {
5153
+ $allowed = 0;
5154
+ }
5155
+ } else {
5156
+ $allowed = 0;
5157
+ }
5158
+ break;
5159
+ case($pr_array['condition'] = "="):
5160
+ if (($v == $pr_array['criteria'])){
5161
+ if($pr_array['than'] == "include_only"){
5162
+ if($allowed <> 0){
5163
+ $allowed = 1;
5164
+ }
5165
+ } else {
5166
+ $allowed = 0;
5167
+ }
5168
+ } else {
5169
+ $allowed = 0;
5170
+ }
5171
+ break;
5172
+ case($pr_array['condition'] = "!="):
5173
+ if (($v != $pr_array['criteria'])){
5174
+ if($pr_array['than'] == "include_only"){
5175
+ if($allowed <> 0){
5176
+ $allowed = 1;
5177
+ }
5178
+ } else {
5179
+ $allowed = 0;
5180
+ }
5181
+ }
5182
+ break;
5183
+ case($pr_array['condition'] = ">"):
5184
+ if (($v > $pr_array['criteria'])){
5185
+ if($pr_array['than'] == "include_only"){
5186
+ if($allowed <> 0){
5187
+ $allowed = 1;
5188
+ }
5189
+ } else {
5190
+ $allowed = 0;
5191
+ }
5192
+ }
5193
+ break;
5194
+ case($pr_array['condition'] = ">="):
5195
+ if (($v >= $pr_array['criteria'])){
5196
+ if($pr_array['than'] == "include_only"){
5197
+ if($allowed <> 0){
5198
+ $allowed = 1;
5199
+ }
5200
+ } else {
5201
+ $allowed = 0;
5202
+ }
5203
+ }
5204
+ break;
5205
+ case($pr_array['condition'] = "<"):
5206
+ if (($v < $pr_array['criteria'])){
5207
+ if($pr_array['than'] == "include_only"){
5208
+ if($allowed <> 0){
5209
+ $allowed = 1;
5210
+ }
5211
+ } else {
5212
+ $allowed = 0;
5213
+ }
5214
+ }
5215
+ break;
5216
+ case($pr_array['condition'] = "=<"):
5217
+ if (($v <= $pr_array['criteria'])){
5218
+ if($pr_array['than'] == "include_only"){
5219
+ if($allowed <> 0){
5220
+ $allowed = 1;
5221
+ }
5222
+ } else {
5223
+ $allowed = 0;
5224
+ }
5225
+ }
5226
+ break;
5227
+ case($pr_array['condition'] = "empty"):
5228
+ if (strlen($v) < 1){
5229
+ if($pr_array['than'] == "include_only"){
5230
+ if($allowed <> 0){
5231
+ $allowed = 1;
5232
+ }
5233
+ } else {
5234
+ if(!empty($pt_value)){
5235
+ $allowed = 1;
5236
+ } else {
5237
+ $allowed = 0;
5238
+ }
5239
+ }
5240
+ }
5241
+ break;
5242
+ default:
5243
+ break;
5244
+ }
5245
+ } else {
5246
+ switch ($pr_array['condition']) {
5247
+ case($pr_array['condition'] = "contains"):
5248
+ if($pr_array['than'] == "include_only"){
5249
+ $allowed = 0;
5250
+ } else {
5251
+ if($allowed <> 0){
5252
+ $allowed = 1;
5253
+ }
5254
+ }
5255
+ break;
5256
+ case($pr_array['condition'] = "containsnot"):
5257
+ if($pr_array['than'] == "include_only"){
5258
+ if($allowed <> 0){
5259
+ $allowed = 1;
5260
+ }
5261
+ } else {
5262
+ $allowed = 0;
5263
+ }
5264
+ break;
5265
+ case($pr_array['condition'] = "="):
5266
+ if($pr_array['than'] == "include_only"){
5267
+ $allowed = 0;
5268
+ } else {
5269
+ if($allowed <> 0){
5270
+ $allowed = 1;
5271
+ }
5272
+ }
5273
+ break;
5274
+ case($pr_array['condition'] = "!="):
5275
+ if($pr_array['than'] == "include_only"){
5276
+ if($allowed <> 0){
5277
+ $allowed = 1;
5278
+ }
5279
+ } else {
5280
+ $allowed = 0;
5281
+ }
5282
+ break;
5283
+ case($pr_array['condition'] = ">"):
5284
+ if($pr_array['than'] == "include_only"){
5285
+ $allowed = 0;
5286
+ } else {
5287
+ $allowed = 0;
5288
+ }
5289
+ break;
5290
+ case($pr_array['condition'] = ">="):
5291
+ if($pr_array['than'] == "include_only"){
5292
+ $allowed = 0;
5293
+ } else {
5294
+ $allowed = 0;
5295
+ }
5296
+ break;
5297
+ case($pr_array['condition'] = "<"):
5298
+ if($pr_array['than'] == "include_only"){
5299
+ $allowed = 0;
5300
+ } else {
5301
+ $allowed = 0;
5302
+ }
5303
+ break;
5304
+ case($pr_array['condition'] = "=<"):
5305
+ if($pr_array['than'] == "include_only"){
5306
+ $allowed = 0;
5307
+ } else {
5308
+ $allowed = 0;
5309
+ }
5310
+ break;
5311
+ case($pr_array['condition'] = "empty"):
5312
+ if($pr_array['than'] == "include_only"){
5313
+ if($allowed <> 0){
5314
+ $allowed = 1;
5315
+ }
5316
+ } else {
5317
+ $allowed = 0;
5318
+ }
5319
+ break;
5320
+ default:
5321
+ break;
5322
+ }
5323
+ }
5324
+ } else {
5325
+ // For now only shipping details are in an array
5326
+ foreach ($pd_value as $k => $v){
5327
+ foreach ($v as $kk => $vv){
5328
+ // Only shipping detail rule can be on price for now
5329
+ if($kk == "price"){
5330
+ switch ($pr_array['condition']) {
5331
+ case($pr_array['condition'] = "contains"):
5332
+ if ((preg_match('/'.$pr_array['criteria'].'/', $vv))){
5333
+ $allowed = 0;
5334
+ }
5335
+ break;
5336
+ case($pr_array['condition'] = "containsnot"):
5337
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $vv))){
5338
+ $allowed = 0;
5339
+ }
5340
+ break;
5341
+ case($pr_array['condition'] = "="):
5342
+ if (($vv == $pr_array['criteria'])){
5343
+ $allowed = 0;
5344
+ }
5345
+ break;
5346
+ case($pr_array['condition'] = "!="):
5347
+ if (($vv != $pr_array['criteria'])){
5348
+ $allowed = 0;
5349
+ }
5350
+ break;
5351
+ case($pr_array['condition'] = ">"):
5352
+ if (($vv > $pr_array['criteria'])){
5353
+ $allowed = 0;
5354
+ }
5355
+ break;
5356
+ case($pr_array['condition'] = ">="):
5357
+ if (($vv >= $pr_array['criteria'])){
5358
+ $allowed = 0;
5359
+ }
5360
+ break;
5361
+ case($pr_array['condition'] = "<"):
5362
+ if (($vv < $pr_array['criteria'])){
5363
+ $allowed = 0;
5364
+ }
5365
+ break;
5366
+ case($pr_array['condition'] = "=<"):
5367
+ if (($vv <= $pr_array['criteria'])){
5368
+ $allowed = 0;
5369
+ }
5370
+ break;
5371
+ case($pr_array['condition'] = "empty"):
5372
+ if (strlen($vv) < 1){
5373
+ $allowed = 0;
5374
+ }
5375
+ break;
5376
+ default:
5377
+ break;
5378
+ }
5379
+ }
5380
+ }
5381
+ }
5382
+ }
5383
+ } else {
5384
+ // Filters for string values
5385
+ // If case-sensitve is off than lowercase both the criteria and attribute value
5386
+ if (array_key_exists('cs', $pr_array)){
5387
+ if ($pr_array['cs'] != "on"){
5388
+ $pd_value = strtolower($pd_value);
5389
+ $pr_array['criteria'] = strtolower($pr_array['criteria']);
5390
+ }
5391
+ }
5392
+ $pos = strpos($pd_value, '&amp;');
5393
+ $pos_slash = strpos($pr_array['criteria'], '\\');
5394
+ if($pos !== false){
5395
+ $pd_value = str_replace("&amp;","&",$pd_value);
5396
+ }
5397
+ if($pos_slash !== false){
5398
+ $pr_array['criteria'] = str_replace("\\","",$pr_array['criteria']);
5399
+ }
5400
+
5401
+ switch ($pr_array['condition']) {
5402
+ case($pr_array['condition'] = "contains"):
5403
+ if ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5404
+ $allowed = 0;
5405
+ } elseif ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5406
+ $allowed = 0;
5407
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5408
+ if($allowed <> 0){
5409
+ $allowed = 1;
5410
+ }
5411
+ }
5412
+ break;
5413
+ case($pr_array['condition'] = "containsnot"):
5414
+ if ((!preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5415
+ $allowed = 0;
5416
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5417
+ $allowed = 0;
5418
+ }
5419
+ break;
5420
  case($pr_array['condition'] = "="):
5421
+ if (($pr_array['criteria'] == "$pd_value") AND ($pr_array['than'] == "exclude")){
5422
  $allowed = 0;
5423
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "include_only")){
5424
+ $found = strpos($pd_value,$pr_array['criteria']);
5425
+ if ($found !== false) {
5426
+ //for category mapping check if its an array
5427
+ if($pr_array['attribute'] == "raw_categories"){
5428
+ $raw_cats_arr = explode("||",$pd_value);
5429
+ if(is_array($raw_cats_arr)){
5430
+ if(in_array($pr_array['criteria'],$raw_cats_arr, TRUE)){
5431
+ if($allowed <> 0){
5432
+ $allowed = 1;
5433
+ }
5434
+ } else {
5435
+ $allowed = 0;
5436
+ }
5437
+ }
5438
+ } else {
5439
+ if($allowed <> 0){
5440
+ $allowed = 1;
5441
+ }
5442
+ }
5443
+ } else {
5444
+ $allowed = 0;
5445
+ }
5446
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5447
+ if($allowed <> 0){
5448
+ $allowed = 1;
5449
+ }
5450
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "exclude")){
5451
+ // $allowed = 0;
5452
+ } elseif ((preg_match('/'.$pr_array['criteria'].'/', $pd_value)) && ($pr_array['than'] == "include_only")){
5453
+ $allowed = 1;
5454
+ } else {
5455
+ // $allowed = 1; // Change made on February 24th 2021
5456
+ }
5457
+ break;
5458
+ case($pr_array['condition'] = "!="):
5459
+ if (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "exclude")){
5460
+ if($allowed <> 0){
5461
+ $allowed = 1;
5462
+ }
5463
+ } elseif (($pr_array['criteria'] == "$pd_value") && ($pr_array['than'] == "include_only")){
5464
+ $allowed = 0;
5465
+ } elseif (($pr_array['criteria'] != "$pd_value") && ($pr_array['than'] == "exclude")){
5466
+ $allowed = 0;
5467
+ }
5468
+ break;
5469
+ case($pr_array['condition'] = ">"):
5470
+ // Use a lexical order on relational string operators
5471
+ if (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5472
+ $allowed = 0;
5473
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5474
+ $allowed = 0;
5475
+ }
5476
+ break;
5477
+ case($pr_array['condition'] = ">="):
5478
+ // Use a lexical order on relational string operators
5479
+ if (($pd_value >= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5480
+ $allowed = 0;
5481
+ } elseif (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5482
+ $allowed = 0;
5483
+ }
5484
+ break;
5485
+ case($pr_array['condition'] = "<"):
5486
+ // Use a lexical order on relational string operators
5487
+ if (($pd_value < $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5488
+ $allowed = 0;
5489
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5490
+ $allowed = 0;
5491
+ }
5492
+ break;
5493
+ case($pr_array['condition'] = "=<"):
5494
+ // Use a lexical order on relational string operators
5495
+ if (($pd_value <= $pr_array['criteria']) && ($pr_array['than'] == "exclude")){
5496
+ $allowed = 0;
5497
+ } elseif (($pd_value > $pr_array['criteria']) && ($pr_array['than'] == "include_only")){
5498
+ $allowed = 0;
5499
+ }
5500
+ break;
5501
+ case($pr_array['condition'] = "empty"):
5502
  if ((strlen($pd_value) < 1) && ($pr_array['than'] == "exclude")){
5503
+ $allowed = 0;
5504
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "exclude")){
5505
+ if($allowed <> 0){
5506
+ $allowed = 1;
5507
+ }
5508
+ } elseif ((strlen($pd_value) > 0) && ($pr_array['than'] == "include_only")){
5509
+ $allowed = 0;
5510
+ }
5511
+ break;
5512
+ default:
5513
+ break;
5514
+ }
5515
+ }
5516
+ }
5517
+ }
5518
+ }
5519
 
5520
+ if ($allowed < 1){
5521
+ $product_data = array();
5522
+ $product_data = null;
5523
+ } else {
5524
+ return $product_data;
5525
+ }
5526
+ }
5527
  }
js/woosea_autocomplete.js CHANGED
@@ -5695,8 +5695,10 @@ jQuery(document).ready(function($) {
5695
  jQuery(".js-autosuggest").on('click',function(){
5696
  var className = $(this).attr("class").split(' ')[3];
5697
  var rowCount = className.split("_")[1]
5698
-
5699
- jQuery( ".autocomplete_" + rowCount ).typeahead({
 
 
5700
  input: '.js-autosuggest',
5701
  source: google_taxonomy,
5702
  hint: true,
@@ -5708,7 +5710,6 @@ jQuery(document).ready(function($) {
5708
  });
5709
  jQuery( ".autocomplete_" + rowCount ).focus();
5710
 
5711
-
5712
  jQuery(this).on('change', function(){ // on change of state
5713
 
5714
  var minimum = 1;
@@ -5741,7 +5742,6 @@ jQuery(document).ready(function($) {
5741
  }
5742
  } else {
5743
  var map_to_category = "";
5744
-
5745
  jQuery.ajax({
5746
  method: "POST",
5747
  url: ajaxurl,
5695
  jQuery(".js-autosuggest").on('click',function(){
5696
  var className = $(this).attr("class").split(' ')[3];
5697
  var rowCount = className.split("_")[1]
5698
+
5699
+ //$('#the-basics-11603 .autocomplete_11603').typeahead({
5700
+ jQuery("." + className).typeahead({
5701
+ //jQuery(".autocomplete_" + rowCount ).typeahead({
5702
  input: '.js-autosuggest',
5703
  source: google_taxonomy,
5704
  hint: true,
5710
  });
5711
  jQuery( ".autocomplete_" + rowCount ).focus();
5712
 
 
5713
  jQuery(this).on('change', function(){ // on change of state
5714
 
5715
  var minimum = 1;
5742
  }
5743
  } else {
5744
  var map_to_category = "";
 
5745
  jQuery.ajax({
5746
  method: "POST",
5747
  url: ajaxurl,
js/woosea_key.js CHANGED
@@ -27,7 +27,7 @@ jQuery(document).ready(function($) {
27
  var license_key = $('#license-key').val();
28
 
29
  jQuery.ajax({
30
- url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=9.3.7',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
27
  var license_key = $('#license-key').val();
28
 
29
  jQuery.ajax({
30
+ url: 'https://www.adtribes.io/check/license.php?key=' + license_key + '&email=' + license_email + '&domain=' + root_domain + '&version=9.7.2',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
js/woosea_manage.js CHANGED
@@ -256,6 +256,26 @@ jQuery(function($) {
256
  }
257
  })
258
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  // Check if user would like to enable debug logging
260
  $('#add_woosea_logging').on('change', function(){ // on change of state
261
  if(this.checked){
256
  }
257
  })
258
 
259
+ // Check if user would like the plugin to remove the free shipping class
260
+ $('#remove_free_shipping').on('change', function(){ // on change of state
261
+ if(this.checked){
262
+
263
+ // Checkbox is on
264
+ jQuery.ajax({
265
+ method: "POST",
266
+ url: ajaxurl,
267
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "on" }
268
+ })
269
+ } else {
270
+ // Checkbox is off
271
+ jQuery.ajax({
272
+ method: "POST",
273
+ url: ajaxurl,
274
+ data: { 'action': 'woosea_remove_free_shipping', 'status': "off" }
275
+ })
276
+ }
277
+ })
278
+
279
  // Check if user would like to enable debug logging
280
  $('#add_woosea_logging').on('change', function(){ // on change of state
281
  if(this.checked){
pages/admin/woosea-generate-feed-step-1.php CHANGED
@@ -101,7 +101,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
101
 
102
  $r .= "<tr class=\"catmapping\">";
103
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">$woo_category ($sub_category->count)</td>";
104
- $r .= "<td><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x\" value=\"$mapped_category\"></td>";
105
  if(($yo == $nr_categories) AND ($nr_subcats == 0)){
106
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
107
  } else {
@@ -115,7 +115,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
115
  } else {
116
  $r .= "<tr class=\"catmapping\">";
117
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">-- $woo_category ($sub_category->count)</td>";
118
- $r .= "<td><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x mother_$sub_category->parent\" value=\"$mapped_category\"></td>";
119
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
120
  $r .= "</tr>";
121
  }
@@ -227,7 +227,7 @@ function woosea_hierarchical_term_tree($category, $prev_mapped){
227
 
228
  <table class="woo-product-feed-pro-table">
229
  <tr>
230
- <td><strong><?php _e( 'We\’ve got you covered!','woo-product-feed-pro' );?></strong></td>
231
  </tr>
232
  <tr>
233
  <td>
101
 
102
  $r .= "<tr class=\"catmapping\">";
103
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">$woo_category ($sub_category->count)</td>";
104
+ $r .= "<td><div id=\"the-basics-$x\"><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x\" value=\"$mapped_category\"></div></td>";
105
  if(($yo == $nr_categories) AND ($nr_subcats == 0)){
106
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
107
  } else {
115
  } else {
116
  $r .= "<tr class=\"catmapping\">";
117
  $r .= "<td><input type=\"hidden\" name=\"mappings[$x][rowCount]\" value=\"$x\"><input type=\"hidden\" name=\"mappings[$x][categoryId]\" value=\"$woo_category_id\"><input type=\"hidden\" name=\"mappings[$x][criteria]\" class=\"input-field-large\" id=\"$woo_category_id\" value=\"$woo_category\">-- $woo_category ($sub_category->count)</td>";
118
+ $r .= "<td><div id=\"the-basics-$x\"><input type=\"search\" name=\"mappings[$x][map_to_category]\" class=\"$mapped_active_class js-typeahead js-autosuggest autocomplete_$x mother_$sub_category->parent\" value=\"$mapped_category\"></div></td>";
119
  $r .= "<td><span class=\"copy_category_$x\" style=\"display: inline-block;\" title=\"Copy this category to all others\"></span></td>";
120
  $r .= "</tr>";
121
  }
227
 
228
  <table class="woo-product-feed-pro-table">
229
  <tr>
230
+ <td><strong><?php _e( 'We have got you covered!','woo-product-feed-pro' );?></strong></td>
231
  </tr>
232
  <tr>
233
  <td>
pages/admin/woosea-manage-feed.php CHANGED
@@ -67,6 +67,7 @@ if(!empty($license_information)){
67
  if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
68
  $notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
69
  }
 
70
  ?>
71
  <div class="wrap">
72
  <div class="woo-product-feed-pro-form-style-2">
@@ -124,6 +125,18 @@ if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
124
  <?php
125
  }
126
  }
 
 
 
 
 
 
 
 
 
 
 
 
127
  ?>
128
 
129
  <div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
67
  if (!wp_next_scheduled( 'woosea_cron_hook' ) ) {
68
  $notifications_box = $notifications_obj->get_admin_notifications ( '12', 'false' );
69
  }
70
+
71
  ?>
72
  <div class="wrap">
73
  <div class="woo-product-feed-pro-form-style-2">
125
  <?php
126
  }
127
  }
128
+
129
+
130
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
131
+ ?>
132
+ <div class="notice notice-error is-dismissible">
133
+ <p>
134
+ <strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
135
+ We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active otherwise it cannot update and generate your product feeds. <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>Please enable your WP-cron first</strong></a>.
136
+ </p>
137
+ </div>
138
+ <?php
139
+ }
140
  ?>
141
 
142
  <div class="woo-product-feed-pro-form-style-2-heading"><?php _e( 'Manage feeds','woo-product-feed-pro' );?></div>
pages/admin/woosea-manage-settings.php CHANGED
@@ -101,6 +101,20 @@ if(isset($_GET["tab"])) {
101
  ?>
102
  </span>
103
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  <!-- wordpress provides the styling for tabs. -->
106
  <h2 class="nav-tab-wrapper">
@@ -290,6 +304,24 @@ if(isset($_GET["tab"])) {
290
  </label>
291
  </td>
292
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  <tr>
294
  <td>
295
  <span><?php _e( 'Remove the local pickup shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
@@ -440,11 +472,11 @@ 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
@@ -515,6 +547,10 @@ if(isset($_GET["tab"])) {
515
  $cron_enabled = "True";
516
  }
517
 
 
 
 
 
518
  print "<table class=\"woo-product-feed-pro-table\">";
519
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
520
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
101
  ?>
102
  </span>
103
  </div>
104
+
105
+ <?php
106
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
107
+ ?>
108
+ <div class="notice notice-error is-dismissible">
109
+ <p>
110
+ <strong><?php _e( 'WARNING: Your WP-Cron is disabled', 'woo-product-feed-pro' );?></strong><br/></br/>
111
+ We detected that your WP-cron has been disabled in your wp-config.php file. Our plugin heavily depends on the WP-cron being active for it to be able to update and generate your product feeds. More information on the inner workings of our plugin and instructions on how to enable your WP-Cron can be found here: <a href="https://adtribes.io/help-my-feed-processing-is-stuck/?utm_source=<?php print"$host";?>&utm_medium=manage-feed&utm_campaign=cron-warning&utm_content=notification" target="_blank"><strong>My feed won't update or is stuck processing</strong></a>.
112
+ </p>
113
+ </div>
114
+ <?php
115
+ }
116
+ ?>
117
+
118
 
119
  <!-- wordpress provides the styling for tabs. -->
120
  <h2 class="nav-tab-wrapper">
304
  </label>
305
  </td>
306
  </tr>
307
+ <tr>
308
+ <td>
309
+ <span><?php _e( 'Remove the free shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
310
+ </td>
311
+ <td>
312
+ <label class="woo-product-feed-pro-switch">
313
+ <?php
314
+ $remove_free_shipping = get_option ('remove_free_shipping');
315
+ if($remove_free_shipping == "yes"){
316
+ print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\" checked>";
317
+ } else {
318
+ print "<input type=\"checkbox\" id=\"remove_free_shipping\" name=\"remove_free_shipping\" class=\"checkbox-field\">";
319
+ }
320
+ ?>
321
+ <div class="woo-product-feed-pro-slider round"></div>
322
+ </label>
323
+ </td>
324
+ </tr>
325
  <tr>
326
  <td>
327
  <span><?php _e( 'Remove the local pickup shipping zone from feed (Google Shopping / Facebook only)', 'woo-product-feed-pro');?></span>
472
  $external_path_tsv = $external_base . "/woo-product-feed-pro/";
473
  $external_path_logs = $external_base . "/woo-product-feed-pro/";
474
  $test_file = $external_path . "/tesfile.txt";
475
+ $test_file_xml = $external_path . "xml/tesfile.txt";
476
+ $test_file_csv = $external_path . "csv/tesfile.txt";
477
+ $test_file_txt = $external_path . "txt/tesfile.txt";
478
+ $test_file_tsv = $external_path . "tsv/tesfile.txt";
479
+ $test_file_logs = $external_path . "logs/tesfile.txt";
480
 
481
  if (is_writable($external_path)) {
482
  // Normal root category
547
  $cron_enabled = "True";
548
  }
549
 
550
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
551
+ $cron_enabled = "<strong>False</strong>";
552
+ }
553
+
554
  print "<table class=\"woo-product-feed-pro-table\">";
555
  print "<tr><td><strong>System check</strong></td><td><strong>Status</strong></td></tr>";
556
  print "<tr><td>WP-Cron enabled</td><td>$cron_enabled</td></tr>";
readme.txt CHANGED
@@ -5,11 +5,11 @@ 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.
@@ -175,6 +175,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 +230,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>
@@ -322,6 +324,116 @@ 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 +3100,116 @@ 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
 
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.7.2
9
 
10
  == Description ==
11
 
12
+ Generate WooCommerce product feeds for all your marketing channels, such as Google Shopping (merchant center), Facebook Remarketing, Bing Ads, Billiger.de, Pricerunner, Skroutz and many more. Next to custom feeds there are over 100 pre-defined templates included for marketplaces, comparison shopping engines and search engines. This plugin provides high-quality product feed for Google Shopping and many many more.
13
 
14
  = Why choose this plugin? =
15
  Simply because this is the most complete plugin offering support for an unlimited number of products and feeds, including features such as category- & field-mapping and advanced, rule-based, filtering and product variables support.
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
+ * <a href="https://www.boetiek.nl" target="_blank">Boetiek.nl</a>
179
  * Bol.com
180
  * Stylight
181
  * Incurvy
230
  * <a href="https://www.guenstiger.de" target="_blank" rel="nofollow">Guenstiger.de</a>
231
  * Hood.de
232
  * Ladenzeile.de
233
+ * Idealo.de
234
  * Livingo.de
235
  * Medizinfuchs.de
236
  * <a href="https://www.moebel.de" target="_blank">Moebel.de</a>
324
 
325
  === Changelog ===
326
 
327
+ = 9.7.2 (2021-03-03) =
328
+ * Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
329
+
330
+ = 9.7.1 (2021-03-03) =
331
+ * Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
332
+
333
+ = 9.7.0 (2021-03-03) =
334
+ * Fixed a bug where lowest priced variations where not making it to feeds
335
+
336
+ = 9.6.9 (2021-02-28) =
337
+ * Added product name parent hyphen attribute
338
+
339
+ = 9.6.8 (2021-02-25) =
340
+ * Added Google category taxonomy mapping for Snapchat feeds
341
+
342
+ = 9.6.7 (2021-02-25) =
343
+ * When suffixes and prefixes are used for the Heureka URL fields spaces are removed
344
+
345
+ = 9.6.6 (2021-02-24) =
346
+ * Added support for PHP 8.0
347
+
348
+ = 9.6.5 (2021-02-24) =
349
+ * Do not add Skroutz variable products to the feed when they do not have item_group_id's
350
+
351
+ = 9.6.4 (2021-02-24) =
352
+ * Fixed an issue with rules and filters
353
+ * When a rule was set on an image link, no longer lowercase the image link
354
+
355
+ = 9.6.3 (2021-02-23) =
356
+ * Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
357
+ * Reverted back some changes in filters and rules
358
+
359
+ = 9.6.2 (2021-02-22) =
360
+ * For Skroutz feed removing sizes from feeds when they are out-of-stock
361
+
362
+ = 9.6.1 (2021-02-19) =
363
+ * Added attribute that will allow you to uppercase every first character of a string in product names
364
+
365
+ = 9.6.0 (2021-02-19) =
366
+ * Changed g:itemid to g:id for the Google Local Product Feeds
367
+
368
+ = 9.5.9 (2021-02-19) =
369
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
370
+
371
+ = 9.5.8 (2021-02-18) =
372
+ * Added shipping class name attribute
373
+
374
+ = 9.5.7 (2021-02-17) =
375
+ * Dynamic attribute values are now also added to parent variable products for Skroutz feeds
376
+
377
+ = 9.5.6 (2021-02-17) =
378
+ * Changed attribute name primary category to Yoast primary category as it caused lots of confussion
379
+
380
+ = 9.5.5 (2021-02-11) =
381
+ * Fixed a PHP notice that showed when creating a new rule
382
+ * Tested for compatibility with WooCommerce 5.0
383
+
384
+ = 9.5.4 (2021-02-09) =
385
+ * When free shipping zones are removed do not remove the other shipping zones
386
+
387
+ = 9.5.3 (2021-02-08) =
388
+ * Added a feature to remove free shipping zones from Google and Facebook feeds
389
+
390
+ = 9.5.2 (2021-02-08) =
391
+ * Fixed a minor issue in exclude rules for WooCommerce category names
392
+
393
+ = 9.5.1 (2021-02-02) =
394
+ * Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
395
+
396
+ = 9.5.0 (2021-02-01) =
397
+ * Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
398
+
399
+ = 9.4.9 (2021-01-31) =
400
+ * Added a seperate sale price attribute for bundled products
401
+ * Reviews for parent variable products are removed, the reviews are attached to its variations
402
+
403
+ = 9.4.8 (2021-01-30) =
404
+ * Fixed an issue with the ecomm_prodid on the cart page
405
+
406
+ = 9.4.7 (2021-01-29) =
407
+ * Solved an issue that shipping costs to the first product in a custom feed where empty
408
+
409
+ = 9.4.6 (2021-01-28) =
410
+ * Added a new attribute: product description parent product
411
+
412
+ = 9.4.5 (2021-01-28) =
413
+ * Added a Google Shopping field to their template: g:ship_from_country
414
+ * Stripping & characters from review names as it breaks the review feeds
415
+
416
+ = 9.4.4 (2021-01-27) =
417
+ * 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.
418
+
419
+ = 9.4.3 (2021-01-27) =
420
+ * Fixed an issue with an undefined ecomm_price variable on product variable pages
421
+
422
+ = 9.4.2 (2021-01-26) =
423
+ * Added the Dutch Boetiek.nl template
424
+
425
+ = 9.4.1 (2021-01-19) =
426
+ * Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
427
+
428
+ = 9.4.0 (2021-01-14) =
429
+ * Added a WP-cron check and notifications
430
+
431
+ = 9.3.9 (2021-01-14) =
432
+ * Bestprice.gr apparel products are now grouped by color
433
+
434
+ = 9.3.8 (2021-01-13) =
435
+ * Tested for compatibility with WooCommerce 4.9
436
+
437
  = 9.3.7 (2021-01-12) =
438
  * Added the Bestprice.gr template
439
 
3100
 
3101
  == Upgrade Notice ==
3102
 
3103
+ = 9.7.2 =
3104
+ Fixed an issue with the Facebook pixel. Product names that had an apostrophe in them were not measured.
3105
+
3106
+ = 9.7.1 =
3107
+ Added another fix to take into account prices excluding VAT for filtering out all but the minimum priced variation
3108
+
3109
+ = 9.7.0 =
3110
+ Fixed a bug where lowest priced variations where not making it to feeds
3111
+
3112
+ = 9.6.9 =
3113
+ Added product name parent hyphen attribute
3114
+
3115
+ = 9.6.8 =
3116
+ Added Google category taxonomy mapping for Snapchat feeds
3117
+
3118
+ = 9.6.7 =
3119
+ When suffixes and prefixes are used for the Heureka URL fields spaces are removed
3120
+
3121
+ = 9.6.6 =
3122
+ Added support for PHP 8.0
3123
+
3124
+ = 9.6.5 =
3125
+ Do not add Skroutz variable products to the feed when they do not have item_group_id's
3126
+
3127
+ = 9.6.4 =
3128
+ Fixed an issue with rules and filters
3129
+ When a rule was set on an image link, no longer lowercase the image link
3130
+
3131
+ = 9.6.3 =
3132
+ Fixed a bug, the Facebook pixel is now also measuing revenue for multiple items in Cart, InititiateCheckout and Purchase events
3133
+ Reverted back some changes in filters and rules
3134
+
3135
+ = 9.6.2 =
3136
+ For Skroutz feed removing sizes from feeds when they are out-of-stock
3137
+
3138
+ = 9.6.1 =
3139
+ Added attribute that will allow you to uppercase every first character of a string in product names
3140
+
3141
+ = 9.6.0 =
3142
+ Changed g:itemid to g:id for the Google Local Product Feeds
3143
+
3144
+ = 9.5.9 =
3145
+ * Added a fail-safe when users do not select a marketing channel which let to PHP notices in logs
3146
+
3147
+ = 9.5.8 =
3148
+ Added shipping class name attribute
3149
+
3150
+ = 9.5.7 =
3151
+ Dynamic attribute values are now also added to parent variable products for Skroutz feeds
3152
+
3153
+ = 9.5.6 =
3154
+ Changed attribute name primary category to Yoast primary category as it caused lots of confussion
3155
+
3156
+ = 9.5.5 =
3157
+ Fixed a PHP notice that showed when creating a new rule
3158
+ Tested for compatibility with WooCommerce 5.0
3159
+
3160
+ = 9.5.4 =
3161
+ When free shipping zones are removed do not remove the other shipping zones
3162
+
3163
+ = 9.5.3 =
3164
+ Added a feature to remove free shipping zones from Google and Facebook feeds
3165
+
3166
+ = 9.5.2 =
3167
+ Fixed a minor issue in exclude rules for WooCommerce category names
3168
+
3169
+ = 9.5.1 =
3170
+ Dynamic attributes without values that are used for product details should be skipped which not always happened. This is fixed now.
3171
+
3172
+ = 9.5.0 =
3173
+ Discount rules created with the FlyCart plugin did not make it to Skroutz feeds. This has been solved now
3174
+
3175
+ = 9.4.9 =
3176
+ Added a seperate sale price attribute for bundled products
3177
+ Reviews for parent variable products are removed, the reviews are attached to its variations
3178
+
3179
+ = 9.4.8 =
3180
+ Fixed an issue with the ecomm_prodid on the cart page
3181
+
3182
+ = 9.4.7 =
3183
+ Solved an issue that shipping costs to the first product in a custom feed where empty
3184
+
3185
+ = 9.4.6 =
3186
+ Added a new attribute: product description parent product
3187
+
3188
+ = 9.4.5 =
3189
+ Added a Google Shopping field to their template: g:ship_from_country
3190
+ Stripping & characters from review names as it breaks the review feeds
3191
+
3192
+ = 9.4.4 =
3193
+ 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.
3194
+
3195
+ = 9.4.3 =
3196
+ Fixed an issue with an undefined ecomm_price variable on product variable pages
3197
+
3198
+ = 9.4.2 =
3199
+ Added the Dutch Boetiek.nl template
3200
+
3201
+ = 9.4.1 =
3202
+ Fixed a bug: exclude filters on empty product tags were broken. This is fixed now.
3203
+
3204
+ = 9.4.0 =
3205
+ Added a WP-cron check and notifications
3206
+
3207
+ = 9.3.9 =
3208
+ Bestprice.gr apparel products are now grouped by color
3209
+
3210
+ = 9.3.8 =
3211
+ Tested for compatibility with WooCommerce 4.9
3212
+
3213
  = 9.3.7 =
3214
  Added the Bestprice.gr template
3215
 
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
@@ -17,7 +17,7 @@
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
@@ -347,7 +347,6 @@ function woosea_add_facebook_pixel( $product = null ){
347
  $cats = str_replace("&amp;","&", $cats);
348
 
349
  if(!empty($fb_prodid)){
350
-
351
  if(!$product) {
352
  return -1;
353
  }
@@ -384,7 +383,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
390
  // Since these are not allowed in the feed, at the variations product ID's
@@ -415,12 +414,12 @@ 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
  }
426
  }
@@ -436,6 +435,8 @@ function woosea_add_facebook_pixel( $product = null ){
436
  $order_real = 0;
437
  $contents = "";
438
 
 
 
439
  if ( !is_wp_error( $order_items )) {
440
  foreach( $order_items as $item_id => $order_item) {
441
  $prod_id = $order_item->get_product_id();
@@ -454,7 +455,7 @@ function woosea_add_facebook_pixel( $product = null ){
454
  }
455
  }
456
  $contents = rtrim($contents, ",");
457
- $viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$order_real', content_type:'product', contents:[$contents]});";
458
  }
459
  } else {
460
  // This is on the cart page itself
@@ -463,6 +464,8 @@ function woosea_add_facebook_pixel( $product = null ){
463
  $cart_real = 0;
464
  $contents = "";
465
 
 
 
466
  $checkoutpage = wc_get_checkout_url();
467
  $current_url = get_permalink(get_the_ID());
468
 
@@ -477,20 +480,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
  }
@@ -524,7 +522,7 @@ function woosea_add_facebook_pixel( $product = null ){
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']);
@@ -622,7 +620,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 +657,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 +671,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 +808,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 +2290,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
@@ -4623,8 +4643,11 @@ add_action('wp_dashboard_setup', 'woosea_blog_widgets');
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 +4656,8 @@ function woosea_my_rss_box() {
4633
  $my_feeds = array(
4634
  'https://www.adtribes.io/feed/'
4635
  );
 
 
4636
 
4637
  // Loop through Feeds
4638
  foreach ( $my_feeds as $feed) :
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
+ * Version: 9.7.2
5
  * Plugin URI: https://www.adtribes.io/support/?utm_source=wpadmin&utm_medium=plugin&utm_campaign=woosea_product_feed_pro
6
  * Description: Configure and maintain your WooCommerce product feeds for Google Shopping, Facebook, Remarketing, Bing, Yandex, Comparison shopping websites and over a 100 channels more.
7
  * Author: AdTribes.io
17
  * Domain Path: /languages
18
  *
19
  * WC requires at least: 4.4
20
+ * WC tested up to: 5.0
21
  *
22
  * Product Feed PRO for WooCommerce is free software: you can redistribute it and/or modify
23
  * it under the terms of the GNU General Public License as published by
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
+ define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '9.7.2' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
115
  wp_enqueue_script( 'typeahead-js' );
116
 
117
  // JS for adding input field validation
118
+ wp_register_script( 'woosea_validation-js', plugin_dir_url( __FILE__ ) . 'js/woosea_validation.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
119
  wp_enqueue_script( 'woosea_validation-js' );
120
 
121
  // JS for autocomplete
123
  wp_enqueue_script( 'woosea_autocomplete-js' );
124
 
125
  // JS for adding table rows to the rules page
126
+ wp_register_script( 'woosea_rules-js', plugin_dir_url( __FILE__ ) . 'js/woosea_rules.js', '',WOOCOMMERCESEA_PLUGIN_VERSION, true );
127
  wp_enqueue_script( 'woosea_rules-js' );
128
 
129
  // JS for adding table rows to the field mappings page
347
  $cats = str_replace("&amp;","&", $cats);
348
 
349
  if(!empty($fb_prodid)){
 
350
  if(!$product) {
351
  return -1;
352
  }
383
  $fb_price = $fb_lowprice;
384
  }
385
  }
386
+ $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:'$cats', content_name:\"$product_name\", content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
387
  } else {
388
  // This is a parent variable product
389
  // Since these are not allowed in the feed, at the variations product ID's
414
  $fb_highprice = wc_format_localized_price( $highest );
415
  $fb_price = $fb_lowprice;
416
  }
417
+ $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:'$cats', content_name:'$product_name', content_type:\"product_group\", content_ids:[$content], value:\"$fb_price\", currency:\"$currency\"});";
418
  }
419
  } else {
420
  // This is a simple product page
421
  $fb_price = wc_format_localized_price( $product->get_price() );
422
+ $viewContent = "fbq(\"track\",\"ViewContent\",{content_category:'$cats', content_name:'$product_name', content_type:\"product\", content_ids:[\"$fb_prodid\"], value:\"$fb_price\", currency:\"$currency\"});";
423
  }
424
  }
425
  }
435
  $order_real = 0;
436
  $contents = "";
437
 
438
+ $cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
439
+
440
  if ( !is_wp_error( $order_items )) {
441
  foreach( $order_items as $item_id => $order_item) {
442
  $prod_id = $order_item->get_product_id();
455
  }
456
  }
457
  $contents = rtrim($contents, ",");
458
+ $viewContent = "fbq('track','Purchase',{currency:'$currency', value:'$cart_total_amount', content_type:'product', contents:[$contents]});";
459
  }
460
  } else {
461
  // This is on the cart page itself
464
  $cart_real = 0;
465
  $contents = "";
466
 
467
+ $cart_total_amount = wc_format_localized_price(WC()->cart->get_cart_contents_total());
468
+
469
  $checkoutpage = wc_get_checkout_url();
470
  $current_url = get_permalink(get_the_ID());
471
 
480
  //$contents .= "$prod_id,";
481
 
482
  $cart_real = wc_format_localized_price( $cart_item['line_total'] );
 
 
 
 
 
483
  }
484
  $contents = rtrim($contents, ",");
485
 
486
  // User is on the billing pages
487
  if($checkoutpage == $current_url){
488
+ $viewContent = "fbq(\"track\",\"InitiateCheckout\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
489
  } else {
490
  // User is on the basket page
491
+ $viewContent = "fbq(\"track\",\"AddToCart\",{currency:\"$currency\", value:\"$cart_total_amount\", content_type:\"product\", content_ids:[$contents]});";
492
  }
493
  }
494
  }
522
  $fb_prodid = rtrim($fb_prodid, ",");
523
  $category_name = $term->name;
524
  $category_path = woosea_get_term_parents( $term->term_id, 'product_cat', $link = false, $project_taxonomy = false, $nicename = false, $visited = array() );
525
+ $viewContent = "fbq(\"track\",\"ViewCategory\",{content_category:'$category_path', content_name:'$category_name', content_type:\"product\", content_ids:\"[$fb_prodid]\"});";
526
  } elseif ($fb_pagetype == "searchresults"){
527
  $term = get_queried_object();
528
  $search_string = sanitize_text_field($_GET['s']);
620
  // In that case we need to put in the AggregateOffer structured data
621
  $variation_id = woosea_find_matching_product_variation( $product, $_GET );
622
  $nr_get = count($_GET);
623
+
624
  if($nr_get > 0){
625
  $variable_product = wc_get_product($variation_id);
626
 
657
  $ecomm_price = wc_format_decimal( $lowest, wc_get_price_decimals());
658
  } else {
659
  $ecomm_lowprice = wc_format_decimal( $lowest, wc_get_price_decimals() );
660
+ $ecomm_highprice = wc_format_decimal( $highest, wc_get_price_decimals() );
661
+ $ecomm_price = $ecomm_lowprice;
662
+
663
  }
664
  }
665
  } else {
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
+ // Get the first product from cart and use that product ID
682
+ foreach( WC()->cart->get_cart() as $cart_item ){
683
+ $ecomm_prodid = $cart_item['product_id'];
684
+ break;
685
+ }
686
  ?>
687
  <script type="text/javascript">
688
  var google_tag_params = {
808
  }
809
  add_action('admin_notices', 'woosea_request_review');
810
 
811
+
812
  /**
813
  * Create a seperate MySql table for saving conversion information
814
  */
2290
  }
2291
  add_action( 'wp_ajax_woosea_local_pickup_shipping', 'woosea_local_pickup_shipping' );
2292
 
2293
+ /**
2294
+ * This function enables the setting to remove
2295
+ * free shipping zones
2296
+ */
2297
+ function woosea_remove_free_shipping (){
2298
+ $status = sanitize_text_field($_POST['status']);
2299
+
2300
+ if ($status == "off"){
2301
+ update_option( 'remove_free_shipping', 'no', 'yes');
2302
+ } else {
2303
+ update_option( 'remove_free_shipping', 'yes', 'yes');
2304
+ }
2305
+ }
2306
+ add_action( 'wp_ajax_woosea_remove_free_shipping', 'woosea_remove_free_shipping' );
2307
+
2308
  /**
2309
  * This function enables the setting to use
2310
  * logging
4643
  /**
4644
  * Creates the RSS metabox
4645
  */
4646
+ function woosea_feed_interval( $seconds ) {
4647
+ return 172800; // Cache the feed for 2 days
4648
+ }
4649
+
4650
  function woosea_my_rss_box() {
 
4651
  // Get RSS Feed(s)
4652
  include_once(ABSPATH . WPINC . '/feed.php');
4653
  $domain = $_SERVER['HTTP_HOST'];
4656
  $my_feeds = array(
4657
  'https://www.adtribes.io/feed/'
4658
  );
4659
+
4660
+ add_filter( 'wp_feed_cache_transient_lifetime' , 'woosea_feed_interval' );
4661
 
4662
  // Loop through Feeds
4663
  foreach ( $my_feeds as $feed) :