CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.65

Version Description

(2021-04-12) = * Fixed: Improved performance. * Fixed: Code enhancement and Junk cleaned.

Download this release

Release Info

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

Code changes from version 4.3.64 to 4.3.65

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.7
7
  Requires PHP: 5.6
8
- Stable tag: 4.3.64
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -498,6 +498,10 @@ Using pro version:
498
 
499
  == Changelog ==
500
 
 
 
 
 
501
  = 4.3.64 (2021-04-11) =
502
  * Fixed: Free shipping contains price issue has been solved.
503
 
5
  Requires at least: 3.6
6
  Tested Up To: 5.7
7
  Requires PHP: 5.6
8
+ Stable tag: 4.3.65
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.65 (2021-04-12) =
502
+ * Fixed: Improved performance.
503
+ * Fixed: Code enhancement and Junk cleaned.
504
+
505
  = 4.3.64 (2021-04-11) =
506
  * Fixed: Free shipping contains price issue has been solved.
507
 
admin/partials/woo-feed-content-settings.php CHANGED
@@ -73,7 +73,7 @@ global $feedRules, $wooFeedDropDown, $merchant;
73
  </tr>
74
  <?php
75
  $isItemWrapperHide = 'table-row';
76
- if( isset( $feedRules['feedType'] ) && !empty($feedRules['feedType']) && 'xml' !== $feedRules['feedType'] ) {
77
  $isItemWrapperHide = 'none';
78
  }
79
  ?>
@@ -93,8 +93,8 @@ global $feedRules, $wooFeedDropDown, $merchant;
93
 
94
  <?php
95
  $isDelimiterHide = 'table-row';
96
- if( isset( $feedRules['feedType'] ) ) {
97
- if( empty($feedRules['feedType']) || 'xml' === $feedRules['feedType'] ) {
98
  $isDelimiterHide = 'none';
99
  }
100
  }
73
  </tr>
74
  <?php
75
  $isItemWrapperHide = 'table-row';
76
+ if ( isset( $feedRules['feedType'] ) && ! empty($feedRules['feedType']) && 'xml' !== $feedRules['feedType'] ) {
77
  $isItemWrapperHide = 'none';
78
  }
79
  ?>
93
 
94
  <?php
95
  $isDelimiterHide = 'table-row';
96
+ if ( isset( $feedRules['feedType'] ) ) {
97
+ if ( empty($feedRules['feedType']) || 'xml' === $feedRules['feedType'] ) {
98
  $isDelimiterHide = 'none';
99
  }
100
  }
includes/classes/class-woo-feed-products-v3.php CHANGED
@@ -581,7 +581,7 @@ class Woo_Feed_Products_v3
581
  if ( ! empty( $attributeValue ) ) {
582
  $attributeValue = trim( $attributeValue );
583
 
584
- if('custom'===$this->config['provider']){
585
  $attributeValue = htmlentities( $attributeValue, ENT_XML1 | ENT_QUOTES, 'UTF-8' );
586
  }
587
  }
@@ -2837,7 +2837,7 @@ class Woo_Feed_Products_v3
2837
  *
2838
  * @return mixed $bundle_price
2839
  */
2840
- private function iconic_bundle_product_price( $product, $type, $tax = false) {
2841
  if ( ! class_exists( 'WC_Product_Bundled' ) ) {
2842
  return $product->get_price();
2843
  }
@@ -2849,7 +2849,7 @@ class Woo_Feed_Products_v3
2849
  $product_ids = $bundle->options['product_ids'];
2850
 
2851
  //set discount
2852
- if( ! empty( $bundle->options['fixed_discount'] ) ) {
2853
  $is_discounted = true;
2854
  $discount = $bundle->options['fixed_discount'];
2855
  }else {
@@ -2859,13 +2859,13 @@ class Woo_Feed_Products_v3
2859
 
2860
 
2861
  //get taxable price
2862
- if( is_array($product_ids) ) {
2863
- $product_prices = array_map(function($id) use ($tax, $type, $is_discounted, $discount) {
2864
  $product = wc_get_product($id);
2865
  $price = $product->get_price();
2866
 
2867
  //when tax is enable
2868
- if( $tax ) {
2869
  $price = $this->get_price_with_tax($product, $price);
2870
  }
2871
 
@@ -2873,16 +2873,16 @@ class Woo_Feed_Products_v3
2873
 
2874
  }, $product_ids);
2875
 
2876
- if( 'range' === $iconic_bundle_product_type ) {
2877
  $price = min($product_prices);
2878
  }else {
2879
- $price = array_sum($product_prices);
2880
  }
2881
  }
2882
 
2883
  //get sale price
2884
- if( 'iconic-sale-price' === $type ) {
2885
- if( $is_discounted ) {
2886
  $price = $price - $discount;
2887
  }
2888
  }
581
  if ( ! empty( $attributeValue ) ) {
582
  $attributeValue = trim( $attributeValue );
583
 
584
+ if ( 'custom' === $this->config['provider'] ) {
585
  $attributeValue = htmlentities( $attributeValue, ENT_XML1 | ENT_QUOTES, 'UTF-8' );
586
  }
587
  }
2837
  *
2838
  * @return mixed $bundle_price
2839
  */
2840
+ private function iconic_bundle_product_price( $product, $type, $tax = false ) {
2841
  if ( ! class_exists( 'WC_Product_Bundled' ) ) {
2842
  return $product->get_price();
2843
  }
2849
  $product_ids = $bundle->options['product_ids'];
2850
 
2851
  //set discount
2852
+ if ( ! empty( $bundle->options['fixed_discount'] ) ) {
2853
  $is_discounted = true;
2854
  $discount = $bundle->options['fixed_discount'];
2855
  }else {
2859
 
2860
 
2861
  //get taxable price
2862
+ if ( is_array($product_ids) ) {
2863
+ $product_prices = array_map(function( $id ) use ( $tax, $type, $is_discounted, $discount ) {
2864
  $product = wc_get_product($id);
2865
  $price = $product->get_price();
2866
 
2867
  //when tax is enable
2868
+ if ( $tax ) {
2869
  $price = $this->get_price_with_tax($product, $price);
2870
  }
2871
 
2873
 
2874
  }, $product_ids);
2875
 
2876
+ if ( 'range' === $iconic_bundle_product_type ) {
2877
  $price = min($product_prices);
2878
  }else {
2879
+ $price = array_sum($product_prices);
2880
  }
2881
  }
2882
 
2883
  //get sale price
2884
+ if ( 'iconic-sale-price' === $type ) {
2885
+ if ( $is_discounted ) {
2886
  $price = $price - $discount;
2887
  }
2888
  }
includes/classes/class-woo-feed-shipping.php CHANGED
@@ -213,12 +213,11 @@ class Woo_Feed_Shipping {
213
  }
214
 
215
 
216
- if( 'free_shipping' !== $method->id ) {
217
  $shipping_cost = $this->get_shipping_cost($shipping);
218
  $shipping['price'] = (string) $shipping_cost;
219
- }
220
-
221
- }
222
  $shipping_info[] = $shipping;
223
  }
224
  }
@@ -286,7 +285,7 @@ class Woo_Feed_Shipping {
286
  * @return mixed
287
  */
288
  public function get_lowest_shipping_price() {
289
- if(empty($this->get_shipping())){
290
  return '0';
291
  }
292
 
213
  }
214
 
215
 
216
+ if ( 'free_shipping' !== $method->id ) {
217
  $shipping_cost = $this->get_shipping_cost($shipping);
218
  $shipping['price'] = (string) $shipping_cost;
219
+ }
220
+ }
 
221
  $shipping_info[] = $shipping;
222
  }
223
  }
285
  * @return mixed
286
  */
287
  public function get_lowest_shipping_price() {
288
+ if ( empty($this->get_shipping()) ) {
289
  return '0';
290
  }
291
 
includes/feeds/class-woo-feed-review.php CHANGED
@@ -125,12 +125,12 @@ class Woo_Feed_Review {
125
  */
126
  public function get_products_with_reviews() {
127
  $args = array(
128
- 'post_type' => 'product',
129
- 'fields' => 'ids',
130
- 'status' => 'approve',
131
  'comment_count' => array(
132
- 'value' => 0,
133
- 'compare' => '>',
134
  ),
135
  );
136
 
@@ -142,46 +142,46 @@ class Woo_Feed_Review {
142
  public function sampleData() {
143
  $data = array(
144
  'filetype' => 'xml',
145
- 'reviews' => array(
146
  array(
147
  'review' => array(
148
- 'review_id' => '1',
149
- 'reviewer' => array(
150
  'reviewer_id' => '11',
151
- 'name' => 'Anamul Haque 2',
152
  ),
153
  'reviewer-link' => 'anamulhaque@gmail.com',
154
- 'products' => array(
155
  'product' => array(
156
  array(
157
- 'product-id' => '50',
158
  'product-name' => 'Hoodie with logo',
159
  'product-link' => 'http://www.chaldal.com/hoodie',
160
- )
161
- )
162
- )
163
- )
164
  ),
165
  array(
166
  'review' => array(
167
- 'review_id' => '2',
168
- 'reviewer' => array(
169
  'reviewer_id' => '12',
170
- 'name' => 'Tanvir Hayder',
171
  ),
172
  'reviewer-link' => 'tanvirhayder@gmail.com',
173
- 'products' => array(
174
  'product' => array(
175
  array(
176
- 'product-id' => '10',
177
  'product-name' => 'Beanie',
178
  'product-link' => 'http://www.chaldal.com/beanie',
179
  ),
180
- )
181
- )
182
- )
183
  ),
184
- )
185
  );
186
 
187
  return $data;
@@ -193,7 +193,7 @@ class Woo_Feed_Review {
193
  * @param mixed $config feed configuration
194
  *
195
  */
196
- public function processReviewsData($config) {
197
  $ids = $this->ids;
198
 
199
  $feed = array();
@@ -202,21 +202,21 @@ class Woo_Feed_Review {
202
  $feed['publisher']['name'] = 'CTX Feed – WooCommerce Product Feed Generator by Webappick';
203
  $feed['reviews'] = array();
204
 
205
- if( $ids && is_array($ids) ) {
206
- foreach($ids as $id) {
207
  $product = wc_get_product($id);
208
 
209
  $reviews = get_comments(
210
  array(
211
- 'post_id' => $id,
212
- 'post_type' => 'product'
213
  )
214
  );
215
 
216
  $review = array();
217
 
218
- if( $reviews && is_array($reviews) ) {
219
- foreach($reviews as $single_review) {
220
  $review['review']['review_id'] = $single_review->comment_ID;
221
  $review['review']['reviewer']['name'] = $single_review->comment_author;
222
  $review['review']['reviewer']['reviewer_id'] = $single_review->user_id;
@@ -246,19 +246,18 @@ class Woo_Feed_Review {
246
  //add prefix - suffix to attribute value
247
  $attributeValue = $prefix . $attributeValue . $suffix;
248
 
249
- if( "review_temp_gtin" === $merchant_attribute ) {
250
  $review['review']['products']['product']['product_ids']['gtins']['gtin'] = $attributeValue;
251
- } elseif( "review_temp_mpn" === $merchant_attribute ) {
252
  $review['review']['products']['product']['product_ids']['mpns']['mpn'] = $attributeValue;
253
- } elseif( "review_temp_sku" === $merchant_attribute ) {
254
  $review['review']['products']['product']['product_ids']['skus']['sku'] = $attributeValue;
255
- } elseif( "review_temp_brand" === $merchant_attribute ) {
256
  $review['review']['products']['product']['product_ids']['brands']['brand'] = $attributeValue;
257
  } else {
258
- $review['review']['products']['product'][$merchant_attribute] = $attributeValue;
259
- }
260
-
261
- }
262
 
263
  array_push($feed['reviews'], $review);
264
  }
@@ -276,17 +275,17 @@ class Woo_Feed_Review {
276
  * @param mixed $xml xml object
277
  *
278
  */
279
- function woo_feed_array_to_xml($array, &$xml) {
280
- foreach($array as $key => $value) {
281
- if(is_array($value)) {
282
- if(!is_numeric($key)){
283
  $subnode = $xml->addChild("$key");
284
  $this->woo_feed_array_to_xml($value, $subnode);
285
  } else {
286
  $this->woo_feed_array_to_xml($value, $xml);
287
  }
288
  } else {
289
- if( "overall" === $key ) {
290
  $rating = $xml->addChild($key,"$value");
291
  $rating->addAttribute('min','1');
292
  $rating->addAttribute('max','5');
125
  */
126
  public function get_products_with_reviews() {
127
  $args = array(
128
+ 'post_type' => 'product',
129
+ 'fields' => 'ids',
130
+ 'status' => 'approve',
131
  'comment_count' => array(
132
+ 'value' => 0,
133
+ 'compare' => '>',
134
  ),
135
  );
136
 
142
  public function sampleData() {
143
  $data = array(
144
  'filetype' => 'xml',
145
+ 'reviews' => array(
146
  array(
147
  'review' => array(
148
+ 'review_id' => '1',
149
+ 'reviewer' => array(
150
  'reviewer_id' => '11',
151
+ 'name' => 'Anamul Haque 2',
152
  ),
153
  'reviewer-link' => 'anamulhaque@gmail.com',
154
+ 'products' => array(
155
  'product' => array(
156
  array(
157
+ 'product-id' => '50',
158
  'product-name' => 'Hoodie with logo',
159
  'product-link' => 'http://www.chaldal.com/hoodie',
160
+ ),
161
+ ),
162
+ ),
163
+ ),
164
  ),
165
  array(
166
  'review' => array(
167
+ 'review_id' => '2',
168
+ 'reviewer' => array(
169
  'reviewer_id' => '12',
170
+ 'name' => 'Tanvir Hayder',
171
  ),
172
  'reviewer-link' => 'tanvirhayder@gmail.com',
173
+ 'products' => array(
174
  'product' => array(
175
  array(
176
+ 'product-id' => '10',
177
  'product-name' => 'Beanie',
178
  'product-link' => 'http://www.chaldal.com/beanie',
179
  ),
180
+ ),
181
+ ),
182
+ ),
183
  ),
184
+ ),
185
  );
186
 
187
  return $data;
193
  * @param mixed $config feed configuration
194
  *
195
  */
196
+ public function processReviewsData( $config ) {
197
  $ids = $this->ids;
198
 
199
  $feed = array();
202
  $feed['publisher']['name'] = 'CTX Feed – WooCommerce Product Feed Generator by Webappick';
203
  $feed['reviews'] = array();
204
 
205
+ if ( $ids && is_array($ids) ) {
206
+ foreach ( $ids as $id ) {
207
  $product = wc_get_product($id);
208
 
209
  $reviews = get_comments(
210
  array(
211
+ 'post_id' => $id,
212
+ 'post_type' => 'product',
213
  )
214
  );
215
 
216
  $review = array();
217
 
218
+ if ( $reviews && is_array($reviews) ) {
219
+ foreach ( $reviews as $single_review ) {
220
  $review['review']['review_id'] = $single_review->comment_ID;
221
  $review['review']['reviewer']['name'] = $single_review->comment_author;
222
  $review['review']['reviewer']['reviewer_id'] = $single_review->user_id;
246
  //add prefix - suffix to attribute value
247
  $attributeValue = $prefix . $attributeValue . $suffix;
248
 
249
+ if ( "review_temp_gtin" === $merchant_attribute ) {
250
  $review['review']['products']['product']['product_ids']['gtins']['gtin'] = $attributeValue;
251
+ } elseif ( "review_temp_mpn" === $merchant_attribute ) {
252
  $review['review']['products']['product']['product_ids']['mpns']['mpn'] = $attributeValue;
253
+ } elseif ( "review_temp_sku" === $merchant_attribute ) {
254
  $review['review']['products']['product']['product_ids']['skus']['sku'] = $attributeValue;
255
+ } elseif ( "review_temp_brand" === $merchant_attribute ) {
256
  $review['review']['products']['product']['product_ids']['brands']['brand'] = $attributeValue;
257
  } else {
258
+ $review['review']['products']['product'][ $merchant_attribute ] = $attributeValue;
259
+ }
260
+ }
 
261
 
262
  array_push($feed['reviews'], $review);
263
  }
275
  * @param mixed $xml xml object
276
  *
277
  */
278
+ function woo_feed_array_to_xml( $array, &$xml ) {
279
+ foreach ( $array as $key => $value ) {
280
+ if ( is_array($value) ) {
281
+ if ( ! is_numeric($key) ) {
282
  $subnode = $xml->addChild("$key");
283
  $this->woo_feed_array_to_xml($value, $subnode);
284
  } else {
285
  $this->woo_feed_array_to_xml($value, $xml);
286
  }
287
  } else {
288
+ if ( "overall" === $key ) {
289
  $rating = $xml->addChild($key,"$value");
290
  $rating->addAttribute('min','1');
291
  $rating->addAttribute('max','5');
includes/helper.php CHANGED
@@ -916,11 +916,11 @@ if ( ! function_exists( 'woo_feed_get_csv_delimiters' ) ) {
916
  */
917
  function woo_feed_get_csv_delimiters() {
918
  return [
919
- ',' => 'Comma',
920
- ':' => 'Colon',
921
- ' ' => 'Space',
922
- '|' => 'Pipe',
923
- ';' => 'Semi Colon',
924
  "\t" => 'TAB',
925
  ];
926
  }
@@ -3553,33 +3553,32 @@ if ( ! function_exists('woo_feed_addtocart') ) {
3553
  }
3554
 
3555
  //when redirect to cart page after add to cart
3556
- if( 'yes' === get_option('woocommerce_cart_redirect_after_add') ) {
3557
- if( is_cart() ) {
3558
  global $woocommerce;
3559
 
3560
  //get cart items
3561
  $items = $woocommerce->cart->get_cart();
3562
 
3563
  $ids = array();
3564
- if( $items && is_array($items) ) {
3565
- foreach($items as $item => $values) {
3566
  $_product = wc_get_product( $values['data']->get_id());
3567
  $ids[] = $_product->get_id();
3568
  }
3569
 
3570
- if( !empty($ids) ) {
3571
  //get last product id in cart
3572
  $last_product_id = end($ids);
3573
  $product = wc_get_product( (int) $last_product_id );
3574
  // error_log("last inserted product id is: " . $last_product_id);
3575
  }
3576
- }
3577
-
3578
- }
3579
  }
3580
 
3581
  //create addtocart script
3582
- if ( !empty($product) && $product instanceof WC_Product ) {
3583
  $product_name = $product->get_title();
3584
  $product_id = $product->get_id();
3585
  $product_price = $product->get_price();
@@ -3596,13 +3595,12 @@ if ( ! function_exists('woo_feed_addtocart') ) {
3596
  }
3597
 
3598
  //show addtocart script
3599
- if( is_cart() || is_product() ) {
3600
- if( !empty($view_type) ) {
3601
  echo $view_type;
3602
  }
3603
- }
3604
-
3605
- }
3606
  }
3607
  add_action('wp_head', 'woo_feed_addtocart');
3608
  }
@@ -4315,24 +4313,23 @@ if ( ! function_exists( 'woo_feed_wp_options' ) ) {
4315
  }
4316
  }
4317
 
4318
- if( ! function_exists('woo_feed_get_price_with_tax') ) {
4319
  /**
4320
  * Get price with tax
4321
  *
4322
  * @param WC_Product $product product object
4323
  * @param $price
4324
  */
4325
- function woo_feed_get_price_with_tax($product, $price)
4326
- {
4327
- if (woo_feed_wc_version_check(3.0)) {
4328
- return wc_get_price_including_tax($product, array('price' => $price));
4329
  } else {
4330
  return $product->get_price_including_tax(1, $price);
4331
  }
4332
  }
4333
  }
4334
 
4335
- if( ! function_exists('woo_feed_get_dynamic_discounted_product_price') ) {
4336
 
4337
  /**
4338
  * Get price with dynamic discount
@@ -4343,17 +4340,17 @@ if( ! function_exists('woo_feed_get_dynamic_discounted_product_price') ) {
4343
  * @param bool $tax product taxable or not
4344
  * @return mixed $price
4345
  */
4346
- function woo_feed_get_dynamic_discounted_product_price($price, $product, $config, $tax) {
4347
 
4348
  $discount_plugin_activate = true;
4349
 
4350
  // When discount rules plugin by flycart is activated, bring the discounted price
4351
  if ( is_plugin_active('woo-discount-rules/woo-discount-rules.php') ) {
4352
- if( class_exists('Wdr\App\Controllers\Configuration') ) {
4353
  $config = Wdr\App\Controllers\Configuration::getInstance()->getConfig('calculate_discount_from', 'sale_price');
4354
 
4355
- if( isset($config) && !empty($config) ) {
4356
- if( 'regular_price' === $config ) {
4357
  $price = $product->get_regular_price();
4358
  }else {
4359
  $price = $product->get_sale_price();
@@ -4366,11 +4363,11 @@ if( ! function_exists('woo_feed_get_dynamic_discounted_product_price') ) {
4366
  }
4367
  } elseif ( is_plugin_active('aco-woo-dynamic-pricing/start.php') ) {
4368
  // When dynamic discount pricing plugin by Acowebs is activated, bring the discounted price
4369
- if( class_exists('AWDP_Discount') ) {
4370
- if( ! $tax ) {
4371
  $price = AWDP_Discount::instance()->calculate_discount($product->get_price(), $product);
4372
- if ($product->is_taxable()) {
4373
- if (!wc_prices_include_tax()) {
4374
  $tax_rates = WC_Tax::get_rates($product->get_tax_class());
4375
  $taxes = WC_Tax::calc_tax($product->get_price(), $tax_rates, false);
4376
  $tax_amount = WC_Tax::get_tax_total($taxes);
@@ -4379,47 +4376,45 @@ if( ! function_exists('woo_feed_get_dynamic_discounted_product_price') ) {
4379
  }
4380
  }
4381
  }
4382
- }
4383
-
4384
- } elseif ( is_plugin_active('woo-advanced-discounts/wad.php') ) {
4385
  // When discount plugin by Orion is activated, bring the discounted price
4386
  $discount_amount = 0;
4387
  global $wad_discounts;
4388
- if( isset($wad_discounts["product"]) ) {
4389
- foreach ($wad_discounts["product"] as $discount_id => $discount_obj) {
4390
  if ( $discount_obj->is_applicable( $product->get_id() ) ) {
4391
  $wad_obj = new WAD_Discount($discount_id);
4392
- if( isset($wad_obj->settings) ) {
4393
  $settings = $wad_obj->settings;
4394
  $discount_type = $wad_obj->settings['action'];
4395
- if( false !== strpos($discount_type, 'fixed') ) {
4396
  $discount_amount = $wad_obj->get_discount_amount(floatval($price));
4397
  } elseif ( false !== strpos($discount_type, 'percentage') ) {
4398
  $percentage = $settings['percentage-or-fixed-amount'];
4399
- $discount_amount = floatval($product->get_price()) * ($percentage/100);
4400
  }
4401
- }
4402
-
4403
- }
4404
  }
4405
 
4406
  $price = floatval($product->get_price()) - floatval($discount_amount);
4407
  }
4408
  } elseif ( is_plugin_active('pricing-deals-for-woocommerce/vt-pricing-deals.php') ) {
4409
  // When Pricing Deals for WooCommerce discount plugin by Vark is activated, bring the discounted price
4410
- if( class_exists('VTPRD_Controller') ) {
4411
  global $vtprd_rules_set;
4412
  $vtprd_rules_set = get_option( 'vtprd_rules_set' );
4413
- if( !empty( $vtprd_rules_set) && is_array($vtprd_rules_set) ) {
4414
- foreach( $vtprd_rules_set as $vtprd_rule_set ) {
4415
  $status = $vtprd_rule_set->rule_on_off_sw_select;
4416
- if( 'on' === $status || 'onForever' === $status ) {
4417
  $discount_type = $vtprd_rule_set->rule_deal_info[0]['discount_amt_type'];
4418
  $discount = $vtprd_rule_set->rule_deal_info[0]['discount_amt_count'];
4419
- if( 'currency' === $discount_type || 'fixedPrice'=== $discount_type) {
4420
  $price = $product->get_price() - $discount;
4421
- } elseif( 'percent' === $discount_type ) {
4422
- $price = $product->get_price() - (($product->get_price() * $discount)/100);
4423
  }
4424
  }
4425
  }
@@ -4430,9 +4425,9 @@ if( ! function_exists('woo_feed_get_dynamic_discounted_product_price') ) {
4430
  }
4431
 
4432
  //when any of the discount plugin is activated and tax is enabled calculate the tax
4433
- if( $discount_plugin_activate ) {
4434
  //when tax is enable
4435
- if( $tax ) {
4436
  $price = woo_feed_get_price_with_tax($product, $price);
4437
  }
4438
  }
916
  */
917
  function woo_feed_get_csv_delimiters() {
918
  return [
919
+ ',' => 'Comma',
920
+ ':' => 'Colon',
921
+ ' ' => 'Space',
922
+ '|' => 'Pipe',
923
+ ';' => 'Semi Colon',
924
  "\t" => 'TAB',
925
  ];
926
  }
3553
  }
3554
 
3555
  //when redirect to cart page after add to cart
3556
+ if ( 'yes' === get_option('woocommerce_cart_redirect_after_add') ) {
3557
+ if ( is_cart() ) {
3558
  global $woocommerce;
3559
 
3560
  //get cart items
3561
  $items = $woocommerce->cart->get_cart();
3562
 
3563
  $ids = array();
3564
+ if ( $items && is_array($items) ) {
3565
+ foreach ( $items as $item => $values ) {
3566
  $_product = wc_get_product( $values['data']->get_id());
3567
  $ids[] = $_product->get_id();
3568
  }
3569
 
3570
+ if ( ! empty($ids) ) {
3571
  //get last product id in cart
3572
  $last_product_id = end($ids);
3573
  $product = wc_get_product( (int) $last_product_id );
3574
  // error_log("last inserted product id is: " . $last_product_id);
3575
  }
3576
+ }
3577
+ }
 
3578
  }
3579
 
3580
  //create addtocart script
3581
+ if ( ! empty($product) && $product instanceof WC_Product ) {
3582
  $product_name = $product->get_title();
3583
  $product_id = $product->get_id();
3584
  $product_price = $product->get_price();
3595
  }
3596
 
3597
  //show addtocart script
3598
+ if ( is_cart() || is_product() ) {
3599
+ if ( ! empty($view_type) ) {
3600
  echo $view_type;
3601
  }
3602
+ }
3603
+ }
 
3604
  }
3605
  add_action('wp_head', 'woo_feed_addtocart');
3606
  }
4313
  }
4314
  }
4315
 
4316
+ if ( ! function_exists('woo_feed_get_price_with_tax') ) {
4317
  /**
4318
  * Get price with tax
4319
  *
4320
  * @param WC_Product $product product object
4321
  * @param $price
4322
  */
4323
+ function woo_feed_get_price_with_tax( $product, $price ) {
4324
+ if ( woo_feed_wc_version_check(3.0) ) {
4325
+ return wc_get_price_including_tax($product, array( 'price' => $price ));
 
4326
  } else {
4327
  return $product->get_price_including_tax(1, $price);
4328
  }
4329
  }
4330
  }
4331
 
4332
+ if ( ! function_exists('woo_feed_get_dynamic_discounted_product_price') ) {
4333
 
4334
  /**
4335
  * Get price with dynamic discount
4340
  * @param bool $tax product taxable or not
4341
  * @return mixed $price
4342
  */
4343
+ function woo_feed_get_dynamic_discounted_product_price( $price, $product, $config, $tax ) {
4344
 
4345
  $discount_plugin_activate = true;
4346
 
4347
  // When discount rules plugin by flycart is activated, bring the discounted price
4348
  if ( is_plugin_active('woo-discount-rules/woo-discount-rules.php') ) {
4349
+ if ( class_exists('Wdr\App\Controllers\Configuration') ) {
4350
  $config = Wdr\App\Controllers\Configuration::getInstance()->getConfig('calculate_discount_from', 'sale_price');
4351
 
4352
+ if ( isset($config) && ! empty($config) ) {
4353
+ if ( 'regular_price' === $config ) {
4354
  $price = $product->get_regular_price();
4355
  }else {
4356
  $price = $product->get_sale_price();
4363
  }
4364
  } elseif ( is_plugin_active('aco-woo-dynamic-pricing/start.php') ) {
4365
  // When dynamic discount pricing plugin by Acowebs is activated, bring the discounted price
4366
+ if ( class_exists('AWDP_Discount') ) {
4367
+ if ( ! $tax ) {
4368
  $price = AWDP_Discount::instance()->calculate_discount($product->get_price(), $product);
4369
+ if ( $product->is_taxable() ) {
4370
+ if ( ! wc_prices_include_tax() ) {
4371
  $tax_rates = WC_Tax::get_rates($product->get_tax_class());
4372
  $taxes = WC_Tax::calc_tax($product->get_price(), $tax_rates, false);
4373
  $tax_amount = WC_Tax::get_tax_total($taxes);
4376
  }
4377
  }
4378
  }
4379
+ }
4380
+ } elseif ( is_plugin_active('woo-advanced-discounts/wad.php') ) {
 
4381
  // When discount plugin by Orion is activated, bring the discounted price
4382
  $discount_amount = 0;
4383
  global $wad_discounts;
4384
+ if ( isset($wad_discounts["product"]) ) {
4385
+ foreach ( $wad_discounts["product"] as $discount_id => $discount_obj ) {
4386
  if ( $discount_obj->is_applicable( $product->get_id() ) ) {
4387
  $wad_obj = new WAD_Discount($discount_id);
4388
+ if ( isset($wad_obj->settings) ) {
4389
  $settings = $wad_obj->settings;
4390
  $discount_type = $wad_obj->settings['action'];
4391
+ if ( false !== strpos($discount_type, 'fixed') ) {
4392
  $discount_amount = $wad_obj->get_discount_amount(floatval($price));
4393
  } elseif ( false !== strpos($discount_type, 'percentage') ) {
4394
  $percentage = $settings['percentage-or-fixed-amount'];
4395
+ $discount_amount = floatval($product->get_price()) * ($percentage / 100);
4396
  }
4397
+ }
4398
+ }
 
4399
  }
4400
 
4401
  $price = floatval($product->get_price()) - floatval($discount_amount);
4402
  }
4403
  } elseif ( is_plugin_active('pricing-deals-for-woocommerce/vt-pricing-deals.php') ) {
4404
  // When Pricing Deals for WooCommerce discount plugin by Vark is activated, bring the discounted price
4405
+ if ( class_exists('VTPRD_Controller') ) {
4406
  global $vtprd_rules_set;
4407
  $vtprd_rules_set = get_option( 'vtprd_rules_set' );
4408
+ if ( ! empty( $vtprd_rules_set) && is_array($vtprd_rules_set) ) {
4409
+ foreach ( $vtprd_rules_set as $vtprd_rule_set ) {
4410
  $status = $vtprd_rule_set->rule_on_off_sw_select;
4411
+ if ( 'on' === $status || 'onForever' === $status ) {
4412
  $discount_type = $vtprd_rule_set->rule_deal_info[0]['discount_amt_type'];
4413
  $discount = $vtprd_rule_set->rule_deal_info[0]['discount_amt_count'];
4414
+ if ( 'currency' === $discount_type || 'fixedPrice' === $discount_type ) {
4415
  $price = $product->get_price() - $discount;
4416
+ } elseif ( 'percent' === $discount_type ) {
4417
+ $price = $product->get_price() - (($product->get_price() * $discount) / 100);
4418
  }
4419
  }
4420
  }
4425
  }
4426
 
4427
  //when any of the discount plugin is activated and tax is enabled calculate the tax
4428
+ if ( $discount_plugin_activate ) {
4429
  //when tax is enable
4430
+ if ( $tax ) {
4431
  $price = woo_feed_get_price_with_tax($product, $price);
4432
  }
4433
  }
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.64
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -39,7 +39,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
39
  * @var string
40
  * @since 3.1.6
41
  */
42
- define( 'WOO_FEED_FREE_VERSION', '4.3.64' );
43
  }
44
 
45
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
@@ -232,12 +232,12 @@ if ( ! function_exists( 'woo_feed_get_product_information' ) ) {
232
  }
233
  try {
234
  do_action( 'before_woo_feed_get_product_information', $getConfig );
235
- if( isset($getConfig['provider']) && 'googlereview' === $getConfig['provider'] ) {
236
  $args = array(
237
- 'post_type' => 'product',
238
- 'fields' => 'ids',
239
  'comment_count' => array(
240
- 'value' => 0,
241
  'compare' => '>',
242
  ),
243
  );
@@ -363,7 +363,7 @@ if ( ! function_exists( 'woo_feed_make_batch_feed' ) ) {
363
  woo_feed_unlink_tempFiles( $feedInfo, $feedName );
364
  }
365
 
366
- if( isset($feedInfo['provider']) && 'googlereview' === $feedInfo['provider'] ) {
367
  $feed_data = true;
368
  } else {
369
  $feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
@@ -895,18 +895,18 @@ if ( ! function_exists( 'woo_feed_config_feed' ) ) {
895
  check_admin_referer( 'woo-feed-config' );
896
 
897
  $data = array(
898
- 'per_batch' => isset( $_POST['batch_limit'] ) ? absint( $_POST['batch_limit'] ) : '',
899
- 'product_query_type' => isset( $_POST['product_query_type'] ) ? sanitize_text_field( wp_unslash( $_POST['product_query_type'] ) ) : '',
900
- 'enable_error_debugging' => isset( $_POST['enable_error_debugging'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_error_debugging'] ) ) : '',
901
- 'cache_ttl' => isset( $_POST['cache_ttl'] ) ? absint( $_POST['cache_ttl'] ) : '',
902
- 'overridden_structured_data' => isset( $_POST['overridden_structured_data'] ) ? sanitize_text_field( wp_unslash( $_POST['overridden_structured_data'] ) ) : '',
903
- 'disable_mpn' => isset( $_POST['disable_mpn'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_mpn'] ) ) : '',
904
- 'disable_brand' => isset( $_POST['disable_brand'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_brand'] ) ) : '',
905
- 'disable_pixel' => isset( $_POST['disable_pixel'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_pixel'] )) : '',
906
- 'pixel_id' => isset( $_POST['pixel_id'] ) ? sanitize_text_field( wp_unslash( $_POST['pixel_id'] )) : '',
907
- 'allow_all_shipping' => isset( $_POST['allow_all_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['allow_all_shipping'] ) ) : '',
908
- 'only_free_shipping' => isset( $_POST['only_free_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_free_shipping'] ) ) : '',
909
- 'only_local_pickup_shipping' => isset( $_POST['only_local_pickup_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_local_pickup_shipping'] ) ) : '',
910
  );
911
 
912
  woo_feed_save_options( $data );
@@ -955,7 +955,7 @@ if ( ! class_exists( 'webappick_suggest_plugin' ) ) {
955
 
956
  static function init() {
957
  if ( is_admin() ) {
958
- if( ! is_plugin_active('xt-woo-variation-swatches/xt-woo-variation-swatches.php') ) {
959
  add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
960
  }
961
  }
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.65
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
39
  * @var string
40
  * @since 3.1.6
41
  */
42
+ define( 'WOO_FEED_FREE_VERSION', '4.3.65' );
43
  }
44
 
45
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
232
  }
233
  try {
234
  do_action( 'before_woo_feed_get_product_information', $getConfig );
235
+ if ( isset($getConfig['provider']) && 'googlereview' === $getConfig['provider'] ) {
236
  $args = array(
237
+ 'post_type' => 'product',
238
+ 'fields' => 'ids',
239
  'comment_count' => array(
240
+ 'value' => 0,
241
  'compare' => '>',
242
  ),
243
  );
363
  woo_feed_unlink_tempFiles( $feedInfo, $feedName );
364
  }
365
 
366
+ if ( isset($feedInfo['provider']) && 'googlereview' === $feedInfo['provider'] ) {
367
  $feed_data = true;
368
  } else {
369
  $feed_data = woo_feed_generate_batch_data( $feedInfo, $feedName );
895
  check_admin_referer( 'woo-feed-config' );
896
 
897
  $data = array(
898
+ 'per_batch' => isset( $_POST['batch_limit'] ) ? absint( $_POST['batch_limit'] ) : '',
899
+ 'product_query_type' => isset( $_POST['product_query_type'] ) ? sanitize_text_field( wp_unslash( $_POST['product_query_type'] ) ) : '',
900
+ 'enable_error_debugging' => isset( $_POST['enable_error_debugging'] ) ? sanitize_text_field( wp_unslash( $_POST['enable_error_debugging'] ) ) : '',
901
+ 'cache_ttl' => isset( $_POST['cache_ttl'] ) ? absint( $_POST['cache_ttl'] ) : '',
902
+ 'overridden_structured_data' => isset( $_POST['overridden_structured_data'] ) ? sanitize_text_field( wp_unslash( $_POST['overridden_structured_data'] ) ) : '',
903
+ 'disable_mpn' => isset( $_POST['disable_mpn'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_mpn'] ) ) : '',
904
+ 'disable_brand' => isset( $_POST['disable_brand'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_brand'] ) ) : '',
905
+ 'disable_pixel' => isset( $_POST['disable_pixel'] ) ? sanitize_text_field( wp_unslash( $_POST['disable_pixel'] )) : '',
906
+ 'pixel_id' => isset( $_POST['pixel_id'] ) ? sanitize_text_field( wp_unslash( $_POST['pixel_id'] )) : '',
907
+ 'allow_all_shipping' => isset( $_POST['allow_all_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['allow_all_shipping'] ) ) : '',
908
+ 'only_free_shipping' => isset( $_POST['only_free_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_free_shipping'] ) ) : '',
909
+ 'only_local_pickup_shipping' => isset( $_POST['only_local_pickup_shipping'] ) ? sanitize_text_field( wp_unslash( $_POST['only_local_pickup_shipping'] ) ) : '',
910
  );
911
 
912
  woo_feed_save_options( $data );
955
 
956
  static function init() {
957
  if ( is_admin() ) {
958
+ if ( ! is_plugin_active('xt-woo-variation-swatches/xt-woo-variation-swatches.php') ) {
959
  add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
960
  }
961
  }