Product Feed PRO for WooCommerce - Version 7.5.3

Version Description

Added logic to ensure that category hierarchy is respected in the category path / short / Skroutz feeds Removed obsolete category code for variations

Download this release

Release Info

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

Code changes from version 7.5.2 to 7.5.3

classes/class-get-products.php CHANGED
@@ -1951,6 +1951,7 @@ class WooSEA_Get_Products {
1951
  $cat_obj = get_the_terms( $product_data['id'], 'product_cat' );
1952
  }
1953
 
 
1954
  if($cat_obj){
1955
  foreach($cat_obj as $cat_term){
1956
  $cat_alt[] = $cat_term->term_id;
@@ -1958,6 +1959,36 @@ class WooSEA_Get_Products {
1958
  }
1959
  $categories = $cat_alt;
1960
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1961
  // This is a category fix for Yandex, probably needed for all channels
1962
  // When Yoast is not installed and a product is linked to multiple categories
1963
  // The ancestor categoryId does not need to be in the feed
@@ -1971,6 +2002,7 @@ class WooSEA_Get_Products {
1971
  if (in_array($project_config['name'], $double_categories, TRUE)){
1972
  $cat_alt = array();
1973
  $cat_terms = get_the_terms( $product_data['id'], 'product_cat' );
 
1974
  if($cat_terms){
1975
  foreach($cat_terms as $cat_term){
1976
  $cat_alt[] = $cat_term->term_id;
@@ -1981,62 +2013,32 @@ class WooSEA_Get_Products {
1981
 
1982
  // Check if the Yoast plugin is installed and active
1983
  foreach ($categories as $key => $value){
 
1984
 
1985
- if (!$catname){
1986
- $product_cat = get_term($value, 'product_cat');
1987
-
1988
- // Check if there are mother categories
1989
- $parent_categories = get_ancestors($product_cat->term_id, 'product_cat');
1990
- $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
1991
- $category_path_skroutz = str_replace(">",">",$category_path);
1992
-
1993
- if(!is_object($category_path)){
1994
- $product_data['category_path'] = $category_path;
1995
- $product_data['category_path_skroutz'] = $category_path_skroutz;
1996
- $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
1997
- $product_data['category_path_skroutz'] = str_replace("&","&",$product_data['category_path_skroutz']);
1998
- }
1999
-
2000
- foreach ($parent_categories as $category_id){
2001
- $parent = get_term_by('id', $category_id, 'product_cat');
2002
- $parent_name = $parent->name;
2003
- }
2004
 
2005
- if(isset($product_cat->name)) {
2006
- $catname = $product_cat->name;
2007
- $catlink = get_term_link($value,'product_cat');
2008
- $one_category = $catname;
2009
- }
2010
- } else {
2011
- $product_cat = get_term($value, 'product_cat');
2012
- // $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
2013
- // $category_path_skroutz = str_replace(">",">",$category_path);
2014
- //
2015
- // if(!is_object($category_path)){
2016
- // $product_data['category_path'] = $category_path;
2017
- // $product_data['category_path_skroutz'] = $category_path_skroutz;
2018
- // $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
2019
- // $product_data['category_path_skroutz'] = str_replace("&","&",$product_data['category_path_skroutz']);
2020
- // }
2021
-
2022
- // Check if there are mother categories
2023
- $parent_categories = get_ancestors($product_cat->term_id, 'product_cat');
2024
-
2025
- foreach ($parent_categories as $category_id){
2026
- $parent = get_term_by('id', $category_id, 'product_cat');
2027
- $parent_name = "||".$parent->name;
2028
- }
2029
 
2030
- if(isset($product_cat->name)) {
2031
- $catname_concat = $product_cat->name;
2032
- $catlink_concat = get_term_link($value,'product_cat');
2033
- }
2034
- $one_category = $catname_concat;
2035
- $catname .= "||".$catname_concat;
2036
- $catlink .= "||".$catlink_concat;
2037
  }
2038
  }
2039
-
2040
  $product_data['category_path_short'] = str_replace("Home >","",$product_data['category_path']);
2041
  $product_data['category_link'] = $catlink;
2042
  $product_data['raw_categories'] = $catname;
@@ -2732,15 +2734,13 @@ class WooSEA_Get_Products {
2732
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
2733
  */
2734
  foreach($diff_taxonomies as $taxo){
2735
- // if((strpos($taxo, "pa_") === 0) OR (strpos($taxo, "product_") === 0) OR (strpos($taxo, "pwb-") === 0) OR (strpos($taxo, "dokan") === 0)){
2736
- $term_value = get_the_terms($product_data['item_group_id'], $taxo);
2737
 
2738
- if(is_array($term_value)){
2739
- foreach($term_value as $term){
2740
- $product_data[$taxo] = $term->name;
2741
- }
2742
- }
2743
- // }
2744
  }
2745
 
2746
  /**
@@ -2879,75 +2879,6 @@ class WooSEA_Get_Products {
2879
  }
2880
  }
2881
  }
2882
-
2883
- // Get versioned product categories
2884
- $cat_alt = array();
2885
- $cat_obj = get_the_terms( $product_data['item_group_id'], 'product_cat' );
2886
- if($cat_obj){
2887
- foreach($cat_obj as $cat_term){
2888
- $cat_alt[] = $cat_term->term_id;
2889
- }
2890
- }
2891
- $categories = $cat_alt;
2892
-
2893
- // This is a category fix for Yandex, probably needed for all channels
2894
- // When Yoast is not installed and a product is linked to multiple categories
2895
- // The ancestor categoryId does not need to be in the feed
2896
- $double_categories = array(
2897
- 0 => "Yandex",
2898
- 1 => "Prisjakt.se",
2899
- 2 => "Pricerunner.se",
2900
- 3 => "Pricerunner.dk",
2901
- );
2902
-
2903
- if (in_array($project_config['name'], $double_categories, TRUE)){
2904
- $cat_alt = array();
2905
- $cat_terms = get_the_terms( $product_data['item_group_id'], 'product_cat' );
2906
- if($cat_terms){
2907
- foreach($cat_terms as $cat_term){
2908
- $cat_alt[] = $cat_term->term_id;
2909
- }
2910
- }
2911
- $categories = $cat_alt;
2912
- }
2913
-
2914
- // Check if the Yoast plugin is installed and active
2915
- foreach ($categories as $key => $value){
2916
- if (!$catname){
2917
- $product_cat = get_term($value, 'product_cat');
2918
-
2919
- if($product_cat->parent > 0){
2920
- $set_parent = $product_cat->parent;
2921
- }
2922
- $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
2923
- if(!is_object($category_path)){
2924
- $product_data['category_path'] = $category_path;
2925
- }
2926
- if(isset($product_cat->name)) {
2927
- $catname = $product_cat->name;
2928
- $catlink = get_term_link($value,'product_cat');
2929
- }
2930
- } else {
2931
- $product_cat = get_term($value, 'product_cat');
2932
-
2933
- if($product_cat->parent > 0){
2934
- //$category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
2935
- //if(!is_object($category_path)){
2936
- // $product_data['category_path'] = $category_path;
2937
- //}
2938
- if(isset($product_cat->name)) {
2939
- $catname_concat = $product_cat->name;
2940
- $catlink_concat = get_term_link($value,'product_cat');
2941
- }
2942
- $one_category = $catname_concat;
2943
- $catname .= "||".$catname_concat;
2944
- $catlink .= "||".$catlink_concat;
2945
- }
2946
- }
2947
- }
2948
- $product_data['raw_categories'] = $catname;
2949
- $product_data['category_link'] = $catlink;
2950
- $product_data['categories'] = $catname;
2951
  }
2952
  // END VARIABLE PRODUCT CODE
2953
 
1951
  $cat_obj = get_the_terms( $product_data['id'], 'product_cat' );
1952
  }
1953
 
1954
+
1955
  if($cat_obj){
1956
  foreach($cat_obj as $cat_term){
1957
  $cat_alt[] = $cat_term->term_id;
1959
  }
1960
  $categories = $cat_alt;
1961
 
1962
+ // Determine real category hierarchy
1963
+ $cat_order = array();
1964
+ foreach ($categories as $key => $value){
1965
+ $product_cat = get_term($value, 'product_cat');
1966
+ // Not in array so we can add it
1967
+ if(!in_array($value, $cat_order)){
1968
+ $parent_cat = $product_cat->parent;
1969
+ // Check if parent is in array
1970
+ if(in_array($parent_cat, $cat_order)){
1971
+ // Parent is in array, now determine position
1972
+ $position = array_search($parent_cat, $cat_order);
1973
+
1974
+ // Use array splice to add it in the right position in array
1975
+ $new_position = $position+1;
1976
+ $cat_order[$new_position] = $value;
1977
+
1978
+ } else {
1979
+ // Parent is not in array
1980
+ if($parent_cat > 0){
1981
+ $cat_order[] = $value;
1982
+ } else {
1983
+ // This is the main cat so should be in front
1984
+ array_unshift($cat_order, $value);
1985
+ }
1986
+ }
1987
+ }
1988
+ }
1989
+
1990
+ $categories = $cat_order;
1991
+
1992
  // This is a category fix for Yandex, probably needed for all channels
1993
  // When Yoast is not installed and a product is linked to multiple categories
1994
  // The ancestor categoryId does not need to be in the feed
2002
  if (in_array($project_config['name'], $double_categories, TRUE)){
2003
  $cat_alt = array();
2004
  $cat_terms = get_the_terms( $product_data['id'], 'product_cat' );
2005
+
2006
  if($cat_terms){
2007
  foreach($cat_terms as $cat_term){
2008
  $cat_alt[] = $cat_term->term_id;
2013
 
2014
  // Check if the Yoast plugin is installed and active
2015
  foreach ($categories as $key => $value){
2016
+ $product_cat = get_term($value, 'product_cat');
2017
 
2018
+ // Check if there are mother categories
2019
+ $category_path = $this->woosea_get_term_parents( $product_cat->term_id, 'product_cat', $link = false, $project_taxonomy = $project_config['taxonomy'], $nicename = false, $visited = array() );
2020
+ $category_path_skroutz = str_replace(">",">",$category_path);
2021
+
2022
+ if(!is_object($category_path)){
2023
+ $product_data['category_path'] = $category_path;
2024
+ $product_data['category_path_skroutz'] = $category_path_skroutz;
2025
+ $product_data['category_path_skroutz'] = str_replace("Home >","",$product_data['category_path_skroutz']);
2026
+ $product_data['category_path_skroutz'] = str_replace("&","&",$product_data['category_path_skroutz']);
2027
+ }
 
 
 
 
 
 
 
 
 
2028
 
2029
+ $parent_categories = get_ancestors($product_cat->term_id, 'product_cat');
2030
+ foreach ($parent_categories as $category_id){
2031
+ $parent = get_term_by('id', $category_id, 'product_cat');
2032
+ $parent_name = $parent->name;
2033
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2034
 
2035
+ if(isset($product_cat->name)) {
2036
+ $catname .= "||".$product_cat->name;
2037
+ $catlink .= "||".get_term_link($value,'product_cat');
2038
+ $one_category = $catname;
 
 
 
2039
  }
2040
  }
2041
+
2042
  $product_data['category_path_short'] = str_replace("Home >","",$product_data['category_path']);
2043
  $product_data['category_link'] = $catlink;
2044
  $product_data['raw_categories'] = $catname;
2734
  * Although this is a product variation we also need to grap the Dynamic attributes belonging to the simple mother prodict
2735
  */
2736
  foreach($diff_taxonomies as $taxo){
2737
+ $term_value = get_the_terms($product_data['item_group_id'], $taxo);
 
2738
 
2739
+ if(is_array($term_value)){
2740
+ foreach($term_value as $term){
2741
+ $product_data[$taxo] = $term->name;
2742
+ }
2743
+ }
 
2744
  }
2745
 
2746
  /**
2879
  }
2880
  }
2881
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2882
  }
2883
  // END VARIABLE PRODUCT CODE
2884
 
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=7.5.2',
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=7.5.3',
31
  jsonp: 'callback',
32
  dataType: 'jsonp',
33
  type: 'GET',
readme.txt CHANGED
@@ -5,7 +5,7 @@ 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.3
8
- Stable tag: 7.5.2
9
 
10
  == Description ==
11
 
@@ -312,6 +312,10 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
312
 
313
  === Changelog ===
314
 
 
 
 
 
315
  = 7.5.2 (2020-02-22) =
316
  * Solved a bug where the lowest level category of a product was not being added to the category path attribute. This issue has been solved now.
317
 
@@ -2389,6 +2393,10 @@ Questions left or unanswered? Please do not hesitate to contact us at support@ad
2389
 
2390
  == Upgrade Notice ==
2391
 
 
 
 
 
2392
  = 7.5.2 =
2393
  Solved a bug where the lowest level category of a product was not being added to the category path attribute. This issue has been solved now.
2394
 
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.3
8
+ Stable tag: 7.5.3
9
 
10
  == Description ==
11
 
312
 
313
  === Changelog ===
314
 
315
+ = 7.5.3 (2020-02-23) =
316
+ * Added logic to ensure that category hierarchy is respected in the category path / short / Skroutz feeds
317
+ * Removed obsolete category code for variations
318
+
319
  = 7.5.2 (2020-02-22) =
320
  * Solved a bug where the lowest level category of a product was not being added to the category path attribute. This issue has been solved now.
321
 
2393
 
2394
  == Upgrade Notice ==
2395
 
2396
+ = 7.5.3 =
2397
+ Added logic to ensure that category hierarchy is respected in the category path / short / Skroutz feeds
2398
+ Removed obsolete category code for variations
2399
+
2400
  = 7.5.2 =
2401
  Solved a bug where the lowest level category of a product was not being added to the category path attribute. This issue has been solved now.
2402
 
woocommerce-sea.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
- * Version: 7.5.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
@@ -48,7 +48,7 @@ if (!defined('ABSPATH')) {
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
- define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '7.5.2' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
@@ -3833,7 +3833,7 @@ function woosea_license_valid(){
3833
 
3834
  if(!empty($license_information['license_key'])){
3835
  $curl = curl_init();
3836
- $url = "https://www.adtribes.io/check/license.php?key=$license_information[license_key]&email=$license_information[license_email]&domain=$domain&version=7.5.2";
3837
 
3838
  curl_setopt_array($curl, array(
3839
  CURLOPT_RETURNTRANSFER => 1,
1
  <?php
2
  /**
3
  * Plugin Name: Product Feed PRO for WooCommerce
4
+ * Version: 7.5.3
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
48
  * Plugin versionnumber, please do not override.
49
  * Define some constants
50
  */
51
+ define( 'WOOCOMMERCESEA_PLUGIN_VERSION', '7.5.3' );
52
  define( 'WOOCOMMERCESEA_PLUGIN_NAME', 'woocommerce-product-feed-pro' );
53
  define( 'WOOCOMMERCESEA_PLUGIN_NAME_SHORT', 'woo-product-feed-pro' );
54
 
3833
 
3834
  if(!empty($license_information['license_key'])){
3835
  $curl = curl_init();
3836
+ $url = "https://www.adtribes.io/check/license.php?key=$license_information[license_key]&email=$license_information[license_email]&domain=$domain&version=7.5.3";
3837
 
3838
  curl_setopt_array($curl, array(
3839
  CURLOPT_RETURNTRANSFER => 1,