CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.12

Version Description

(2020-12-24) = * Added: Debug feed file form in status page. * Fixed: Image url fatal error solved. * Fixed: Uncaught WC_Logger class error solved. * Fixed: Fixed product ID error issue.

Download this release

Release Info

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

Code changes from version 4.3.11 to 4.3.12

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.11
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
 
@@ -308,6 +308,12 @@ Using pro version:
308
 
309
  == Changelog ==
310
 
 
 
 
 
 
 
311
  = 4.3.11 (2020-12-23) =
312
  * Added: Google shipping, identifier, tax attribute rule.
313
  * Added: Bing shipping, identifier, tax attribute rule.
8
  Requires at least: 3.6
9
  Tested Up To: 5.6
10
  Requires PHP: 5.6
11
+ Stable tag: 4.3.12
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.12 (2020-12-24) =
312
+ * Added: Debug feed file form in status page.
313
+ * Fixed: Image url fatal error solved.
314
+ * Fixed: Uncaught WC_Logger class error solved.
315
+ * Fixed: Fixed product ID error issue.
316
+
317
  = 4.3.11 (2020-12-23) =
318
  * Added: Google shipping, identifier, tax attribute rule.
319
  * Added: Bing shipping, identifier, tax attribute rule.
admin/partials/woo-feed-status.php CHANGED
@@ -45,8 +45,28 @@
45
  <?php
46
  }
47
  ?>
 
 
 
 
 
 
 
 
 
 
48
  </tbody>
49
  </table>
50
  </div>
 
 
 
 
 
 
 
 
 
 
51
  </div>
52
  </div>
45
  <?php
46
  }
47
  ?>
48
+ <tr>
49
+ <td><?php esc_html_e('Debug Feed File', 'woo-feed'); ?></td>
50
+ <td>
51
+ <form action="" method="post">
52
+ <label for="woo-feed-test-options" style="display: none;">Test Option</label>
53
+ <input type="text" id="woo-feed-test-options" name="woo-feed-test-options" placeholder="option name">
54
+ <input type="submit" name="woo-feed-test-options-submit" value="Test">
55
+ </form>
56
+ </td>
57
+ </tr>
58
  </tbody>
59
  </table>
60
  </div>
61
+ <?php
62
+ if( isset( $_POST['woo-feed-test-options-submit'] ) ) {
63
+ $option_name = sanitize_text_field($_POST['woo-feed-test-options']);
64
+
65
+ $get_option_val = maybe_unserialize(get_option($option_name));
66
+ echo "<pre>";
67
+ print_r($get_option_val);
68
+ echo "</pre>";
69
+ }
70
+ ?>
71
  </div>
72
  </div>
includes/classes/class-woo-feed-products-v3.php CHANGED
@@ -2001,7 +2001,7 @@ class Woo_Feed_Products_v3
2001
  if ( has_post_thumbnail($product->get_id()) ) :
2002
  $getImage = wp_get_attachment_image_src(get_post_thumbnail_id($product->get_id()),
2003
  'single-post-thumbnail');
2004
- $image = woo_feed_get_formatted_url($getImage[0]);
2005
  else :
2006
  $image = woo_feed_get_formatted_url(wp_get_attachment_url($product->get_id()));
2007
  endif;
2001
  if ( has_post_thumbnail($product->get_id()) ) :
2002
  $getImage = wp_get_attachment_image_src(get_post_thumbnail_id($product->get_id()),
2003
  'single-post-thumbnail');
2004
+ $image = isset($getImage[0]) ? woo_feed_get_formatted_url($getImage[0]) : '';
2005
  else :
2006
  $image = woo_feed_get_formatted_url(wp_get_attachment_url($product->get_id()));
2007
  endif;
includes/helper.php CHANGED
@@ -3184,160 +3184,163 @@ if ( ! function_exists( 'woo_feed_product_structured_data' ) ) {
3184
  * Product Structured data
3185
  */
3186
  function woo_feed_product_structured_data() {
3187
- global $post;
3188
- $product = wc_get_product( $post->ID );
3189
 
3190
- if ( ! is_object( $product ) ) {
3191
- global $product;
3192
- }
3193
-
3194
- if ( ! is_a( $product, 'WC_Product' ) || ! is_product() ) {
3195
- return;
3196
- }
3197
-
3198
- $shop_name = get_bloginfo( 'name' );
3199
- $shop_url = home_url();
3200
- $currency = get_woocommerce_currency();
3201
- $permalink = get_permalink( $product->get_id() );
3202
- $image = wp_get_attachment_url( $product->get_image_id() );
3203
- $mpn = $product->get_meta( 'woo_feed_mpn' );
3204
- $brand_term = wp_get_post_terms( $post->ID, 'woo-feed-brand', array( 'fields' => 'names' ) );
3205
- $settings = woo_feed_get_options( 'all' );
3206
- $disable_mpn = $settings['disable_mpn'];
3207
- $disable_brand = $settings['disable_brand'];
3208
-
3209
- $markup = array(
3210
- '@context' => 'https://schema.org',
3211
- '@type' => 'Product',
3212
- '@id' => $permalink . '#product',
3213
- // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist.
3214
- 'name' => $product->get_name(),
3215
- 'url' => $permalink,
3216
- 'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) ),
3217
- );
3218
- if ( $image ) {
3219
- $markup['image'] = $image;
3220
- }
3221
- // Declare SKU or fallback to ID.
3222
- if ( $product->get_sku() ) {
3223
- $markup['sku'] = $product->get_sku();
3224
- } else {
3225
- $markup['sku'] = $product->get_id();
3226
- }
3227
- if ( '' !== $product->get_price() ) {
3228
- // Assume prices will be valid until the end of next year, unless on sale and there is an end date.
3229
- $price_valid_until = gmdate( 'Y-12-31', time() + YEAR_IN_SECONDS );
3230
- if ( $product->is_type( 'variable' ) ) {
3231
- $lowest = $product->get_variation_price( 'min', false );
3232
- $highest = $product->get_variation_price( 'max', false );
3233
- if ( $lowest === $highest ) {
3234
- $markup_offer = array(
3235
- '@type' => 'Offer',
3236
- 'price' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3237
- 'priceValidUntil' => $price_valid_until,
3238
- 'priceSpecification' => array(
3239
- 'price' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3240
- 'priceCurrency' => $currency,
3241
- 'valueAddedTaxIncluded' => wc_prices_include_tax() ? 'true' : 'false',
3242
- ),
3243
- );
3244
- } else {
3245
- $markup_offer = array(
3246
- '@type' => 'AggregateOffer',
3247
- 'lowPrice' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3248
- 'highPrice' => wc_format_decimal( $highest, wc_get_price_decimals() ),
3249
- 'offerCount' => count( $product->get_children() ),
3250
- );
3251
- }
3252
- } else {
3253
- if ( $product->is_on_sale() && $product->get_date_on_sale_to() ) {
3254
- $price_valid_until = gmdate( 'Y-m-d', $product->get_date_on_sale_to()->getTimestamp() );
3255
- }
3256
- $markup_offer = array(
3257
- '@type' => 'Offer',
3258
- 'price' => wc_format_decimal( $product->get_price(), wc_get_price_decimals() ),
3259
- 'priceValidUntil' => $price_valid_until,
3260
- 'priceSpecification' => array(
3261
- 'price' => wc_format_decimal( $product->get_price(), wc_get_price_decimals() ),
3262
- 'priceCurrency' => $currency,
3263
- 'valueAddedTaxIncluded' => wc_prices_include_tax() ? 'true' : 'false',
3264
- ),
3265
- );
3266
- }
3267
- $markup_offer += array(
3268
- 'priceCurrency' => $currency,
3269
- 'availability' => 'http://schema.org/' . ( $product->is_in_stock() ? 'InStock' : 'OutOfStock' ),
3270
- 'url' => $permalink,
3271
- 'seller' => array(
3272
- '@type' => 'Organization',
3273
- 'name' => $shop_name,
3274
- 'url' => $shop_url,
3275
- ),
3276
- );
3277
- $markup['offers'] = array( apply_filters( 'woocommerce_structured_data_product_offer', $markup_offer, $product ) );
3278
- }
3279
- if ( $product->get_rating_count() && wc_review_ratings_enabled() ) {
3280
- $markup['aggregateRating'] = array(
3281
- '@type' => 'AggregateRating',
3282
- 'ratingValue' => $product->get_average_rating(),
3283
- 'reviewCount' => $product->get_review_count(),
3284
- );
3285
- // Markup 5 most recent rating/review.
3286
- $comments = get_comments(
3287
- array(
3288
- 'number' => 5,
3289
- 'post_id' => $product->get_id(),
3290
- 'status' => 'approve',
3291
- 'post_status' => 'publish',
3292
- 'post_type' => 'product',
3293
- 'parent' => 0,
3294
- 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
3295
- array(
3296
- 'key' => 'rating',
3297
- 'type' => 'NUMERIC',
3298
- 'compare' => '>',
3299
- 'value' => 0,
3300
- ),
3301
- ),
3302
- )
3303
- );
3304
- if ( $comments ) {
3305
- $markup['review'] = array();
3306
- foreach ( $comments as $comment ) {
3307
- $markup['review'][] = array(
3308
- '@type' => 'Review',
3309
- 'reviewRating' => array(
3310
- '@type' => 'Rating',
3311
- 'bestRating' => '5',
3312
- 'ratingValue' => get_comment_meta( $comment->comment_ID, 'rating', true ),
3313
- 'worstRating' => '1',
3314
- ),
3315
- 'author' => array(
3316
- '@type' => 'Person',
3317
- 'name' => get_comment_author( $comment ),
3318
- ),
3319
- 'reviewBody' => get_comment_text( $comment ),
3320
- 'datePublished' => get_comment_date( 'c', $comment ),
3321
- );
3322
- }
3323
- }
3324
- }
3325
- // Check we have required data.
3326
- if ( empty( $markup['aggregateRating'] ) && empty( $markup['offers'] ) && empty( $markup['review'] ) ) {
3327
- return;
3328
- }
3329
-
3330
- // Check if we have mpn data.
3331
- if ( $disable_mpn == 'enable' && ! empty( $mpn ) ) {
3332
- $markup['mpn'] = $mpn;
3333
- }
3334
-
3335
- // Check if we have brand data.
3336
- if ( $disable_brand == 'enable' && ! empty( $brand_term ) ) {
3337
- $markup['brand'] = $brand_term[0];
3338
- }
3339
-
3340
- echo '<script type="application/ld+json">' . json_encode( $markup, JSON_UNESCAPED_SLASHES ) . '</script>'; //encode schema for job posting
 
 
 
 
 
3341
 
3342
  }
3343
 
@@ -3365,7 +3368,6 @@ if ( ! function_exists( 'woo_feed_pixel_script' ) ) {
3365
  function woo_feed_pixel_script(){
3366
 
3367
  global $woocommerce, $post, $product;
3368
- $product = wc_get_product( $post->ID );
3369
 
3370
  // Pixel Config.
3371
  $settings = woo_feed_get_options( 'all' );
@@ -3377,6 +3379,7 @@ if ( ! function_exists( 'woo_feed_pixel_script' ) ) {
3377
 
3378
  // Product Tracking
3379
  if ( is_product() ) {
 
3380
 
3381
  $view_type .= "fbq('track', 'ViewContent', {
3382
  content_name: '$post->post_title',
3184
  * Product Structured data
3185
  */
3186
  function woo_feed_product_structured_data() {
 
 
3187
 
3188
+ if (is_product()) {
3189
+ global $post;
3190
+ $product = wc_get_product( $post->ID );
3191
+
3192
+ if ( ! is_object( $product ) ) {
3193
+ global $product;
3194
+ }
3195
+
3196
+ if ( ! is_a( $product, 'WC_Product' ) ) {
3197
+ return;
3198
+ }
3199
+
3200
+ $shop_name = get_bloginfo( 'name' );
3201
+ $shop_url = home_url();
3202
+ $currency = get_woocommerce_currency();
3203
+ $permalink = get_permalink( $product->get_id() );
3204
+ $image = wp_get_attachment_url( $product->get_image_id() );
3205
+ $mpn = $product->get_meta( 'woo_feed_mpn' );
3206
+ $brand_term = wp_get_post_terms( $post->ID, 'woo-feed-brand', array( 'fields' => 'names' ) );
3207
+ $settings = woo_feed_get_options( 'all' );
3208
+ $disable_mpn = $settings['disable_mpn'];
3209
+ $disable_brand = $settings['disable_brand'];
3210
+
3211
+ $markup = array(
3212
+ '@context' => 'https://schema.org',
3213
+ '@type' => 'Product',
3214
+ '@id' => $permalink . '#product',
3215
+ // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist.
3216
+ 'name' => $product->get_name(),
3217
+ 'url' => $permalink,
3218
+ 'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) ),
3219
+ );
3220
+ if ( $image ) {
3221
+ $markup['image'] = $image;
3222
+ }
3223
+ // Declare SKU or fallback to ID.
3224
+ if ( $product->get_sku() ) {
3225
+ $markup['sku'] = $product->get_sku();
3226
+ } else {
3227
+ $markup['sku'] = $product->get_id();
3228
+ }
3229
+ if ( '' !== $product->get_price() ) {
3230
+ // Assume prices will be valid until the end of next year, unless on sale and there is an end date.
3231
+ $price_valid_until = gmdate( 'Y-12-31', time() + YEAR_IN_SECONDS );
3232
+ if ( $product->is_type( 'variable' ) ) {
3233
+ $lowest = $product->get_variation_price( 'min', false );
3234
+ $highest = $product->get_variation_price( 'max', false );
3235
+ if ( $lowest === $highest ) {
3236
+ $markup_offer = array(
3237
+ '@type' => 'Offer',
3238
+ 'price' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3239
+ 'priceValidUntil' => $price_valid_until,
3240
+ 'priceSpecification' => array(
3241
+ 'price' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3242
+ 'priceCurrency' => $currency,
3243
+ 'valueAddedTaxIncluded' => wc_prices_include_tax() ? 'true' : 'false',
3244
+ ),
3245
+ );
3246
+ } else {
3247
+ $markup_offer = array(
3248
+ '@type' => 'AggregateOffer',
3249
+ 'lowPrice' => wc_format_decimal( $lowest, wc_get_price_decimals() ),
3250
+ 'highPrice' => wc_format_decimal( $highest, wc_get_price_decimals() ),
3251
+ 'offerCount' => count( $product->get_children() ),
3252
+ );
3253
+ }
3254
+ } else {
3255
+ if ( $product->is_on_sale() && $product->get_date_on_sale_to() ) {
3256
+ $price_valid_until = gmdate( 'Y-m-d', $product->get_date_on_sale_to()->getTimestamp() );
3257
+ }
3258
+ $markup_offer = array(
3259
+ '@type' => 'Offer',
3260
+ 'price' => wc_format_decimal( $product->get_price(), wc_get_price_decimals() ),
3261
+ 'priceValidUntil' => $price_valid_until,
3262
+ 'priceSpecification' => array(
3263
+ 'price' => wc_format_decimal( $product->get_price(), wc_get_price_decimals() ),
3264
+ 'priceCurrency' => $currency,
3265
+ 'valueAddedTaxIncluded' => wc_prices_include_tax() ? 'true' : 'false',
3266
+ ),
3267
+ );
3268
+ }
3269
+ $markup_offer += array(
3270
+ 'priceCurrency' => $currency,
3271
+ 'availability' => 'http://schema.org/' . ( $product->is_in_stock() ? 'InStock' : 'OutOfStock' ),
3272
+ 'url' => $permalink,
3273
+ 'seller' => array(
3274
+ '@type' => 'Organization',
3275
+ 'name' => $shop_name,
3276
+ 'url' => $shop_url,
3277
+ ),
3278
+ );
3279
+ $markup['offers'] = array( apply_filters( 'woocommerce_structured_data_product_offer', $markup_offer, $product ) );
3280
+ }
3281
+ if ( $product->get_rating_count() && wc_review_ratings_enabled() ) {
3282
+ $markup['aggregateRating'] = array(
3283
+ '@type' => 'AggregateRating',
3284
+ 'ratingValue' => $product->get_average_rating(),
3285
+ 'reviewCount' => $product->get_review_count(),
3286
+ );
3287
+ // Markup 5 most recent rating/review.
3288
+ $comments = get_comments(
3289
+ array(
3290
+ 'number' => 5,
3291
+ 'post_id' => $product->get_id(),
3292
+ 'status' => 'approve',
3293
+ 'post_status' => 'publish',
3294
+ 'post_type' => 'product',
3295
+ 'parent' => 0,
3296
+ 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
3297
+ array(
3298
+ 'key' => 'rating',
3299
+ 'type' => 'NUMERIC',
3300
+ 'compare' => '>',
3301
+ 'value' => 0,
3302
+ ),
3303
+ ),
3304
+ )
3305
+ );
3306
+ if ( $comments ) {
3307
+ $markup['review'] = array();
3308
+ foreach ( $comments as $comment ) {
3309
+ $markup['review'][] = array(
3310
+ '@type' => 'Review',
3311
+ 'reviewRating' => array(
3312
+ '@type' => 'Rating',
3313
+ 'bestRating' => '5',
3314
+ 'ratingValue' => get_comment_meta( $comment->comment_ID, 'rating', true ),
3315
+ 'worstRating' => '1',
3316
+ ),
3317
+ 'author' => array(
3318
+ '@type' => 'Person',
3319
+ 'name' => get_comment_author( $comment ),
3320
+ ),
3321
+ 'reviewBody' => get_comment_text( $comment ),
3322
+ 'datePublished' => get_comment_date( 'c', $comment ),
3323
+ );
3324
+ }
3325
+ }
3326
+ }
3327
+ // Check we have required data.
3328
+ if ( empty( $markup['aggregateRating'] ) && empty( $markup['offers'] ) && empty( $markup['review'] ) ) {
3329
+ return;
3330
+ }
3331
+
3332
+ // Check if we have mpn data.
3333
+ if ( $disable_mpn == 'enable' && ! empty( $mpn ) ) {
3334
+ $markup['mpn'] = $mpn;
3335
+ }
3336
+
3337
+ // Check if we have brand data.
3338
+ if ( $disable_brand == 'enable' && ! empty( $brand_term ) ) {
3339
+ $markup['brand'] = $brand_term[0];
3340
+ }
3341
+
3342
+ echo '<script type="application/ld+json">' . json_encode( $markup, JSON_UNESCAPED_SLASHES ) . '</script>'; //encode schema for job posting
3343
+ }
3344
 
3345
  }
3346
 
3368
  function woo_feed_pixel_script(){
3369
 
3370
  global $woocommerce, $post, $product;
 
3371
 
3372
  // Pixel Config.
3373
  $settings = woo_feed_get_options( 'all' );
3379
 
3380
  // Product Tracking
3381
  if ( is_product() ) {
3382
+ $product = wc_get_product( $post->ID );
3383
 
3384
  $view_type .= "fbq('track', 'ViewContent', {
3385
  content_name: '$post->post_title',
includes/log-helper.php CHANGED
@@ -35,6 +35,11 @@ if ( ! function_exists( 'woo_feed_get_logger' ) ) {
35
  if ( null !== $logger && is_a( $logger, 'WC_Logger' ) ) {
36
  return $logger;
37
  }
 
 
 
 
 
38
  $logger = new WC_Logger( [ new Woo_Feed_Log_Handler_File() ] );
39
 
40
  return $logger;
35
  if ( null !== $logger && is_a( $logger, 'WC_Logger' ) ) {
36
  return $logger;
37
  }
38
+
39
+ if( !class_exists('WC_Logger') ) {
40
+ return $logger;
41
+ }
42
+
43
  $logger = new WC_Logger( [ new Woo_Feed_Log_Handler_File() ] );
44
 
45
  return $logger;
libs/WebAppick/AppServices/Insights.php CHANGED
@@ -402,7 +402,7 @@ class Insights {
402
  */
403
  public function __is_local_server() {
404
  // phpcs:disable
405
- return apply_filters( 'WebAppick_is_local', in_array( $_SERVER['REMOTE_ADDR'], [ '127.0.0.1', '::1' ] ) );
406
  // phpcs:enable
407
  }
408
 
402
  */
403
  public function __is_local_server() {
404
  // phpcs:disable
405
+ return apply_filters( 'WebAppick_is_local', isset( $_SERVER['REMOTE_ADDR'] ) ? in_array( $_SERVER['REMOTE_ADDR'], [ '127.0.0.1', '::1' ] ) : true );
406
  // phpcs:enable
407
  }
408
 
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.11
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.11' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
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.12
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.12' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {