CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.53

Version Description

(2021-03-24) = * Added: Custom fields feature, custom fields should be found in the dropdown list. * Added: Taxonomies feature, taxonomies should be found in the dropdown list.

Download this release

Release Info

Developer wahid0003
Plugin Icon 128x128 CTX Feed – WooCommerce Product Feed Manager Plugin
Version 4.3.53
Comparing to
See all releases

Code changes from version 4.3.52 to 4.3.53

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Cata
5
  Requires at least: 3.6
6
  Tested Up To: 5.7
7
  Requires PHP: 5.6
8
- Stable tag: 4.3.52
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -498,6 +498,10 @@ Using pro version:
498
 
499
  == Changelog ==
500
 
 
 
 
 
501
  = 4.3.52 (2021-03-22) =
502
  * Added: Compatibility for Discount Rules for WooCommerce by Flycart.
503
 
5
  Requires at least: 3.6
6
  Tested Up To: 5.7
7
  Requires PHP: 5.6
8
+ Stable tag: 4.3.53
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
498
 
499
  == Changelog ==
500
 
501
+ = 4.3.53 (2021-03-24) =
502
+ * Added: Custom fields feature, custom fields should be found in the dropdown list.
503
+ * Added: Taxonomies feature, taxonomies should be found in the dropdown list.
504
+
505
  = 4.3.52 (2021-03-22) =
506
  * Added: Compatibility for Discount Rules for WooCommerce by Flycart.
507
 
includes/classes/class-woo-feed-dropdown.php CHANGED
@@ -207,6 +207,161 @@ class Woo_Feed_Dropdown {
207
  return (array) $attributes;
208
  }
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  /**
211
  * Get All Options
212
  *
@@ -448,6 +603,20 @@ class Woo_Feed_Dropdown {
448
  $attributes = $attributes + $_category_mappings;
449
  $attributes['---6'] = '';
450
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
 
452
  return $attributes;
453
  }
207
  return (array) $attributes;
208
  }
209
 
210
+
211
+ /**
212
+ * Get All Custom Attributes
213
+ *
214
+ * @return array
215
+ */
216
+ protected function getProductMetaKeys() {
217
+ $info = woo_feed_get_cached_data( 'woo_feed_dropdown_meta_keys' );
218
+ if ( false === $info ) {
219
+ global $wpdb;
220
+ $info = array();
221
+ // Load the main attributes.
222
+
223
+ $default_exclude_keys = array(
224
+ // WP internals.
225
+ '_edit_lock',
226
+ '_wp_old_slug',
227
+ '_edit_last',
228
+ '_wp_old_date',
229
+ // WC internals.
230
+ '_downloadable_files',
231
+ '_sku',
232
+ '_weight',
233
+ '_width',
234
+ '_height',
235
+ '_length',
236
+ '_file_path',
237
+ '_file_paths',
238
+ '_default_attributes',
239
+ '_product_attributes',
240
+ '_children',
241
+ '_variation_description',
242
+ // ignore variation description, engine will get child product description from WC CRUD WC_Product::get_description().
243
+ // Plugin Data.
244
+ '_wpcom_is_markdown',
245
+ // JetPack Meta.
246
+ '_yith_wcpb_bundle_data',
247
+ // Yith product bundle data.
248
+ '_et_builder_version',
249
+ // Divi builder data.
250
+ '_vc_post_settings',
251
+ // Visual Composer (WP Bakery) data.
252
+ '_enable_sidebar',
253
+ 'frs_woo_product_tabs',
254
+ // WooCommerce Custom Product Tabs http://www.skyverge.com/.
255
+ );
256
+
257
+ /**
258
+ * Exclude meta keys from dropdown
259
+ *
260
+ * @param array $exclude meta keys to exclude.
261
+ * @param array $default_exclude_keys Exclude keys by default.
262
+ */
263
+ $user_exclude = apply_filters( 'woo_feed_dropdown_exclude_meta_keys', null, $default_exclude_keys );
264
+
265
+ if ( is_array( $user_exclude ) && ! empty( $user_exclude ) ) {
266
+ $user_exclude = esc_sql( $user_exclude );
267
+ $default_exclude_keys = array_merge( $default_exclude_keys, $user_exclude );
268
+ }
269
+
270
+ $default_exclude_keys = array_map( 'esc_sql', $default_exclude_keys );
271
+ $exclude_keys = '\'' . implode( '\', \'', $default_exclude_keys ) . '\'';
272
+
273
+ $default_exclude_key_patterns = array(
274
+ '%_et_pb_%', // Divi builder data
275
+ 'attribute_%', // Exclude product attributes from meta list
276
+ '_yoast_wpseo_%', // Yoast SEO Data
277
+ '_acf-%', // ACF duplicate fields
278
+ '_aioseop_%', // All In One SEO Pack Data
279
+ '_oembed%', // exclude oEmbed cache meta
280
+ '_wpml_%', // wpml metas
281
+ '_oh_add_script_%', // SOGO Add Script to Individual Pages Header Footer.
282
+ );
283
+
284
+ /**
285
+ * Exclude meta key patterns from dropdown
286
+ *
287
+ * @param array $exclude meta keys to exclude.
288
+ * @param array $default_exclude_key_patterns Exclude keys by default.
289
+ */
290
+ $user_exclude_patterns = apply_filters( 'woo_feed_dropdown_exclude_meta_keys_pattern', null, $default_exclude_key_patterns );
291
+ if ( is_array( $user_exclude_patterns ) && ! empty( $user_exclude_patterns ) ) {
292
+ $default_exclude_key_patterns = array_merge( $default_exclude_key_patterns, $user_exclude_patterns );
293
+ }
294
+ $exclude_key_patterns = '';
295
+ foreach ( $default_exclude_key_patterns as $pattern ) {
296
+ $exclude_key_patterns .= $wpdb->prepare( ' AND meta_key NOT LIKE %s', $pattern );
297
+ }
298
+
299
+ $sql = "SELECT DISTINCT( meta_key ) FROM $wpdb->postmeta
300
+ WHERE 1=1 AND
301
+ post_id IN ( SELECT ID FROM $wpdb->posts WHERE post_type = 'product' OR post_type = 'product_variation' ) AND
302
+ ( meta_key NOT IN ( $exclude_keys ) $exclude_key_patterns )";
303
+
304
+ // sql escaped, cached
305
+ $data = $wpdb->get_results( $sql ); // phpcs:ignore
306
+
307
+ if ( count( $data ) ) {
308
+ foreach ( $data as $key => $value ) {
309
+ $info[ Woo_Feed_Products_v3::POST_META_PREFIX . $value->meta_key ] = $value->meta_key;
310
+ }
311
+ }
312
+ woo_feed_set_cache_data( 'woo_feed_dropdown_meta_keys', $info );
313
+ }
314
+
315
+ return (array) $info;
316
+ }
317
+
318
+ /**
319
+ * Get All Taxonomy
320
+ *
321
+ * @return array
322
+ */
323
+ protected function getAllTaxonomy() {
324
+ // $info = woo_feed_get_cached_data( 'woo_feed_dropdown_product_taxonomy' );
325
+ //
326
+ // if ( false === $info ) {
327
+
328
+ $data = get_object_taxonomies( 'product' );
329
+ $info = array();
330
+ global $wp_taxonomies;
331
+ $default_excludes = array(
332
+ 'product_type',
333
+ 'product_visibility',
334
+ 'product_cat',
335
+ 'product_tag',
336
+ 'product_shipping_class',
337
+ 'translation_priority',
338
+ );
339
+
340
+ /**
341
+ * Exclude Taxonomy from dropdown
342
+ *
343
+ * @param array $user_excludes
344
+ * @param array $default_excludes
345
+ */
346
+ $user_excludes = apply_filters( 'woo_feed_dropdown_exclude_taxonomy', null, $default_excludes );
347
+ if ( is_array( $user_excludes ) && ! empty( $user_excludes ) ) {
348
+ $default_excludes = array_merge( $default_excludes, $user_excludes );
349
+ }
350
+ if ( count( $data ) ) {
351
+ foreach ( $data as $key => $value ) {
352
+ if ( in_array( $value, $default_excludes ) || strpos( $value, 'pa_' ) !== false ) {
353
+ continue;
354
+ }
355
+ $label = isset( $wp_taxonomies[ $value ] ) ? $wp_taxonomies[ $value ]->label . " [{$value}]" : $value;
356
+ $info[ Woo_Feed_Products_v3::PRODUCT_TAXONOMY_PREFIX . $value ] = $label;
357
+ }
358
+ }
359
+ // woo_feed_set_cache_data( 'woo_feed_dropdown_product_taxonomy', $info );
360
+ // }
361
+
362
+ return (array) $info;
363
+ }
364
+
365
  /**
366
  * Get All Options
367
  *
603
  $attributes = $attributes + $_category_mappings;
604
  $attributes['---6'] = '';
605
  }
606
+
607
+ $_meta_keys = $this->getProductMetaKeys();
608
+ if ( ! empty( $_meta_keys ) && is_array( $_meta_keys ) ) {
609
+ $attributes['--7'] = esc_html__( 'Custom Fields & Post Metas', 'woo-feed' );
610
+ $attributes = $attributes + $_meta_keys;
611
+ $attributes['---7'] = '';
612
+ }
613
+
614
+ $_taxonomies = $this->getAllTaxonomy();
615
+ if ( ! empty( $_taxonomies ) && is_array( $_taxonomies ) ) {
616
+ $attributes['--8'] = esc_html__( 'Custom Taxonomies', 'woo-feed' );
617
+ $attributes = $attributes + $_taxonomies;
618
+ $attributes['---8'] = '';
619
+ }
620
 
621
  return $attributes;
622
  }
includes/classes/class-woo-feed-engine.php CHANGED
@@ -97,6 +97,7 @@ class WF_Engine
97
 
98
  $wf_attr = array();
99
  $wf_cattr = array();
 
100
  $wf_option = array();
101
 
102
  # Map Merchant Attributes and Woo Attributes
@@ -135,6 +136,10 @@ class WF_Engine
135
  if (strpos($attr['value'], 'wf_cattr_') !== false) {
136
  $wf_cattr[] = $attr['value'];
137
  }
 
 
 
 
138
  }
139
 
140
  # Init Woo Attributes, Custom Attributes and Taxonomies
@@ -142,7 +147,8 @@ class WF_Engine
142
  if (!empty($wf_attr) || !empty($wf_cattr)) {
143
  foreach ($this->storeProducts as $key => $value) {
144
 
145
- $id = $value['id'];
 
146
 
147
  # Get Woo Attributes
148
  if (!empty($wf_attr)) {
@@ -167,6 +173,13 @@ class WF_Engine
167
  $this->storeProducts[ $key ][ $wf_option_value ] = $optionValue;
168
  }
169
  }
 
 
 
 
 
 
 
170
  }
171
  }
172
  }
97
 
98
  $wf_attr = array();
99
  $wf_cattr = array();
100
+ $wf_taxo = array();
101
  $wf_option = array();
102
 
103
  # Map Merchant Attributes and Woo Attributes
136
  if (strpos($attr['value'], 'wf_cattr_') !== false) {
137
  $wf_cattr[] = $attr['value'];
138
  }
139
+
140
+ if ( strpos( $attr['value'], Woo_Feed_Products::PRODUCT_TAXONOMY_PREFIX ) !== false ) {
141
+ $wf_taxo[] = $attr['value'];
142
+ }
143
  }
144
 
145
  # Init Woo Attributes, Custom Attributes and Taxonomies
147
  if (!empty($wf_attr) || !empty($wf_cattr)) {
148
  foreach ($this->storeProducts as $key => $value) {
149
 
150
+ $id = $value['id'];
151
+ $parentId = $value['item_group_id'];
152
 
153
  # Get Woo Attributes
154
  if (!empty($wf_attr)) {
173
  $this->storeProducts[ $key ][ $wf_option_value ] = $optionValue;
174
  }
175
  }
176
+
177
+ // Get Taxonomies
178
+ if ( count( $wf_taxo ) ) {
179
+ foreach ( $wf_taxo as $taxo_key => $taxo_value ) {
180
+ $this->storeProducts[ $key ][ $taxo_value ] = $this->productClass->getProductTaxonomy( $parentId, $taxo_value );
181
+ }
182
+ }
183
  }
184
  }
185
  }
woo-feed.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
- * Version: 4.3.52
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -38,7 +38,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
38
  * @var string
39
  * @since 3.1.6
40
  */
41
- define( 'WOO_FEED_FREE_VERSION', '4.3.52' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
+ * Version: 4.3.53
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
38
  * @var string
39
  * @since 3.1.6
40
  */
41
+ define( 'WOO_FEED_FREE_VERSION', '4.3.53' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {