CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.49

Version Description

(2021-03-16) = * Added: Compatibility for WooCommerce Bundled Products by Iconic.

Download this release

Release Info

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

Code changes from version 4.3.48 to 4.3.49

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.6.1
7
  Requires PHP: 5.6
8
- Stable tag: 4.3.48
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -498,6 +498,9 @@ Using pro version:
498
 
499
  == Changelog ==
500
 
 
 
 
501
  = 4.3.48 (2021-03-15) =
502
  * Fixed: PHP 7.4+ compatibility tested.
503
  * Fixed: Temporary codes removed.
5
  Requires at least: 3.6
6
  Tested Up To: 5.6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 4.3.49
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.49 (2021-03-16) =
502
+ * Added: Compatibility for WooCommerce Bundled Products by Iconic.
503
+
504
  = 4.3.48 (2021-03-15) =
505
  * Fixed: PHP 7.4+ compatibility tested.
506
  * Fixed: Temporary codes removed.
includes/classes/class-woo-feed-products-v3.php CHANGED
@@ -2557,6 +2557,10 @@ class Woo_Feed_Products_v3
2557
  $product,
2558
  'price'
2559
  ); // this calls self::price() so no need to use self::getWPMLPrice()
 
 
 
 
2560
  } else {
2561
  $price = $product->get_regular_price();
2562
  }
@@ -2580,7 +2584,11 @@ class Woo_Feed_Products_v3
2580
  $current_price = $this->getGroupProductPrice($product, 'current');
2581
  } elseif ( $product->is_type( 'bundle' ) ) {
2582
  $current_price = $this->getBundleProductPrice( $product, 'price' );
2583
- }else {
 
 
 
 
2584
  $current_price = $product->get_price();
2585
  }
2586
 
@@ -2603,6 +2611,10 @@ class Woo_Feed_Products_v3
2603
  $sale_price = $this->getGroupProductPrice($product, 'sale');
2604
  } elseif ( $product->is_type( 'bundle' ) ) {
2605
  $sale_price = $this->getBundleProductPrice( $product, 'sale_price' );
 
 
 
 
2606
  } else {
2607
  $price = $product->get_sale_price();
2608
 
@@ -2626,6 +2638,8 @@ class Woo_Feed_Products_v3
2626
  $price_with_tax = $this->getVariableProductPrice($product, 'regular_price', true);
2627
  } elseif ( $product->is_type('grouped') ) {
2628
  $price_with_tax = $this->getGroupProductPrice($product, 'regular', true);
 
 
2629
  } else {
2630
  $price = $this->price($product);
2631
 
@@ -2651,6 +2665,8 @@ class Woo_Feed_Products_v3
2651
  $current_price_with_tax = $this->getVariableProductPrice($product, 'current_price', true);
2652
  } elseif ( $product->is_type('grouped') ) {
2653
  $current_price_with_tax = $this->getGroupProductPrice($product, 'current', true);
 
 
2654
  } else {
2655
  $price = $this->current_price($product);
2656
 
@@ -2676,6 +2692,8 @@ class Woo_Feed_Products_v3
2676
  $sale_price_with_tax = $this->getVariableProductPrice($product, 'sale_price', true);
2677
  } elseif ( $product->is_type('grouped') ) {
2678
  $sale_price_with_tax = $this->getGroupProductPrice($product, 'sale', true);
 
 
2679
  } else {
2680
  $price = $this->sale_price($product);
2681
  if ( $product->is_taxable() && ! empty($price) ) {
@@ -2804,6 +2822,77 @@ class Woo_Feed_Products_v3
2804
  }
2805
  }
