Version Description
(2020-12-13) = * Tweak : Canonical link as default attribute for google.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 4.3.5 |
Comparing to | |
See all releases |
Code changes from version 4.3.4 to 4.3.5
- README.txt +4 -1
- includes/classes/class-woo-feed-products-v3.php +53 -21
- includes/feeds/merchant_templates.php +8 -8
- woo-feed.php +2 -2
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.
|
12 |
License: GPLv2 or later
|
13 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
14 |
|
@@ -308,6 +308,9 @@ Using pro version:
|
|
308 |
|
309 |
== Changelog ==
|
310 |
|
|
|
|
|
|
|
311 |
= 4.3.4 (2020-12-10) =
|
312 |
* Fix : Variation products attribute as parent not coming solved.
|
313 |
* Tweak : Switch and update buttons new look.
|
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 |
|
309 |
== Changelog ==
|
310 |
|
311 |
+
= 4.3.5 (2020-12-13) =
|
312 |
+
* Tweak : Canonical link as default attribute for google.
|
313 |
+
|
314 |
= 4.3.4 (2020-12-10) =
|
315 |
* Fix : Variation products attribute as parent not coming solved.
|
316 |
* Tweak : Switch and update buttons new look.
|
includes/classes/class-woo-feed-products-v3.php
CHANGED
@@ -819,15 +819,18 @@ class Woo_Feed_Products_v3
|
|
819 |
|
820 |
if ( 'google' == $this->config['provider'] ) {
|
821 |
|
822 |
-
// Reformat Shipping attributes for
|
823 |
$t = 0;
|
824 |
$tax = '';
|
825 |
-
$s = 0;
|
826 |
$shipping = '';
|
827 |
-
$sub = 0;
|
828 |
$subscription = '';
|
|
|
|
|
829 |
$product_detail = '';
|
830 |
$pd = 0;
|
|
|
831 |
if ( 'xml' == $this->config['feedType'] ) {
|
832 |
foreach ( $merchantAttributes as $key => $value ) {
|
833 |
|
@@ -838,20 +841,19 @@ class Woo_Feed_Products_v3
|
|
838 |
$prefix = $this->config['prefix'][ $key ];
|
839 |
$suffix = $this->config['suffix'][ $key ];
|
840 |
|
|
|
|
|
|
|
841 |
if ( 'pattern' == $this->config['type'][ $key ] ) {
|
842 |
$output = $this->config['default'][ $key ];
|
|
|
843 |
} else { // Get Pattern value.
|
844 |
-
$attribute = $this->config['attributes'][ $key ];
|
845 |
-
$merchant_attribute = $this->config['mattributes'][ $key ];
|
846 |
$output = $this->getAttributeValueByType($productObj, $attribute, $merchant_attribute);
|
847 |
}
|
848 |
|
849 |
-
|
850 |
-
$suffix = '' . $suffix;
|
851 |
-
}
|
852 |
-
|
853 |
|
854 |
-
$output
|
855 |
|
856 |
if ( 'shipping_country' == $value ) {
|
857 |
if ( 0 == $s ) {
|
@@ -894,7 +896,7 @@ class Woo_Feed_Products_v3
|
|
894 |
$tax .= '<g:rate>' . $output . '</g:rate>' . "\n";
|
895 |
} elseif ( 'tax_ship' == $value ) {
|
896 |
$tax .= '<g:tax_ship>' . $output . '</g:tax_ship>' . "\n";
|
897 |
-
}elseif ( 'subscription_period'
|
898 |
if ( 0 == $sub ) {
|
899 |
$subscription .= '<g:subscription_cost>';
|
900 |
$sub = 1;
|
@@ -932,6 +934,19 @@ class Woo_Feed_Products_v3
|
|
932 |
}elseif ( 'attribute_value' == $value ) {
|
933 |
$product_detail .= '<g:attribute_value>' . $output . '</g:attribute_value>' . "\n";
|
934 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
935 |
}
|
936 |
|
937 |
if ( 1 == $pd ) {
|
@@ -949,10 +964,16 @@ class Woo_Feed_Products_v3
|
|
949 |
$subscription .= '</g:subscription_cost>';
|
950 |
}
|
951 |
|
|
|
|
|
|
|
|
|
952 |
$this->feedBody .= $shipping;
|
953 |
$this->feedBody .= $tax;
|
954 |
$this->feedBody .= $product_detail;
|
|
|
955 |
|
|
|
956 |
if ( $productObj->is_type('subscription') ||
|
957 |
$productObj->is_type('variable-subscription') ||
|
958 |
$productObj->is_type('subscription_variation') ) {
|
@@ -1281,6 +1302,22 @@ class Woo_Feed_Products_v3
|
|
1281 |
$output = wp_json_encode($output);
|
1282 |
}
|
1283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1284 |
/**
|
1285 |
* Filter attribute value
|
1286 |
*
|
@@ -1320,6 +1357,8 @@ class Woo_Feed_Products_v3
|
|
1320 |
return $output;
|
1321 |
}
|
1322 |
|
|
|
|
|
1323 |
/**
|
1324 |
* Get Product Id
|
1325 |
*
|
@@ -2929,18 +2968,11 @@ class Woo_Feed_Products_v3
|
|
2929 |
$output = "$prefix" . $output;
|
2930 |
}
|
2931 |
|
|
|
|
|
2932 |
// Add Suffix after Output
|
2933 |
if ( '' !== $suffix ) {
|
2934 |
-
if (
|
2935 |
-
'price' == $attribute
|
2936 |
-
|| 'sale_price' == $attribute
|
2937 |
-
|| 'current_price' == $attribute
|
2938 |
-
|| 'price_with_tax' == $attribute
|
2939 |
-
|| 'current_price_with_tax' == $attribute
|
2940 |
-
|| 'sale_price_with_tax' == $attribute
|
2941 |
-
|| 'shipping_price' == $attribute
|
2942 |
-
|| 'tax_rate' == $attribute
|
2943 |
-
) { // Add space before suffix if attribute contain price.
|
2944 |
$output = $output . ' ' . $suffix;
|
2945 |
} elseif ( substr($output, 0, 4) === 'http' ) {
|
2946 |
// Parse URL Parameters if available into suffix field
|
819 |
|
820 |
if ( 'google' == $this->config['provider'] ) {
|
821 |
|
822 |
+
// Reformat Shipping attributes for Google, Facebook
|
823 |
$t = 0;
|
824 |
$tax = '';
|
825 |
+
$s = 0; // Shipping
|
826 |
$shipping = '';
|
827 |
+
$sub = 0; // Subscription Index
|
828 |
$subscription = '';
|
829 |
+
$ins = 0; // Installment Index
|
830 |
+
$installment="";
|
831 |
$product_detail = '';
|
832 |
$pd = 0;
|
833 |
+
|
834 |
if ( 'xml' == $this->config['feedType'] ) {
|
835 |
foreach ( $merchantAttributes as $key => $value ) {
|
836 |
|
841 |
$prefix = $this->config['prefix'][ $key ];
|
842 |
$suffix = $this->config['suffix'][ $key ];
|
843 |
|
844 |
+
$attribute = $this->config['attributes'][ $key ];
|
845 |
+
$merchant_attribute = $this->config['mattributes'][ $key ];
|
846 |
+
|
847 |
if ( 'pattern' == $this->config['type'][ $key ] ) {
|
848 |
$output = $this->config['default'][ $key ];
|
849 |
+
$output=$this->apply_filters_to_attribute_value($output,$productObj,$attribute,$merchant_attribute);
|
850 |
} else { // Get Pattern value.
|
|
|
|
|
851 |
$output = $this->getAttributeValueByType($productObj, $attribute, $merchant_attribute);
|
852 |
}
|
853 |
|
854 |
+
$output=$this->format_output($output,$this->config['output_type'],$productObj,$attribute,$merchant_attribute);
|
|
|
|
|
|
|
855 |
|
856 |
+
$output=$this->process_prefix_suffix( $output, $prefix, $suffix, $attribute = '' );
|
857 |
|
858 |
if ( 'shipping_country' == $value ) {
|
859 |
if ( 0 == $s ) {
|
896 |
$tax .= '<g:rate>' . $output . '</g:rate>' . "\n";
|
897 |
} elseif ( 'tax_ship' == $value ) {
|
898 |
$tax .= '<g:tax_ship>' . $output . '</g:tax_ship>' . "\n";
|
899 |
+
}elseif ( 'subscription_period' === $value ) {
|
900 |
if ( 0 == $sub ) {
|
901 |
$subscription .= '<g:subscription_cost>';
|
902 |
$sub = 1;
|
934 |
}elseif ( 'attribute_value' == $value ) {
|
935 |
$product_detail .= '<g:attribute_value>' . $output . '</g:attribute_value>' . "\n";
|
936 |
}
|
937 |
+
|
938 |
+
if ( 'installment_months' === $value ) {
|
939 |
+
if ( 0 == $ins ) {
|
940 |
+
$installment .= '<g:installment>';
|
941 |
+
$ins = 1;
|
942 |
+
} else {
|
943 |
+
$installment .= '</g:installment>' . "\n";
|
944 |
+
$installment .= '<g:installment>';
|
945 |
+
}
|
946 |
+
$installment .= '<g:months>' . $output . '</g:months>' . "\n";
|
947 |
+
}elseif ( 'installment_amount' == $value ) {
|
948 |
+
$installment .= '<g:amount>' . $output . '</g:amount>' . "\n";
|
949 |
+
}
|
950 |
}
|
951 |
|
952 |
if ( 1 == $pd ) {
|
964 |
$subscription .= '</g:subscription_cost>';
|
965 |
}
|
966 |
|
967 |
+
if ( 1 == $ins ) {
|
968 |
+
$installment .= '</g:installment>';
|
969 |
+
}
|
970 |
+
|
971 |
$this->feedBody .= $shipping;
|
972 |
$this->feedBody .= $tax;
|
973 |
$this->feedBody .= $product_detail;
|
974 |
+
$this->feedBody .= $installment;
|
975 |
|
976 |
+
// Add subscription attributes only for subscription products.
|
977 |
if ( $productObj->is_type('subscription') ||
|
978 |
$productObj->is_type('variable-subscription') ||
|
979 |
$productObj->is_type('subscription_variation') ) {
|
1302 |
$output = wp_json_encode($output);
|
1303 |
}
|
1304 |
|
1305 |
+
$output=$this->apply_filters_to_attribute_value($output, $product, $attribute, $merchant_attribute);
|
1306 |
+
|
1307 |
+
return $output;
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
/**
|
1311 |
+
* Apply Filter to Attribute value
|
1312 |
+
*
|
1313 |
+
* @param $output
|
1314 |
+
* @param $product
|
1315 |
+
* @param $attribute
|
1316 |
+
* @param $merchant_attribute
|
1317 |
+
*
|
1318 |
+
* @return mixed|void
|
1319 |
+
*/
|
1320 |
+
protected function apply_filters_to_attribute_value($output, $product, $attribute, $merchant_attribute){
|
1321 |
/**
|
1322 |
* Filter attribute value
|
1323 |
*
|
1357 |
return $output;
|
1358 |
}
|
1359 |
|
1360 |
+
|
1361 |
+
|
1362 |
/**
|
1363 |
* Get Product Id
|
1364 |
*
|
2968 |
$output = "$prefix" . $output;
|
2969 |
}
|
2970 |
|
2971 |
+
|
2972 |
+
|
2973 |
// Add Suffix after Output
|
2974 |
if ( '' !== $suffix ) {
|
2975 |
+
if (array_key_exists(trim($suffix),get_woocommerce_currencies())) { // Add space before suffix if attribute contain price.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2976 |
$output = $output . ' ' . $suffix;
|
2977 |
} elseif ( substr($output, 0, 4) === 'http' ) {
|
2978 |
// Parse URL Parameters if available into suffix field
|
includes/feeds/merchant_templates.php
CHANGED
@@ -50,14 +50,14 @@ return array(
|
|
50 |
'limit' => array( '', '', '', '', '', '', '', '' ),
|
51 |
),
|
52 |
'google' => array(
|
53 |
-
'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'current_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'sku', 'brand' ),
|
54 |
-
'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
|
55 |
-
'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern'),
|
56 |
-
'attributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', '', 'image', 'condition', 'availability', 'price', 'current_price', 'sku', '' ),
|
57 |
-
'default' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', $this->brand_pattern, '' ),
|
58 |
-
'suffix' => array( '', '', '', '', '', '', '', '', '', '', ' ' . $this->currency, ' ' . $this->currency , '', ''),
|
59 |
-
'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '6', '6', '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', ),
|
50 |
'limit' => array( '', '', '', '', '', '', '', '' ),
|
51 |
),
|
52 |
'google' => array(
|
53 |
+
'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'current_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'sku', 'brand', 'canonical_link' ),
|
54 |
+
'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
|
55 |
+
'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute'),
|
56 |
+
'attributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', '', 'image', 'condition', 'availability', 'price', 'current_price', 'sku', '', 'canonical_link' ),
|
57 |
+
'default' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', $this->brand_pattern, '', '' ),
|
58 |
+
'suffix' => array( '', '', '', '', '', '', '', '', '', '', ' ' . $this->currency, ' ' . $this->currency , '', '', ''),
|
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', ),
|
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.
|
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.
|
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.5
|
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.5' );
|
42 |
}
|
43 |
|
44 |
if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
|