CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.6

Version Description

(2020-12-14) = * Tweak : Google local inventory ads attributes managed. * Tweak : Google local product inventory attributes managed. * Tweak : Facebook attributes source updated.

Download this release

Release Info

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

Code changes from version 4.3.5 to 4.3.6

README.txt CHANGED
@@ -8,7 +8,7 @@ Google Product Review feed, product variations, rakuteen, shopping, skroutz, TSV
8
  Requires at least: 3.6
9
  Tested Up To: 5.6
10
  Requires PHP: 5.6
11
- Stable tag: 4.3.5
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
 
@@ -308,6 +308,11 @@ Using pro version:
308
 
309
  == Changelog ==
310
 
 
 
 
 
 
311
  = 4.3.5 (2020-12-13) =
312
  * Tweak : Canonical link as default attribute for google.
313
 
8
  Requires at least: 3.6
9
  Tested Up To: 5.6
10
  Requires PHP: 5.6
11
+ Stable tag: 4.3.6
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
 
308
 
309
  == Changelog ==
310
 
311
+ = 4.3.6 (2020-12-14) =
312
+ * Tweak : Google local inventory ads attributes managed.
313
+ * Tweak : Google local product inventory attributes managed.
314
+ * Tweak : Facebook attributes source updated.
315
+
316
  = 4.3.5 (2020-12-13) =
317
  * Tweak : Canonical link as default attribute for google.
318
 
admin/partials/woo-feed-settings.php CHANGED
@@ -93,6 +93,30 @@ $settings = woo_feed_get_options( 'all' );
93
  <p class="description"><?php esc_html_e( 'When to expire the Cache.', 'woo-feed' ); ?></p>
94
  </td>
95
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  <?php do_action( 'woo_feed_after_settings_page_fields' ); ?>
97
  <tr>
98
  <td colspan="2">
93
  <p class="description"><?php esc_html_e( 'When to expire the Cache.', 'woo-feed' ); ?></p>
94
  </td>
95
  </tr>
96
+ <tr>
97
+ <td><label for="overridden_structured_data"><?php _e( 'WooCommerce Default Schema Override ', 'woo-feed' ); ?></label></td>
98
+ <td>
99
+ <label for="overridden_structured_data">
100
+ <select name="overridden_structured_data" id="overridden_structured_data">
101
+ <option value="off"<?php selected( $settings['overridden_structured_data'], 'off' ); ?>><?php esc_html_e( 'Off', 'woo-feed' ); ?></option>
102
+ <option value="on"<?php selected( $settings['overridden_structured_data'], 'on' ); ?>><?php esc_html_e( 'On', 'woo-feed' ); ?></option>
103
+ </select>
104
+ </label>
105
+ <p class="description"><?php esc_html_e( 'Turn off when you don\'t want to override default WooCommerce Product Schema', 'woo-feed' ); ?></p>
106
+ </td>
107
+ </tr>
108
+ <tr>
109
+ <td><label for="disable_mpn"><?php _e( 'Disable/Enable GTIN/MPN/EAN/Brand', 'woo-feed' ); ?></label></td>
110
+ <td>
111
+ <label for="disable_mpn">
112
+ <select name="disable_mpn" id="disable_mpn">
113
+ <option value="disable"<?php selected( $settings['disable_mpn'], 'disable' ); ?>><?php esc_html_e( 'Disabled', 'woo-feed' ); ?></option>
114
+ <option value="enable"<?php selected( $settings['disable_mpn'], 'enable' ); ?>><?php esc_html_e( 'Enabled', 'woo-feed' ); ?></option>
115
+ </select>
116
+ </label>
117
+ <p class="description"><?php esc_html_e( 'Disables or Enables GTIN/MPN/EAN/Brand', 'woo-feed' ); ?></p>
118
+ </td>
119
+ </tr>
120
  <?php do_action( 'woo_feed_after_settings_page_fields' ); ?>
121
  <tr>
122
  <td colspan="2">
includes/class-woo-feed-installer.php CHANGED
@@ -103,7 +103,7 @@ class Woo_Feed_installer {
103
  }
104
  // settings api update.
105
  if ( version_compare( '3.3.10', WOO_FEED_FREE_VERSION, '<' ) ) {
106
- $keys = [ 'per_batch', 'product_query_type', 'enable_error_debugging', 'woo_feed_cache_ttl' ];
107
  $data = [];
108
  foreach ( $keys as $key ) {
109
  $data[ $key ] = get_option( 'woo_feed_' . $key );
103
  }
104
  // settings api update.
105
  if ( version_compare( '3.3.10', WOO_FEED_FREE_VERSION, '<' ) ) {
106
+ $keys = [ 'per_batch', 'product_query_type', 'enable_error_debugging', 'woo_feed_cache_ttl', 'overridden_structured_data', 'disable_mpn' ];
107
  $data = [];
108
  foreach ( $keys as $key ) {
109
  $data[ $key ] = get_option( 'woo_feed_' . $key );
includes/classes/class-woo-feed-default-attributes.php CHANGED
@@ -115,25 +115,14 @@ class Woo_Feed_Default_Attributes {
115
  'transit_time_label' => array( 'g:transit_time_label', false ),
116
  'return_address_label' => array( 'g:return_address_label', false ),
117
  'return_policy_label' => array( 'g:return_policy_label', false ),
118
- 'image link' => array( 'g:image_link', false ),
119
- 'gtin' => array( 'g:gtin', false ),
120
- 'mpn' => array( 'g:mpn', false ),
121
- 'store code' => array( 'g:store_code', false ),
122
- 'sale price effective date' => array( 'g:sale_price_effective_date', true ),
123
  'quantity' => array( 'g:quantity', true ),
124
- 'sale price' => array( 'g:sale_price', true ),
125
- 'pickup method' => array( 'g:pickup_method', true ),
126
- 'pickup sla' => array( 'g:pickup_sla', true ),
127
- 'pickup link template' => array( 'g:pickup_link_template', true ),
128
- 'energy efficiency class' => array( 'g:energy_efficiency_class', true ),
129
- 'min energy efficiency class' => array( 'g:min_energy_efficiency_class', true ),
130
- 'max energy efficiency class' => array( 'g:max_energy_efficiency_class ', true ),
131
- 'ads redirect' => array( 'g:ads_redirect', true ),
132
- 'link template' => array( 'g:link_template', true ),
133
- 'mobile link template' => array( 'g:mobile_link_template', true ),
134
- 'mobile pickup link template' => array( 'g:mobile_pickup_link_template', true ),
135
- 'unit pricing measure' => array( 'g:unit_pricing_measure', true ),
136
- 'unit pricing base measure' => array( 'g:unit_pricing_base_measure', true ),
137
  'google_funded_promotion_eligibility' => array(
138
  'g:google_funded_promotion_eligibility',
139
  false,
@@ -209,7 +198,7 @@ class Woo_Feed_Default_Attributes {
209
  'multipack' => array( 'multipack', true ),
210
  'is_bundle' => array( 'is bundle', true ),
211
  'adult' => array( 'adult', true ),
212
- 'ads_​​redirect' => array( 'ads redirect', true ),
213
  'custom_label_0' => array( 'custom label 0', true ),
214
  'custom_label_1' => array( 'custom label 1', true ),
215
  'custom_label_2' => array( 'custom label 2', true ),
@@ -239,6 +228,13 @@ class Woo_Feed_Default_Attributes {
239
  'transit_time_label' => array( 'transit time label', false ),
240
  'return_address_label' => array( 'return address label', false ),
241
  'return_policy_label' => array( 'return policy label', false ),
 
 
 
 
 
 
 
242
  'google_funded_promotion_eligibility' => array(
243
  'google funded promotion eligibility',
244
  false,
@@ -672,7 +668,7 @@ class Woo_Feed_Default_Attributes {
672
  'adult' => 'Adult[adult]',
673
  '---7' => '',
674
  '--8' => 'Ads Attributes',
675
- 'ads_​​redirect' => 'Ads Redirect[ads_​​redirect]',
676
  '---8' => '',
677
  '--9' => 'Custom Label Attributes',
678
  'custom_label_0' => 'Custom label 0 [custom_label_0]',
@@ -696,7 +692,7 @@ class Woo_Feed_Default_Attributes {
696
  'subscription_period' => 'Subscription Period[period]',
697
  'subscription_period_length' => 'Subscription Period Length[period_length]',
698
  'subscription_amount' => 'Subscription Amount[amount]',
699
- 'loyalty_​​points' => 'Loyalty Points[loyalty_​​points]',
700
  '---11' => '',
701
  '--12' => 'Energy Labels',
702
  'energy_efficiency_class' => 'Energy Efficiency Class[energy_efficiency_class]',
@@ -710,7 +706,7 @@ class Woo_Feed_Default_Attributes {
710
  'installment' => 'Installment[installment]',
711
  '---14' => '',
712
  '--15' => 'Merchant Promotions Attribute',
713
- 'promotion_​​id' => 'Promotion Id[promotion_id]',
714
  '---15' => '',
715
  '--16' => 'Shopping Action Attributes',
716
  'sell_on_google_quantity' => 'Number of Product Sold On Google [sell_on_google_quantity]',
@@ -720,6 +716,16 @@ class Woo_Feed_Default_Attributes {
720
  'return_policy_label' => 'Return Policy [return_policy_label]',
721
  'google_funded_promotion_eligibility' => 'Google Funded Promotion Eligibility [google_funded_promotion_eligibility]',
722
  '---16' => '',
 
 
 
 
 
 
 
 
 
 
723
  );
724
  }
725
 
115
  'transit_time_label' => array( 'g:transit_time_label', false ),
116
  'return_address_label' => array( 'g:return_address_label', false ),
117
  'return_policy_label' => array( 'g:return_policy_label', false ),
118
+ 'store_code' => array( 'g:store_code', false ),
 
 
 
 
119
  'quantity' => array( 'g:quantity', true ),
120
+ 'pickup_method' => array( 'g:pickup_method', true ),
121
+ 'pickup_sla' => array( 'g:pickup_sla', true ),
122
+ 'pickup_link_template' => array( 'g:pickup_link_template', true ),
123
+ 'link_template' => array( 'g:link_template', true ),
124
+ 'mobile_link_template' => array( 'g:mobile_link_template', true ),
125
+ 'mobile_pickup_link_template' => array( 'g:mobile_pickup_link_template', true ),
 
 
 
 
 
 
 
126
  'google_funded_promotion_eligibility' => array(
127
  'g:google_funded_promotion_eligibility',
128
  false,
198
  'multipack' => array( 'multipack', true ),
199
  'is_bundle' => array( 'is bundle', true ),
200
  'adult' => array( 'adult', true ),
201
+ 'ads_redirect' => array( 'ads redirect', true ),
202
  'custom_label_0' => array( 'custom label 0', true ),
203
  'custom_label_1' => array( 'custom label 1', true ),
204
  'custom_label_2' => array( 'custom label 2', true ),
228
  'transit_time_label' => array( 'transit time label', false ),
229
  'return_address_label' => array( 'return address label', false ),
230
  'return_policy_label' => array( 'return policy label', false ),
231
+ 'store_code' => array( 'store code', false ),
232
+ 'pickup_method' => array( 'pickup method', true ),
233
+ 'pickup_sla' => array( 'pickup sla', true ),
234
+ 'pickup_link_template' => array( 'pickup link template', true ),
235
+ 'link_template' => array( 'link template', true ),
236
+ 'mobile_link_template' => array( 'mobile link template', true ),
237
+ 'mobile_pickup_link_template' => array( 'mobile pickup link template', true ),
238
  'google_funded_promotion_eligibility' => array(
239
  'google funded promotion eligibility',
240
  false,
668
  'adult' => 'Adult[adult]',
669
  '---7' => '',
670
  '--8' => 'Ads Attributes',
671
+ 'ads_redirect' => 'Ads Redirect[ads_redirect]',
672
  '---8' => '',
673
  '--9' => 'Custom Label Attributes',
674
  'custom_label_0' => 'Custom label 0 [custom_label_0]',
692
  'subscription_period' => 'Subscription Period[period]',
693
  'subscription_period_length' => 'Subscription Period Length[period_length]',
694
  'subscription_amount' => 'Subscription Amount[amount]',
695
+ 'loyalty_points' => 'Loyalty Points[loyalty_points]',
696
  '---11' => '',
697
  '--12' => 'Energy Labels',
698
  'energy_efficiency_class' => 'Energy Efficiency Class[energy_efficiency_class]',
706
  'installment' => 'Installment[installment]',
707
  '---14' => '',
708
  '--15' => 'Merchant Promotions Attribute',
709
+ 'promotion_id' => 'Promotion Id[promotion_id]',
710
  '---15' => '',
711
  '--16' => 'Shopping Action Attributes',
712
  'sell_on_google_quantity' => 'Number of Product Sold On Google [sell_on_google_quantity]',
716
  'return_policy_label' => 'Return Policy [return_policy_label]',
717
  'google_funded_promotion_eligibility' => 'Google Funded Promotion Eligibility [google_funded_promotion_eligibility]',
718
  '---16' => '',
719
+ '--17' => 'Local Inventory / Product Inventory',
720
+ 'store_code' => 'Store Code [store_code]',
721
+ 'quantity' => 'Quantity [quantity]',
722
+ 'pickup_method' => 'Pickup Method [pickup_method]',
723
+ 'pickup_sla' => 'Pickup SLA [pickup_sla]',
724
+ 'pickup_link_template' => 'Pickup Link Template [pickup_link_template]',
725
+ 'link_template' => 'Link Template [link_template]',
726
+ 'mobile_link_template' => 'Mobile Link Template [mobile_link_template]',
727
+ 'mobile_pickup_link_template' => 'Mobile Pickup Link Template [mobile_pickup_link_template]',
728
+ '---17' => '',
729
  );
730
  }
731
 
includes/classes/class-woo-feed-dropdown.php CHANGED
@@ -416,6 +416,40 @@ class Woo_Feed_Dropdown {
416
  return $options;
417
  }
418
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  /**
420
  * Dropdown of Google Review Attribute List
421
  *
416
  return $options;
417
  }
418
 
419
+ /**
420
+ * Dropdown of Google Local Inventory Ads Template
421
+ *
422
+ * @param string $selected
423
+ *
424
+ * @return string
425
+ */
426
+ public function google_localAttributesDropdown( $selected = '' ) {
427
+ $options = $this->get_cached_dropdown( 'googleAttributesDropdown', $selected );
428
+
429
+ if ( false === $options ) {
430
+ $attributes = new Woo_Feed_Default_Attributes();
431
+ return $this->cache_dropdown( 'googleAttributesDropdown', $attributes->googleAttributes(), $selected );
432
+ }
433
+ return $options;
434
+ }
435
+
436
+ /**
437
+ * Dropdown of Google Local Product Inventory Template
438
+ *
439
+ * @param string $selected
440
+ *
441
+ * @return string
442
+ */
443
+ public function google_local_inventoryAttributesDropdown( $selected = '' ) {
444
+ $options = $this->get_cached_dropdown( 'googleAttributesDropdown', $selected );
445
+
446
+ if ( false === $options ) {
447
+ $attributes = new Woo_Feed_Default_Attributes();
448
+ return $this->cache_dropdown( 'googleAttributesDropdown', $attributes->googleAttributes(), $selected );
449
+ }
450
+ return $options;
451
+ }
452
+
453
  /**
454
  * Dropdown of Google Review Attribute List
455
  *
includes/classes/class-woo-feed-merchant.php CHANGED
@@ -322,11 +322,11 @@ class Woo_Feed_Merchant {
322
  return array(
323
  '--2' => esc_html__( 'Popular Templates', 'woo-feed' ),
324
  'google' => esc_html__( 'Google Shopping', 'woo-feed' ),
325
- 'google_local' => esc_html__( 'Google Local Product', 'woo-feed' ),
326
  'google_local_inventory' => esc_html__( 'Google Local Product Inventory', 'woo-feed' ),
327
  'google_shopping_action' => esc_html__( 'Google Shopping Action', 'woo-feed' ),
328
  'adwords' => esc_html__( 'Google Adwords', 'woo-feed' ),
329
- 'facebook' => esc_html__( 'Facebook', 'woo-feed' ),
330
  'pinterest' => esc_html__( 'Pinterest', 'woo-feed' ),
331
  'bing' => esc_html__( 'Bing', 'woo-feed' ),
332
  'idealo' => esc_html__( 'Idealo', 'woo-feed' ),
322
  return array(
323
  '--2' => esc_html__( 'Popular Templates', 'woo-feed' ),
324
  'google' => esc_html__( 'Google Shopping', 'woo-feed' ),
325
+ 'google_local' => esc_html__( 'Google Local Inventory Ads', 'woo-feed' ),
326
  'google_local_inventory' => esc_html__( 'Google Local Product Inventory', 'woo-feed' ),
327
  'google_shopping_action' => esc_html__( 'Google Shopping Action', 'woo-feed' ),
328
  'adwords' => esc_html__( 'Google Adwords', 'woo-feed' ),
329
+ 'facebook' => esc_html__( 'Facebook Catalog / Instagram', 'woo-feed' ),
330
  'pinterest' => esc_html__( 'Pinterest', 'woo-feed' ),
331
  'bing' => esc_html__( 'Bing', 'woo-feed' ),
332
  'idealo' => esc_html__( 'Idealo', 'woo-feed' ),
includes/feeds/merchant_templates.php CHANGED
@@ -59,7 +59,7 @@ return array(
59
  'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '6', '6', '1', '1', '1' ),
60
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
61
  ),
62
- 'facebook' => array(
63
  'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'current_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'sku', 'brand', 'inventory', ),
64
  'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
65
  'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute'),
@@ -1523,7 +1523,7 @@ return array(
1523
  ),
1524
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
1525
  ),
1526
- 'pricerunner' => array(
1527
  'mattributes' => array('Category','SKU','Price','Product URL','Product name','Manufacturer SKU','Manufacturer','EAN','Description','Graphic URL','In Stock','Stock Level','Shipping Cost','Delivery time',),
1528
  'prefix' => array('','','','','','','','','','','','','','',),
1529
  'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','pattern','attribute','attribute','attribute','attribute','attribute','pattern','pattern',),
@@ -2701,19 +2701,19 @@ return array(
2701
  ),
2702
  'google_local_inventory' => array(
2703
  'mattributes' => array(
2704
- 'store code',
2705
  'id',
2706
  'title',
2707
  'description',
2708
- 'image link',
2709
  'condition',
2710
  'quantity',
2711
  'price',
2712
- 'sale price',
2713
  'availability',
2714
- 'sale price effective date',
2715
- 'pickup method',
2716
- 'pickup sla',
2717
  ),
2718
  'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2719
  'type' => array(
@@ -2753,30 +2753,30 @@ return array(
2753
  ),
2754
  'google_local' => array(
2755
  'mattributes' => array(
2756
- 'store code',
2757
  'id',
2758
  'title',
2759
  'description',
2760
- 'image link',
2761
  'condition',
2762
- 'gtin',
2763
  'brand',
2764
- 'mpn',
2765
  'price',
2766
- 'sale price',
2767
- 'sale price effective date',
2768
- 'unit pricing measure',
2769
- 'unit pricing base measure',
2770
- 'pickup method',
2771
- 'pickup sla',
2772
- 'pickup link template',
2773
- 'mobile pickup link template',
2774
- 'link template',
2775
- 'mobile link template',
2776
- 'ads redirect',
2777
- 'energy efficiency class',
2778
- 'min energy efficiency class',
2779
- 'max energy efficiency class',
2780
  ),
2781
  'prefix' => array(
2782
  '',
@@ -3464,7 +3464,7 @@ return array(
3464
  'output_type' => array( '1', '1', '8', '1', '1', '1', '6', '1', '1', '1' ),
3465
  'limit' => array( '', '', '', '', '', '', '', '', '','' ),
3466
  ),
3467
- 'bestprice' => array(
3468
  'mattributes' => array(
3469
  'productId',
3470
  'name',
@@ -3570,7 +3570,7 @@ return array(
3570
  'attribute',
3571
  'attribute',
3572
  'pattern',
3573
- 'pattern',
3574
  'pattern',
3575
  'pattern',
3576
  'pattern',
@@ -3591,7 +3591,7 @@ return array(
3591
  'price',
3592
  'sku',
3593
  '',
3594
- '',
3595
  '',
3596
  '',
3597
  '',
59
  'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '6', '6', '1', '1', '1' ),
60
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
61
  ),
62
+ 'facebook' => array(
63
  'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'current_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'sku', 'brand', 'inventory', ),
64
  'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
65
  'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute'),
1523
  ),
1524
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
1525
  ),
1526
+ 'pricerunner' => array(
1527
  'mattributes' => array('Category','SKU','Price','Product URL','Product name','Manufacturer SKU','Manufacturer','EAN','Description','Graphic URL','In Stock','Stock Level','Shipping Cost','Delivery time',),
1528
  'prefix' => array('','','','','','','','','','','','','','',),
1529
  'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','pattern','attribute','attribute','attribute','attribute','attribute','pattern','pattern',),
2701
  ),
2702
  'google_local_inventory' => array(
2703
  'mattributes' => array(
2704
+ 'store_code',
2705
  'id',
2706
  'title',
2707
  'description',
2708
+ 'image',
2709
  'condition',
2710
  'quantity',
2711
  'price',
2712
+ 'sale_price',
2713
  'availability',
2714
+ 'sale_price_effective_date',
2715
+ 'pickup_method',
2716
+ 'pickup_sla',
2717
  ),
2718
  'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2719
  'type' => array(
2753
  ),
2754
  'google_local' => array(
2755
  'mattributes' => array(
2756
+ 'store_code',
2757
  'id',
2758
  'title',
2759
  'description',
2760
+ 'image',
2761
  'condition',
2762
+ 'upc',
2763
  'brand',
2764
+ 'sku',
2765
  'price',
2766
+ 'sale_price',
2767
+ 'sale_price_effective_date',
2768
+ 'unit_pricing_measure',
2769
+ 'unit_pricing_base_measure',
2770
+ 'pickup_method',
2771
+ 'pickup_sla',
2772
+ 'pickup_link_template',
2773
+ 'mobile_pickup_link_template',
2774
+ 'link_template',
2775
+ 'mobile_link_template',
2776
+ 'ads_redirect',
2777
+ 'energy_efficiency_class',
2778
+ 'min_energy_efficiency_class',
2779
+ 'max_energy_efficiency_class',
2780
  ),
2781
  'prefix' => array(
2782
  '',
3464
  'output_type' => array( '1', '1', '8', '1', '1', '1', '6', '1', '1', '1' ),
3465
  'limit' => array( '', '', '', '', '', '', '', '', '','' ),
3466
  ),
3467
+ 'bestprice' => array(
3468
  'mattributes' => array(
3469
  'productId',
3470
  'name',
3570
  'attribute',
3571
  'attribute',
3572
  'pattern',
3573
+ 'attribute',
3574
  'pattern',
3575
  'pattern',
3576
  'pattern',
3591
  'price',
3592
  'sku',
3593
  '',
3594
+ 'quantity',
3595
  '',
3596
  '',
3597
  '',
includes/helper.php CHANGED
@@ -2109,10 +2109,12 @@ if ( ! function_exists( 'woo_feed_get_options' ) ) {
2109
  */
2110
  function woo_feed_get_options( $key, $default = false ) {
2111
  $defaults = [
2112
- 'per_batch' => 200,
2113
- 'product_query_type' => 'both',
2114
- 'enable_error_debugging' => 'off',
2115
- 'cache_ttl' => 6 * HOUR_IN_SECONDS,
 
 
2116
  ];
2117
 
2118
  /**
@@ -2181,6 +2183,20 @@ if ( ! function_exists( 'woo_feed_save_options' ) ) {
2181
  $data['cache_ttl'] = absint( $args['cache_ttl'] ); // cache ttl can be zero.
2182
  unset( $args['cache_ttl'] );
2183
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2184
  if ( ! empty( $args ) ) {
2185
  foreach ( $args as $key => $value ) {
2186
  if ( has_filter( "woo_feed_save_{$key}_option" ) ) {
@@ -3034,5 +3050,265 @@ if ( ! function_exists( 'array_key_first' ) ) {
3034
  return NULL ;
3035
  }
3036
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3037
 
3038
  // End of file helper.php.
2109
  */
2110
  function woo_feed_get_options( $key, $default = false ) {
2111
  $defaults = [
2112
+ 'per_batch' => 200,
2113
+ 'product_query_type' => 'both',
2114
+ 'enable_error_debugging' => 'off',
2115
+ 'cache_ttl' => 6 * HOUR_IN_SECONDS,
2116
+ 'overridden_structured_data' => 'on',
2117
+ 'disable_mpn' => 'enable',
2118
  ];
2119
 
2120
  /**
2183
  $data['cache_ttl'] = absint( $args['cache_ttl'] ); // cache ttl can be zero.
2184
  unset( $args['cache_ttl'] );
2185
  }
2186
+ if ( array_key_exists( 'overridden_structured_data', $args ) ) {
2187
+ $data['overridden_structured_data'] = strtolower( $args['overridden_structured_data'] );
2188
+ if ( ! in_array( $data['overridden_structured_data'], array( 'on', 'off' ) ) ) {
2189
+ $data['overridden_structured_data'] = in_array( $_data['overridden_structured_data'], array( 'on', 'off' ) ) ? $_data['overridden_structured_data'] : $defaults['overridden_structured_data'];
2190
+ }
2191
+ unset( $args['overridden_structured_data'] );
2192
+ }
2193
+ if ( array_key_exists( 'disable_mpn', $args ) ) {
2194
+ $data['disable_mpn'] = strtolower( $args['disable_mpn'] );
2195
+ if ( ! in_array( $data['disable_mpn'], array( 'enable', 'disable' ) ) ) {
2196
+ $data['disable_mpn'] = in_array( $_data['disable_mpn'], array( 'enable', 'disable' ) ) ? $_data['disable_mpn'] : $defaults['disable_mpn'];
2197
+ }
2198
+ unset( $args['disable_mpn'] );
2199
+ }
2200
  if ( ! empty( $args ) ) {
2201
  foreach ( $args as $key => $value ) {
2202
  if ( has_filter( "woo_feed_save_{$key}_option" ) ) {
3050
  return NULL ;
3051
  }
3052
  }
3053
+ if ( ! function_exists( 'woo_feed_brand_taxonomy' )) {
3054
+ /**
3055
+ * Custom Taxonomy for WooCommerce Product.
3056
+ *
3057
+ * @since 4.3.6
3058
+ */
3059
+ function woo_feed_brand_taxonomy() {
3060
+ $labels = array(
3061
+ 'name' => 'Brands',
3062
+ 'singular_name' => 'Brand',
3063
+ 'menu_name' => 'Brands',
3064
+ 'all_items' => 'All Brands',
3065
+ 'parent_item' => 'Parent Brand',
3066
+ 'parent_item_colon' => 'Parent Brand:',
3067
+ 'new_item_name' => 'New Brand Name',
3068
+ 'add_new_item' => 'Add New Brand',
3069
+ 'edit_item' => 'Edit Brand',
3070
+ 'update_item' => 'Update Brand',
3071
+ 'separate_items_with_commas' => 'Separate Brand with commas',
3072
+ 'search_items' => 'Search Brands',
3073
+ 'add_or_remove_items' => 'Add or remove Brands',
3074
+ 'choose_from_most_used' => 'Choose from the most used Brands',
3075
+ );
3076
+ $args = array(
3077
+ 'labels' => $labels,
3078
+ 'hierarchical' => true,
3079
+ 'public' => true,
3080
+ 'show_ui' => true,
3081
+ 'show_admin_column' => true,
3082
+ 'show_in_rest' => true,
3083
+ 'show_in_nav_menus' => true,
3084
+ 'show_tagcloud' => true,
3085
+ );
3086
+ register_taxonomy( 'woo-feed-brand', 'product', $args );
3087
+ }
3088
+ add_action( 'init', 'woo_feed_brand_taxonomy', 0 );
3089
+ }
3090
+
3091
+ if (! function_exists( 'woo_feed_brand_term_radio_checklist' )) {
3092
+
3093
+ /**
3094
+ * Use radio inputs product brand taxonomies
3095
+ *
3096
+ * @param $args
3097
+ * @return mixed
3098
+ */
3099
+ function woo_feed_brand_term_radio_checklist( $args ) {
3100
+ if ( ! empty( $args['taxonomy'] ) && $args['taxonomy'] === 'woo-feed-brand' ) {
3101
+ if ( empty( $args['walker'] ) || is_a( $args['walker'], 'Walker' ) ) {
3102
+ if ( ! class_exists( 'Woo_Feed_Brand_Walker_Category_Radio_Checklist' ) ) {
3103
+ /**
3104
+ * Custom walker for switching checkbox inputs to radio.
3105
+ *
3106
+ * @see Walker_Category_Checklist
3107
+ */
3108
+ class Woo_Feed_Brand_Walker_Category_Radio_Checklist extends Walker_Category_Checklist {
3109
+ function walk( $elements, $max_depth, ...$args ) {
3110
+ $output = parent::walk( $elements, $max_depth, ...$args );
3111
+ $output = str_replace(
3112
+ array( 'type="checkbox"', "type='checkbox'" ),
3113
+ array( 'type="radio"', "type='radio'" ),
3114
+ $output
3115
+ );
3116
+
3117
+ return $output;
3118
+ }
3119
+ }
3120
+ }
3121
+ $args['walker'] = new Woo_Feed_Brand_Walker_Category_Radio_Checklist;
3122
+ }
3123
+ }
3124
+ return $args;
3125
+ }
3126
+ add_filter( 'wp_terms_checklist_args', 'woo_feed_brand_term_radio_checklist' );
3127
+ }
3128
+
3129
+ if ( ! function_exists( 'woo_feed_product_structured_data' )) {
3130
+
3131
+ $settings = woo_feed_get_options( 'all' );
3132
+ $overridden_structured_data = $settings['overridden_structured_data'];
3133
+
3134
+
3135
+ if ( $overridden_structured_data == "on" ) {
3136
+
3137
+ /**
3138
+ * Removed woocommerce default schema structure
3139
+ *
3140
+ * @param $markup
3141
+ * @param $product
3142
+ *
3143
+ * @since 4.3.6
3144
+ * @return false
3145
+ */
3146
+ function woo_feed_filter_woocommerce_structured_data_product( $markup, $product ) {
3147
+ return false;
3148
+ }
3149
+
3150
+ add_filter( 'woocommerce_structured_data_product', 'woo_feed_filter_woocommerce_structured_data_product', 10, 2 );
3151
+
3152
+
3153
+ /**
3154
+ * Product Structured data
3155
+ */
3156
+ function woo_feed_product_structured_data() {
3157
+ global $post;
3158
+ $product = wc_get_product( $post->ID );
3159
+
3160
+ if ( ! is_object( $product ) ) {
3161
+ global $product;
3162
+ }
3163
+
3164
+ if ( ! is_a( $product, 'WC_Product' ) || ! is_product() ) {
3165
+ return;
3166
+ }
3167
+
3168
+ $shop_name = get_bloginfo( 'name' );
3169
+ $shop_url = home_url();
3170
+ $currency = get_woocommerce_currency();
3171
+ $permalink = get_permalink( $product->get_id() );
3172
+ $image = wp_get_attachment_url( $product->get_image_id() );
3173
+ $mpn = $product->get_meta( 'woo_feed_mpn' );
3174
+ $brand_term = wp_get_post_terms( $post->ID, 'woo-feed-brand', array( 'fields' => 'names' ) );
3175
+ $settings = woo_feed_get_options( 'all' );
3176
+ $disable_mpn = $settings['disable_mpn'];
3177
+
3178
+ $markup = array(
3179
+ '@context' => 'https://schema.org',
3180
+ '@type' => 'Product',
3181
+ '@id' => $permalink . '#product',
3182
+ // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist.
3183
+ 'name' => $product->get_name(),
3184
+ 'url' => $permalink,
3185
+ 'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) ),
3186
+ );
3187
+ if ( $image ) {
3188
+ $markup['image'] = $image;
3189
+ }
3190
+ // Declare SKU or fallback to ID.
3191
+ if ( $product->get_sku() ) {
3192
+ $markup['sku'] = $product->get_sku();
3193
+ } else {
3194
+ $markup['sku'] = $product->get_id();
3195
+ }
3196
+ if ( '' !== $product->get_price() ) {
3197
+ // Assume prices will be valid until the end of next year, unless on sale and there is an end date.
3198
+ $price_valid_until = gmdate( 'Y-12-31', time() + YEAR_IN_SECONDS );
3199
+ if ( $product->is_type( 'variable' ) ) {
3200
+ $lowest = $product->get_variation_price( 'min', false );
3201
+ $highest = $product->get_variation_price( 'max', false );
3202
+ if ( $lowest === $highest ) {
3203
+ $markup_offer = array(
3204
+ '@type' => 'Offer',
3205
+ 'price' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3206
+ 'priceValidUntil' => $price_valid_until,
3207
+ 'priceSpecification' => array(
3208
+ 'price' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3209
+ 'priceCurrency' => $currency,
3210
+ 'valueAddedTaxIncluded' => wc_prices_include_tax() ? 'true' : 'false',
3211
+ ),
3212
+ );
3213
+ } else {
3214
+ $markup_offer = array(
3215
+ '@type' => 'AggregateOffer',
3216
+ 'lowPrice' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3217
+ 'highPrice' => wc_format_decimal( $highest, wc_get_price_decimals() ),
3218
+ 'offerCount' => count( $product->get_children() ),
3219
+ );
3220
+ }
3221
+ } else {
3222
+ if ( $product->is_on_sale() && $product->get_date_on_sale_to() ) {
3223
+ $price_valid_until = gmdate( 'Y-m-d', $product->get_date_on_sale_to()->getTimestamp() );
3224
+ }
3225
+ $markup_offer = array(
3226
+ '@type' => 'Offer',
3227
+ 'price' => wc_format_decimal( $product->get_price(), wc_get_price_decimals() ),
3228
+ 'priceValidUntil' => $price_valid_until,
3229
+ 'priceSpecification' => array(
3230
+ 'price' => wc_format_decimal( $product->get_price(), wc_get_price_decimals() ),
3231
+ 'priceCurrency' => $currency,
3232
+ 'valueAddedTaxIncluded' => wc_prices_include_tax() ? 'true' : 'false',
3233
+ ),
3234
+ );
3235
+ }
3236
+ $markup_offer += array(
3237
+ 'priceCurrency' => $currency,
3238
+ 'availability' => 'http://schema.org/' . ( $product->is_in_stock() ? 'InStock' : 'OutOfStock' ),
3239
+ 'url' => $permalink,
3240
+ 'seller' => array(
3241
+ '@type' => 'Organization',
3242
+ 'name' => $shop_name,
3243
+ 'url' => $shop_url,
3244
+ ),
3245
+ );
3246
+ $markup['offers'] = array( apply_filters( 'woocommerce_structured_data_product_offer', $markup_offer, $product ) );
3247
+ }
3248
+ if ( $product->get_rating_count() && wc_review_ratings_enabled() ) {
3249
+ $markup['aggregateRating'] = array(
3250
+ '@type' => 'AggregateRating',
3251
+ 'ratingValue' => $product->get_average_rating(),
3252
+ 'reviewCount' => $product->get_review_count(),
3253
+ );
3254
+ // Markup 5 most recent rating/review.
3255
+ $comments = get_comments(
3256
+ array(
3257
+ 'number' => 5,
3258
+ 'post_id' => $product->get_id(),
3259
+ 'status' => 'approve',
3260
+ 'post_status' => 'publish',
3261
+ 'post_type' => 'product',
3262
+ 'parent' => 0,
3263
+ 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
3264
+ array(
3265
+ 'key' => 'rating',
3266
+ 'type' => 'NUMERIC',
3267
+ 'compare' => '>',
3268
+ 'value' => 0,
3269
+ ),
3270
+ ),
3271
+ )
3272
+ );
3273
+ if ( $comments ) {
3274
+ $markup['review'] = array();
3275
+ foreach ( $comments as $comment ) {
3276
+ $markup['review'][] = array(
3277
+ '@type' => 'Review',
3278
+ 'reviewRating' => array(
3279
+ '@type' => 'Rating',
3280
+ 'bestRating' => '5',
3281
+ 'ratingValue' => get_comment_meta( $comment->comment_ID, 'rating', true ),
3282
+ 'worstRating' => '1',
3283
+ ),
3284
+ 'author' => array(
3285
+ '@type' => 'Person',
3286
+ 'name' => get_comment_author( $comment ),
3287
+ ),
3288
+ 'reviewBody' => get_comment_text( $comment ),
3289
+ 'datePublished' => get_comment_date( 'c', $comment ),
3290
+ );
3291
+ }
3292
+ }
3293
+ }
3294
+ // Check we have required data.
3295
+ if ( empty( $markup['aggregateRating'] ) && empty( $markup['offers'] ) && empty( $markup['review'] ) ) {
3296
+ return;
3297
+ }
3298
+ if ($disable_mpn == 'enable') {
3299
+ if ( ! empty( $mpn ) ) {
3300
+ $markup['mpn'] = $mpn;
3301
+ }
3302
+ if ( !empty( $brand_term )){
3303
+ $markup['brand'] = $brand_term[0];
3304
+ }
3305
+ }
3306
+ echo '<script type="application/ld+json">' . json_encode( $markup, JSON_UNESCAPED_SLASHES ) . '</script>'; //encode schema for job posting
3307
+
3308
+ }
3309
+
3310
+ add_action( 'wp_head', 'woo_feed_product_structured_data' );
3311
+ }
3312
+ }
3313
 
3314
  // End of file helper.php.
woo-feed.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: WooCommerce Product 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.5
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.5' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
@@ -849,10 +849,12 @@ if ( ! function_exists( 'woo_feed_config_feed' ) ) {
849
  check_admin_referer( 'woo-feed-config' );
850
 
851
  $data = [
852
- 'per_batch' => isset( $_POST['batch_limit'] ) ? absint( $_POST['batch_limit'] ) : '',
853
- 'product_query_type' => isset( $_POST['product_query_type'] ) ? sanitize_text_field( wp_unslash( $_POST['product_query_type'] ) ) : '',
854
- 'enable_error_debugging' => isset( $_POST['enable_error_debugging'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_error_debugging'] ) ) : '',
855
- 'cache_ttl' => isset( $_POST['cache_ttl'] ) ? absint( $_POST['cache_ttl'] ) : '',
 
 
856
  ];
857
 
858
  woo_feed_save_options( $data );
10
  * Plugin Name: WooCommerce Product 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.6
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.6' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
849
  check_admin_referer( 'woo-feed-config' );
850
 
851
  $data = [
852
+ 'per_batch' => isset( $_POST['batch_limit'] ) ? absint( $_POST['batch_limit'] ) : '',
853
+ 'product_query_type' => isset( $_POST['product_query_type'] ) ? sanitize_text_field( wp_unslash( $_POST['product_query_type'] ) ) : '',
854
+ 'enable_error_debugging' => isset( $_POST['enable_error_debugging'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_error_debugging'] ) ) : '',
855
+ 'cache_ttl' => isset( $_POST['cache_ttl'] ) ? absint( $_POST['cache_ttl'] ) : '',
856
+ 'overridden_structured_data' => isset( $_POST['overridden_structured_data'] ) ? sanitize_text_field( $_POST['overridden_structured_data'] ) : '',
857
+ 'disable_mpn' => isset( $_POST['disable_mpn'] ) ? sanitize_text_field( $_POST['disable_mpn'] ) : '',
858
  ];
859
 
860
  woo_feed_save_options( $data );