Enhanced Ecommerce Google Analytics Plugin for WooCommerce - Version 4.5.1

Version Description

  • 10/12/2021 =

  • Plugin has enhanced the feature "Product Sync Compatibility" with the"YITH WooCommerce Brands Add-On".

Download this release

Release Info

Developer Tatvic
Plugin Icon 128x128 Enhanced Ecommerce Google Analytics Plugin for WooCommerce
Version 4.5.1
Comparing to
See all releases

Code changes from version 4.5.0 to 4.5.1

admin/class-tvc-admin-auto-product-sync-helper.php CHANGED
@@ -318,6 +318,11 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
318
  $product[$key] = $stock_status;
319
  }
320
  }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){$product[$key] = $postmeta_var->$value;
 
 
 
 
 
321
  }
322
  }
323
  $item = [
@@ -377,6 +382,11 @@ if ( ! class_exists( 'TVC_Admin_Auto_Product_sync_Helper' ) ) {
377
  }else if(isset($postObj->$value) && $postObj->$value != ""){
378
  //echo $key."==".$postObj->$value."<br>";
379
  $product[$key] = $postObj->$value;
 
 
 
 
 
380
  }
381
  }
382
  $item = [
318
  $product[$key] = $stock_status;
319
  }
320
  }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){$product[$key] = $postmeta_var->$value;
321
+ }else if(in_array($key, array("brand")) ){ //list of cutom option added
322
+ $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
323
+ if($yith_product_brand != ""){
324
+ $product[$key] = $yith_product_brand;
325
+ }
326
  }
327
  }
328
  $item = [
382
  }else if(isset($postObj->$value) && $postObj->$value != ""){
383
  //echo $key."==".$postObj->$value."<br>";
384
  $product[$key] = $postObj->$value;
385
+ }else if(in_array($key, array("brand")) ){ //list of cutom option added
386
+ $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
387
+ if($yith_product_brand != ""){
388
+ $product[$key] = $yith_product_brand;
389
+ }
390
  }
391
  }
392
  $item = [
admin/class-tvc-admin-helper.php CHANGED
@@ -561,6 +561,47 @@ Class TVC_Admin_Helper{
561
  <?php
562
  }
563
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  public function tvc_text($name, string $type="text", string $class_id="", string $label=null, $sel_val = null, bool $require = false){
565
  ?>
566
  <input type="<?php echo esc_attr($type); ?>" name="<?php echo esc_attr($name); ?>" class="tvc-text <?php echo esc_attr($class_id); ?>" id="<?php echo esc_attr($class_id); ?>" placeholder="<?php echo esc_attr($label); ?>" value="<?php echo esc_attr($sel_val); ?>">
561
  <?php
562
  }
563
  }
564
+
565
+ public function add_additional_option_in_tvc_select($tvc_select_option, $field){
566
+ if($field == "brand"){
567
+ $is_plugin='yith-woocommerce-brands-add-on/init.php';
568
+ $is_plugin_premium='yith-woocommerce-brands-add-on-premium/init.php';
569
+ if(is_plugin_active($is_plugin) || is_plugin_active($is_plugin_premium)){
570
+ $tvc_select_option[]["field"]="yith_product_brand";
571
+ }
572
+ }
573
+ return $tvc_select_option;
574
+ }
575
+
576
+ public function add_additional_option_val_in_map_product_attribute($key, $product_id){
577
+ //echo $key."__".$product_id;
578
+ if($key != "" && $product_id != ""){
579
+ if($key == "brand"){
580
+ //echo $key."__".$product_id;
581
+ $is_plugin='yith-woocommerce-brands-add-on/init.php';
582
+ $is_plugin_premium='yith-woocommerce-brands-add-on-premium/init.php';
583
+ if(is_plugin_active($is_plugin) || is_plugin_active($is_plugin_premium)){
584
+ return $yith_product_brand = $this->get_custom_taxonomy_name($product_id,"yith_product_brand");
585
+ }
586
+ }
587
+ }
588
+ }
589
+
590
+ public function get_custom_taxonomy_name($product_id, $taxonomy ="product_cat", $separator = ", "){
591
+ $terms_ids = wp_get_post_terms( $product_id, $taxonomy, array('fields' => 'ids') );
592
+ // Loop though terms ids (product categories)
593
+ foreach( $terms_ids as $term_id ) {
594
+ // Loop through product category ancestors
595
+ foreach( get_ancestors( $term_id, $taxonomy) as $ancestor_id ){
596
+ return get_term( $ancestor_id, $taxonomy)->name;
597
+ exit;
598
+ }
599
+ return get_term( $term_id, $taxonomy )->name;
600
+ exit;
601
+ break;
602
+ }
603
+ }
604
+
605
  public function tvc_text($name, string $type="text", string $class_id="", string $label=null, $sel_val = null, bool $require = false){
606
  ?>
607
  <input type="<?php echo esc_attr($type); ?>" name="<?php echo esc_attr($name); ?>" class="tvc-text <?php echo esc_attr($class_id); ?>" id="<?php echo esc_attr($class_id); ?>" placeholder="<?php echo esc_attr($label); ?>" value="<?php echo esc_attr($sel_val); ?>">
enhanced-ecommerce-google-analytics.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Conversios.io - Google Analytics and Google Shopping plugin for WooCommerce
16
  * Plugin URI: https://www.tatvic.com/tatvic-labs/woocommerce-extension/
17
  * Description: Automates eCommerce tracking in Google Analytics, dynamic remarkting in Google Ads, and provides complete Google Shopping features.
18
- * Version: 4.5.0
19
  * Author: Tatvic
20
  * Author URI: www.tatvic.com
21
  * License: GPL-2.0+
@@ -37,7 +37,7 @@ if ( ! defined( 'WPINC' ) ) {
37
  * Start at version 1.0.0 and use SemVer - https://semver.org
38
  * Rename this for your plugin and update it as you release new versions.
39
  */
40
- define( 'PLUGIN_TVC_VERSION', '4.5.0' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
15
  * Plugin Name: Conversios.io - Google Analytics and Google Shopping plugin for WooCommerce
16
  * Plugin URI: https://www.tatvic.com/tatvic-labs/woocommerce-extension/
17
  * Description: Automates eCommerce tracking in Google Analytics, dynamic remarkting in Google Ads, and provides complete Google Shopping features.
18
+ * Version: 4.5.1
19
  * Author: Tatvic
20
  * Author URI: www.tatvic.com
21
  * License: GPL-2.0+
37
  * Start at version 1.0.0 and use SemVer - https://semver.org
38
  * Rename this for your plugin and update it as you release new versions.
39
  */
40
+ define( 'PLUGIN_TVC_VERSION', '4.5.1' );
41
  $fullName = plugin_basename( __FILE__ );
42
  $dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
43
  if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
includes/setup/class-tvc-product-sync-helper.php CHANGED
@@ -117,6 +117,7 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
117
  $g_attribute_mapping = $sync_profile_data[$postvalue->product_sync_profile_id]->g_attribute_mapping;
118
  $formArray = json_decode($g_attribute_mapping, true);
119
  }
 
120
  if(empty($formArray)){
121
  return array("error"=>true,"message"=>__("Product sync profile not found.","conversios"));
122
  }
@@ -174,6 +175,7 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
174
  }
175
  }
176
  //}
 
177
  foreach($formArray as $key => $value){
178
  if($key == 'price'){
179
  if(isset($postmeta_var->$value) && $postmeta_var->$value > 0){
@@ -215,7 +217,13 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
215
  $stock_status = str_replace($tvc_find,$tvc_replace,$stock_status);
216
  $product[$key] = $stock_status;
217
  }
218
- }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){$product[$key] = $postmeta_var->$value;
 
 
 
 
 
 
219
  }
220
  }
221
  $item = [
@@ -278,6 +286,11 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
278
  }else if(isset($postObj->$value) && $postObj->$value != ""){
279
  //echo $key."==".$postObj->$value."<br>";
280
  $product[$key] = $postObj->$value;
 
 
 
 
 
281
  }
282
  }
283
  $item = [
@@ -326,6 +339,7 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
326
  'entries' => $p_map_attribute['items']
327
  ];
328
  $response = $CustomApi->products_sync($data);
 
329
  $last_sync_product_id =end($products)->id;
330
  if($response->error== false){
331
  //"data"=> $p_map_attribute['items']
@@ -392,8 +406,8 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
392
  <h6 class="heading-tbl"><img src="<?php echo esc_url(ENHANCAD_PLUGIN_URL.'/admin/images/icon/woocommerce.svg'); ?>" alt="WooCommerce"/><?php _e("Commerce product attributes","conversios"); ?></h6>
393
  </div>
394
  </div>
395
- <?php
396
- $ee_mapped_attrs = unserialize(get_option('ee_prod_mapped_attrs'));
397
  $wooCommerceAttributes = $this->wooCommerceAttributes();
398
  foreach ($this->TVC_Admin_Helper->get_gmcAttributes() as $key => $attribute) {
399
  $sel_val="";
@@ -411,6 +425,7 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
411
  <div class="col-6 align-self-center">
412
  <div class="form-group">';
413
  $tvc_select_option = $wooCommerceAttributes;
 
414
  $require = (isset($attribute['required']) && $attribute['required'])?true:false;
415
  $sel_val_def = (isset($attribute['wAttribute']))?$attribute['wAttribute']:"";
416
  if($attribute["field"]=='link'){
@@ -437,7 +452,7 @@ if ( ! class_exists( 'TVCProductSyncHelper' ) ) {
437
  }
438
  $sel_val = $sel_val_def;
439
  $this->TVC_Admin_Helper->tvc_select($attribute["field"],$attribute["field"],__('Please Select Attribute','conversios'), $sel_val, $require, $tvc_select_option);
440
- }else{
441
  $sel_val = (isset($ee_mapped_attrs[$attribute["field"]]))?$ee_mapped_attrs[$attribute["field"]]:$sel_val_def;
442
  //$name, $class_id, $label="Please Select", $sel_val, $require, $option_list
443
  $this->TVC_Admin_Helper->tvc_select($attribute["field"],$attribute["field"],__('Please Select Attribute','conversios'), $sel_val, $require, $tvc_select_option);
117
  $g_attribute_mapping = $sync_profile_data[$postvalue->product_sync_profile_id]->g_attribute_mapping;
118
  $formArray = json_decode($g_attribute_mapping, true);
119
  }
120
+
121
  if(empty($formArray)){
122
  return array("error"=>true,"message"=>__("Product sync profile not found.","conversios"));
123
  }
175
  }
176
  }
177
  //}
178
+
179
  foreach($formArray as $key => $value){
180
  if($key == 'price'){
181
  if(isset($postmeta_var->$value) && $postmeta_var->$value > 0){
217
  $stock_status = str_replace($tvc_find,$tvc_replace,$stock_status);
218
  $product[$key] = $stock_status;
219
  }
220
+ }else if(isset($postmeta_var->$value) && $postmeta_var->$value != ""){
221
+ $product[$key] = $postmeta_var->$value;
222
+ }else if(in_array($key, array("brand")) ){ //list of cutom option added
223
+ $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
224
+ if($yith_product_brand != ""){
225
+ $product[$key] = $yith_product_brand;
226
+ }
227
  }
228
  }
229
  $item = [
286
  }else if(isset($postObj->$value) && $postObj->$value != ""){
287
  //echo $key."==".$postObj->$value."<br>";
288
  $product[$key] = $postObj->$value;
289
+ }else if(in_array($key, array("brand")) ){ //list of cutom option added
290
+ $yith_product_brand = $this->TVC_Admin_Helper->add_additional_option_val_in_map_product_attribute($key, $postvalue->w_product_id);
291
+ if($yith_product_brand != ""){
292
+ $product[$key] = $yith_product_brand;
293
+ }
294
  }
295
  }
296
  $item = [
339
  'entries' => $p_map_attribute['items']
340
  ];
341
  $response = $CustomApi->products_sync($data);
342
+
343
  $last_sync_product_id =end($products)->id;
344
  if($response->error== false){
345
  //"data"=> $p_map_attribute['items']
406
  <h6 class="heading-tbl"><img src="<?php echo esc_url(ENHANCAD_PLUGIN_URL.'/admin/images/icon/woocommerce.svg'); ?>" alt="WooCommerce"/><?php _e("Commerce product attributes","conversios"); ?></h6>
407
  </div>
408
  </div>
409
+ <?php
410
+ $ee_mapped_attrs = unserialize(get_option('ee_prod_mapped_attrs'));
411
  $wooCommerceAttributes = $this->wooCommerceAttributes();
412
  foreach ($this->TVC_Admin_Helper->get_gmcAttributes() as $key => $attribute) {
413
  $sel_val="";
425
  <div class="col-6 align-self-center">
426
  <div class="form-group">';
427
  $tvc_select_option = $wooCommerceAttributes;
428
+ $tvc_select_option = $this->TVC_Admin_Helper->add_additional_option_in_tvc_select($tvc_select_option, $attribute["field"]);
429
  $require = (isset($attribute['required']) && $attribute['required'])?true:false;
430
  $sel_val_def = (isset($attribute['wAttribute']))?$attribute['wAttribute']:"";
431
  if($attribute["field"]=='link'){
452
  }
453
  $sel_val = $sel_val_def;
454
  $this->TVC_Admin_Helper->tvc_select($attribute["field"],$attribute["field"],__('Please Select Attribute','conversios'), $sel_val, $require, $tvc_select_option);
455
+ }else{
456
  $sel_val = (isset($ee_mapped_attrs[$attribute["field"]]))?$ee_mapped_attrs[$attribute["field"]]:$sel_val_def;
457
  //$name, $class_id, $label="Please Select", $sel_val, $require, $option_list
458
  $this->TVC_Admin_Helper->tvc_select($attribute["field"],$attribute["field"],__('Please Select Attribute','conversios'), $sel_val, $require, $tvc_select_option);
readme.txt CHANGED
@@ -8,8 +8,8 @@ Author: Tatvic
8
  Requires at least: 1.4.1
9
  Tested up to: 5.8.2
10
  Requires PHP: 5.6 or Higher
11
- Stable tag: 4.5.0
12
- Version: 4.5.0
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
@@ -380,6 +380,10 @@ You can resolve the duplication of data by removing the manually implemented GA
380
 
381
  == Changelog ==
382
 
 
 
 
 
383
  = 4.5.0 - 07/12/2021 =
384
 
385
  * In this release, we have focused on code optimization and performance improvement.
8
  Requires at least: 1.4.1
9
  Tested up to: 5.8.2
10
  Requires PHP: 5.6 or Higher
11
+ Stable tag: 4.5.1
12
+ Version: 4.5.1
13
  License: GPLv3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
 
380
 
381
  == Changelog ==
382
 
383
+ = 4.5.1 - 10/12/2021 =
384
+
385
+ * Plugin has enhanced the feature "Product Sync Compatibility" with the"YITH WooCommerce Brands Add-On".
386
+
387
  = 4.5.0 - 07/12/2021 =
388
 
389
  * In this release, we have focused on code optimization and performance improvement.