2806
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2807
  /**
2808
  * Return product price with tax
2809
  *
2557
  $product,
2558
  'price'
2559
  ); // this calls self::price() so no need to use self::getWPMLPrice()
2560
+ } elseif ( $product->is_type( 'bundled' ) ) {
2561
+ // this call when iconic woocommerce product bundled plugin
2562
+ // activated
2563
+ $price = $this->iconic_bundle_product_price( $product, 'iconic-price');
2564
  } else {
2565
  $price = $product->get_regular_price();
2566
  }
2584
  $current_price = $this->getGroupProductPrice($product, 'current');
2585
  } elseif ( $product->is_type( 'bundle' ) ) {
2586
  $current_price = $this->getBundleProductPrice( $product, 'price' );
2587
+ } elseif ( $product->is_type( 'bundled' ) ) {
2588
+ // this call when iconic woocommerce product bundled plugin
2589
+ // activated
2590
+ $price = $this->iconic_bundle_product_price( $product, 'iconic-current-price');
2591
+ } else {
2592
  $current_price = $product->get_price();
2593
  }
2594
 
2611
  $sale_price = $this->getGroupProductPrice($product, 'sale');
2612
  } elseif ( $product->is_type( 'bundle' ) ) {
2613
  $sale_price = $this->getBundleProductPrice( $product, 'sale_price' );
2614
+ } elseif ( $product->is_type( 'bundled' ) ) {
2615
+ // this call when iconic woocommerce product bundled plugin
2616
+ // activated
2617
+ $sale_price = $this->iconic_bundle_product_price( $product, 'iconic-sale-price');
2618
  } else {
2619
  $price = $product->get_sale_price();
2620
 
2638
  $price_with_tax = $this->getVariableProductPrice($product, 'regular_price', true);
2639
  } elseif ( $product->is_type('grouped') ) {
2640
  $price_with_tax = $this->getGroupProductPrice($product, 'regular', true);
2641
+ } elseif ( $product->is_type( 'bundled' ) ) {
2642
+ $price_with_tax = $this->iconic_bundle_product_price( $product, 'iconic-price', true);
2643
  } else {
2644
  $price = $this->price($product);
2645
 
2665
  $current_price_with_tax = $this->getVariableProductPrice($product, 'current_price', true);
2666
  } elseif ( $product->is_type('grouped') ) {
2667
  $current_price_with_tax = $this->getGroupProductPrice($product, 'current', true);
2668
+ } elseif ( $product->is_type( 'bundled' ) ) {
2669
+ $current_price_with_tax = $this->iconic_bundle_product_price( $product, 'iconic-price', true);
2670
  } else {
2671
  $price = $this->current_price($product);
2672
 
2692
  $sale_price_with_tax = $this->getVariableProductPrice($product, 'sale_price', true);
2693
  } elseif ( $product->is_type('grouped') ) {
2694
  $sale_price_with_tax = $this->getGroupProductPrice($product, 'sale', true);
2695
+ } elseif ( $product->is_type( 'bundled' ) ) {
2696
+ $sale_price_with_tax = $this->iconic_bundle_product_price( $product, 'iconic-sale-price', true);
2697
  } else {
2698
  $price = $this->sale_price($product);
2699
  if ( $product->is_taxable() && ! empty($price) ) {
2822
  }
2823
  }
2824
 
2825
+ /**
2826
+ * Get price for Iconic woocommerce-bundled-products
2827
+ *
2828
+ * @param WC_Product $product product object
2829
+ * @param mixed $type
2830
+ * @param bool $tax
2831
+ *
2832
+ * @return mixed $bundle_price
2833
+ */
2834
+ private function iconic_bundle_product_price( $product, $type, $tax = false) {
2835
+ if ( ! class_exists( 'WC_Product_Bundled' ) ) {
2836
+ return $product->get_price();
2837
+ }
2838
+
2839
+ $is_discounted = false;
2840
+ $price = $product->get_price();
2841
+ $bundle = new WC_Product_Bundled( $product->get_id() );
2842
+ $iconic_bundle_product_type = ( ! is_null( $bundle->options['price_display'] ) ) ? $bundle->options['price_display'] : '';
2843
+ $product_ids = $bundle->options['product_ids'];
2844
+
2845
+ //set discount
2846
+ if( ! empty( $bundle->options['fixed_discount'] ) ) {
2847
+ $is_discounted = true;
2848
+ $discount = $bundle->options['fixed_discount'];
2849
+ }else {
2850
+ $is_discounted = false;
2851
+ $discount = 0;
2852
+ }
2853
+
2854
+
2855
+ //get taxable price
2856
+ if( is_array($product_ids) ) {
2857
+ $product_prices = array_map(function($id) use ($tax, $type, $is_discounted, $discount) {
2858
+ $product = wc_get_product($id);
2859
+ $price = $product->get_price();
2860
+ $tax_rate_amount = 0;
2861
+ $tax_rate = WC_Tax::get_rates( $product->get_tax_class() );
2862
+ $tax_rate = reset($tax_rate);
2863
+
2864
+ if( isset($tax_rate) && isset($tax_rate['rate']) ) {
2865
+ $tax_rate_amount = $tax_rate['rate'];
2866
+ }
2867
+
2868
+ //when tax is enable
2869
+ if( $tax ) {
2870
+ $tax_rates_in_percent = $price * ( $tax_rate_amount / 100 );
2871
+ $price = (float) $price + $tax_rates_in_percent;
2872
+ }
2873
+
2874
+ return $price;
2875
+
2876
+ }, $product_ids);
2877
+
2878
+ if( 'range' === $iconic_bundle_product_type ) {
2879
+ $price = min($product_prices);
2880
+ }else {
2881
+ $price = array_sum($product_prices);
2882
+ }
2883
+ }
2884
+
2885
+ //get sale price
2886
+ if( 'iconic-sale-price' === $type ) {
2887
+ if( $is_discounted ) {
2888
+ $price = $price - $discount;
2889
+ }
2890
+ }
2891
+
2892
+ return $this->getWPMLPrice( $product, $price, '_price');
2893
+ }
2894
+
2895
+
2896
  /**
2897
  * Return product price with tax
2898
  *
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.48
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.48' );
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.49
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.49' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {