-
Notifications
You must be signed in to change notification settings - Fork 0
/
webappick-product-feed-for-woocommerce-pro.0002.fix.php-warnings-feed-generation.patch
62 lines (57 loc) · 2.89 KB
/
webappick-product-feed-for-woocommerce-pro.0002.fix.php-warnings-feed-generation.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 7ba049d7af197d7f9287cc26fa1064076904c8b8 Mon Sep 17 00:00:00 2001
From: Nabi <[email protected]>
Date: Mon, 19 Jun 2023 12:12:02 +0330
Subject: [PATCH] Fixed PHP warnings reported during product feed generation.
---
.../includes/classes/class-woo-feed-products-v3.php | 4 ++--
.../includes/helper.php | 14 ++++++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/libs/webappick-product-feed-for-woocommerce/includes/classes/class-woo-feed-products-v3.php b/libs/webappick-product-feed-for-woocommerce/includes/classes/class-woo-feed-products-v3.php
index 1e29fba3..be735c6e 100755
--- a/libs/webappick-product-feed-for-woocommerce/includes/classes/class-woo-feed-products-v3.php
+++ b/libs/webappick-product-feed-for-woocommerce/includes/classes/class-woo-feed-products-v3.php
@@ -2537,10 +2537,10 @@ class Woo_Feed_Products_v3 {
// Variation product type
if ( has_post_thumbnail( $product->get_id() ) ) {
$getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $product->get_id() ), 'single-post-thumbnail' );
- $image = woo_feed_get_formatted_url( $getImage[0] );
+ $image = isset( $getImage[0] ) ? woo_feed_get_formatted_url( $getImage[0] ) : '';
} elseif ( has_post_thumbnail( $product->get_parent_id() ) ) {
$getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $product->get_parent_id() ), 'single-post-thumbnail' );
- $image = woo_feed_get_formatted_url( $getImage[0] );
+ $image = isset( $getImage[0] ) ? woo_feed_get_formatted_url( $getImage[0] ) : '';
}
} elseif ( has_post_thumbnail( $product->get_id() ) ) { // All product type except variation
$getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $product->get_id() ), 'single-post-thumbnail' );
diff --git a/libs/webappick-product-feed-for-woocommerce/includes/helper.php b/libs/webappick-product-feed-for-woocommerce/includes/helper.php
index 668d4611..f52ce073 100755
--- a/libs/webappick-product-feed-for-woocommerce/includes/helper.php
+++ b/libs/webappick-product-feed-for-woocommerce/includes/helper.php
@@ -2075,7 +2075,12 @@ if ( ! function_exists( 'woo_feed_parse_string' ) ) {
// loop through each pair
foreach ( $pairs as $i ) {
// split into name and value
- list( $name, $value ) = explode( '=', $i, 2 );
+ if ( strpos( $i, '=' ) !== false ) {
+ list( $name, $value ) = explode( '=', $i, 2 );
+ } else {
+ $name = $i;
+ $value = null;
+ }
// if name already exists
if ( isset( $arr[ $name ] ) ) {
@@ -2091,7 +2096,12 @@ if ( ! function_exists( 'woo_feed_parse_string' ) ) {
}
}
} elseif ( ! empty( $str ) ) {
- list( $name, $value ) = explode( '=', $str, 2 );
+ if ( strpos( $str, '=' ) !== false ) {
+ list( $name, $value ) = explode( '=', $str, 2 );
+ } else {
+ $name = $str;
+ $value = null;
+ }
$arr[ $name ] = $value;
}
--
2.15.0