YITH WooCommerce Catalog Mode - Version 1.5.7

Version Description

Last Stable Tag 1.5.7

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Catalog Mode
Version 1.5.7
Comparing to
See all releases

Code changes from version 1.5.5 to 1.5.7

class.yith-woocommerce-catalog-mode.php CHANGED
@@ -118,6 +118,7 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
118
  add_action( 'wp', array( $this, 'check_pages_redirect' ) );
119
  add_action( 'get_pages', array( $this, 'hide_cart_checkout_pages' ) );
120
  //add_action( 'woocommerce_single_product_summary', array( $this, 'hide_add_to_cart_single' ), 10 );
 
121
  add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'hide_add_to_cart_loop' ), 5 );
122
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'avoid_add_to_cart' ), 10, 2 );
123
 
@@ -268,11 +269,11 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
268
 
269
  } elseif ( $target_users == 'all' ) {
270
 
271
- return true;
272
 
273
  } else {
274
 
275
- return ! is_user_logged_in();
276
 
277
  }
278
 
@@ -316,7 +317,7 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
316
  */
317
  public function hide_atc_single_page( $classes ) {
318
 
319
- if ( $this->check_add_to_cart_single( true ) ) {
320
 
321
  $hide_variations = get_option( 'ywctm_hide_variations' );
322
 
@@ -384,8 +385,8 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
384
  }
385
 
386
  $hide_add_to_cart_single = apply_filters( 'ywctm_get_vendor_option', get_option( 'ywctm_hide_add_to_cart_single' ), $post_id, 'ywctm_hide_add_to_cart_single' );
387
-
388
- if ( $hide_add_to_cart_single != 'yes' ) {error_log('here');
389
  $hide_add_to_cart_single = apply_filters( 'ywctm_get_vendor_option', get_option( 'ywctm_hide_price' ), $post_id, 'ywctm_hide_price' );
390
  }
391
 
@@ -505,7 +506,7 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
505
  } else {
506
 
507
  global $product;
508
-
509
  $product_id = yit_get_product_id( $product );
510
 
511
  $hide_add_to_cart_loop = apply_filters( 'ywctm_get_vendor_option', get_option( 'ywctm_hide_add_to_cart_loop' ), $product_id, 'ywctm_hide_add_to_cart_loop' );
@@ -607,14 +608,20 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
607
 
608
  if ( $this->disable_shop() ) {
609
 
610
- ob_start();
611
-
612
  $args = array(
613
  '.widget.woocommerce.widget_shopping_cart'
614
  );
615
 
616
- $classes = array_merge( $classes, apply_filters( 'ywctm_cart_widget_classes', $args ) );
 
 
 
617
 
 
 
 
 
 
618
 
619
  }
620
 
@@ -843,7 +850,6 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
843
 
844
  if ( $this->check_add_to_cart_single( $priority ) ) {
845
 
846
- add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'hide_add_to_cart_quick_view' ), 10 );
847
 
848
  }*/
849
  return;
@@ -859,41 +865,43 @@ if ( ! class_exists( 'YITH_WC_Catalog_Mode' ) ) {
859
  */
860
  public function hide_add_to_cart_quick_view() {
861
 
862
- /*$hide_variations = get_option( 'ywctm_hide_variations' );
863
- ob_start();
864
 
865
- $args = array(
866
- 'form.cart button.single_add_to_cart_button'
867
- );
868
 
869
- if ( ! class_exists( 'YITH_YWRAQ_Frontend' ) || ( ( class_exists( 'YITH_Request_Quote_Premium' ) ) && ! YITH_Request_Quote_Premium()->check_user_type() ) ) {
 
 
870
 
871
- $args[] = 'form.cart .quantity';
872
 
873
- }
874
 
875
- if ( $hide_variations == 'yes' ) {
876
 
877
- $args[] = 'table.variations';
878
- $args[] = 'form.variations_form';
879
- $args[] = '.single_variation_wrap .variations_button';
880
 
881
- }
 
 
882
 
883
- $classes = implode( ', ', apply_filters( 'ywctm_catalog_classes', $args ) );
884
 
885
- ?>
886
- <style>
887
 
888
- <?php echo $classes; ?>
889
- {
890
- display: none !important
891
- }
892
 
893
- </style>
894
- <?php
895
- echo ob_get_clean();**/
896
- return;
 
 
 
 
 
897
 
898
  }
899
 
118
  add_action( 'wp', array( $this, 'check_pages_redirect' ) );
119
  add_action( 'get_pages', array( $this, 'hide_cart_checkout_pages' ) );
120
  //add_action( 'woocommerce_single_product_summary', array( $this, 'hide_add_to_cart_single' ), 10 );
121
+
122
  add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'hide_add_to_cart_loop' ), 5 );
123
  add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'avoid_add_to_cart' ), 10, 2 );
124
 
269
 
270
  } elseif ( $target_users == 'all' ) {
271
 
272
+ return apply_filters( 'ywctm_applied_roles', true );
273
 
274
  } else {
275
 
276
+ return apply_filters( 'ywctm_applied_roles', ! is_user_logged_in() );
277
 
278
  }
279
 
317
  */
318
  public function hide_atc_single_page( $classes ) {
319
 
320
+ if ( $this->check_add_to_cart_single( true ) && is_singular() ) {
321
 
322
  $hide_variations = get_option( 'ywctm_hide_variations' );
323
 
385
  }
386
 
387
  $hide_add_to_cart_single = apply_filters( 'ywctm_get_vendor_option', get_option( 'ywctm_hide_add_to_cart_single' ), $post_id, 'ywctm_hide_add_to_cart_single' );
388
+
389
+ if ( $hide_add_to_cart_single != 'yes' ) {
390
  $hide_add_to_cart_single = apply_filters( 'ywctm_get_vendor_option', get_option( 'ywctm_hide_price' ), $post_id, 'ywctm_hide_price' );
391
  }
392
 
506
  } else {
507
 
508
  global $product;
509
+
510
  $product_id = yit_get_product_id( $product );
511
 
512
  $hide_add_to_cart_loop = apply_filters( 'ywctm_get_vendor_option', get_option( 'ywctm_hide_add_to_cart_loop' ), $product_id, 'ywctm_hide_add_to_cart_loop' );
608
 
609
  if ( $this->disable_shop() ) {
610
 
 
 
611
  $args = array(
612
  '.widget.woocommerce.widget_shopping_cart'
613
  );
614
 
615
+ $wp_theme = wp_get_theme();
616
+ $theme_name = strtolower( $wp_theme->Name );
617
+
618
+ if ( 'storefront' == $theme_name ) {
619
 
620
+ $args[] = '.site-header-cart.menu';
621
+
622
+ }
623
+
624
+ $classes = array_merge( $classes, apply_filters( 'ywctm_cart_widget_classes', $args ) );
625
 
626
  }
627
 
850
 
851
  if ( $this->check_add_to_cart_single( $priority ) ) {
852
 
 
853
 
854
  }*/
855
  return;
865
  */
866
  public function hide_add_to_cart_quick_view() {
867
 
868
+ if ( $this->check_add_to_cart_single( true ) ) {
 
869
 
870
+ $hide_variations = get_option( 'ywctm_hide_variations' );
871
+ ob_start();
 
872
 
873
+ $args = array(
874
+ 'form.cart button.single_add_to_cart_button'
875
+ );
876
 
877
+ if ( ! class_exists( 'YITH_YWRAQ_Frontend' ) || ( ( class_exists( 'YITH_Request_Quote_Premium' ) ) && ! YITH_Request_Quote_Premium()->check_user_type() ) ) {
878
 
879
+ $args[] = 'form.cart .quantity';
880
 
881
+ }
882
 
883
+ if ( $hide_variations == 'yes' ) {
 
 
884
 
885
+ $args[] = 'table.variations';
886
+ $args[] = 'form.variations_form';
887
+ $args[] = '.single_variation_wrap .variations_button';
888
 
889
+ }
890
 
891
+ $classes = implode( ', ', apply_filters( 'ywctm_catalog_classes', $args ) );
 
892
 
893
+ ?>
894
+ <style>
 
 
895
 
896
+ <?php echo $classes; ?>
897
+ {
898
+ display: none !important
899
+ }
900
+
901
+ </style>
902
+ <?php
903
+ echo ob_get_clean();
904
+ }
905
 
906
  }
907
 
init.php CHANGED
@@ -1,97 +1,97 @@
1
  <?php
2
- /*
3
- Plugin Name: YITH WooCommerce Catalog Mode
4
- Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-catalog-mode/
5
- Description: YITH WooCommerce Catalog Mode allows you to disable shop functions.
6
- Author: YITHEMES
7
- Text Domain: yith-woocommerce-catalog-mode
8
- Version: 1.5.5
9
- Author URI: http://yithemes.com/
10
- */
11
-
12
- if ( !defined( 'ABSPATH' ) ) {
13
- exit;
 
 
14
  } // Exit if accessed directly
15
 
16
- if ( !function_exists( 'is_plugin_active' ) ) {
17
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
18
  }
19
 
20
  function ywctm_install_woocommerce_admin_notice() {
21
- ?>
22
- <div class="error">
23
- <p><?php _e( 'YITH WooCommerce Catalog Mode is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-catalog-mode' ); ?></p>
24
- </div>
25
- <?php
26
  }
27
 
28
  function ywctm_install_free_admin_notice() {
29
- ?>
30
- <div class="error">
31
- <p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Catalog Mode while you are using the premium one.', 'yith-woocommerce-catalog-mode' ); ?></p>
32
- </div>
33
- <?php
34
  }
35
 
36
- if ( !defined( 'YWCTM_VERSION' ) ) {
37
- define( 'YWCTM_VERSION', '1.5.5' );
38
  }
39
 
40
- if ( !defined( 'YWCTM_FREE_INIT' ) ) {
41
- define( 'YWCTM_FREE_INIT', plugin_basename( __FILE__ ) );
42
  }
43
 
44
- if ( !defined( 'YWCTM_FILE' ) ) {
45
- define( 'YWCTM_FILE', __FILE__ );
46
  }
47
 
48
- if ( !defined( 'YWCTM_DIR' ) ) {
49
- define( 'YWCTM_DIR', plugin_dir_path( __FILE__ ) );
50
  }
51
 
52
- if ( !defined( 'YWCTM_URL' ) ) {
53
- define( 'YWCTM_URL', plugins_url( '/', __FILE__ ) );
54
  }
55
 
56
- if ( !defined( 'YWCTM_ASSETS_URL' ) ) {
57
- define( 'YWCTM_ASSETS_URL', YWCTM_URL . 'assets/' );
58
  }
59
 
60
- if ( !defined( 'YWCTM_TEMPLATE_PATH' ) ) {
61
- define( 'YWCTM_TEMPLATE_PATH', YWCTM_DIR . 'templates/' );
62
  }
63
 
64
  /* Plugin Framework Version Check */
65
- if ( !function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YWCTM_DIR . 'plugin-fw/init.php' ) ) {
66
- require_once( YWCTM_DIR . 'plugin-fw/init.php' );
67
  }
68
  yit_maybe_plugin_fw_loader( YWCTM_DIR );
69
 
70
  function ywctm_init() {
71
 
72
- /* Load YWCTM text domain */
73
- load_plugin_textdomain( 'yith-woocommerce-catalog-mode', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
74
 
75
- global $YITH_WC_Catalog_Mode;
76
- $YITH_WC_Catalog_Mode = new YITH_WC_Catalog_Mode();
77
  }
78
 
79
  add_action( 'ywctm_init', 'ywctm_init' );
80
 
81
  function ywctm_install() {
82
 
83
- require_once( YWCTM_DIR . 'class.yith-woocommerce-catalog-mode.php' );
84
-
85
- if ( !function_exists( 'WC' ) ) {
86
- add_action( 'admin_notices', 'ywctm_install_woocommerce_admin_notice' );
87
- }
88
- elseif ( defined( 'YWCTM_PREMIUM' ) ) {
89
- add_action( 'admin_notices', 'ywctm_install_free_admin_notice' );
90
- deactivate_plugins( plugin_basename( __FILE__ ) );
91
- }
92
- else {
93
- do_action( 'ywctm_init' );
94
- }
95
  }
96
 
97
  add_action( 'plugins_loaded', 'ywctm_install', 11 );
@@ -99,8 +99,8 @@ add_action( 'plugins_loaded', 'ywctm_install', 11 );
99
  /**
100
  * Init default plugin settings
101
  */
102
- if ( !function_exists( 'yith_plugin_registration_hook' ) ) {
103
- require_once 'plugin-fw/yit-plugin-registration-hook.php';
104
  }
105
 
106
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
@@ -108,21 +108,21 @@ register_activation_hook( __FILE__, 'ywctm_plugin_activation' );
108
 
109
  function ywctm_plugin_activation() {
110
 
111
- $pages_to_check = array(
112
- get_option( 'woocommerce_cart_page_id' ),
113
- get_option( 'woocommerce_checkout_page_id' )
114
- );
115
-
116
- foreach ( $pages_to_check as $page_id ) {
117
- if ( get_post_status( $page_id ) != 'publish' ) {
118
- $page = array(
119
- 'ID' => $page_id,
120
- 'post_status' => 'publish'
121
- );
122
-
123
- wp_update_post( $page );
124
- }
125
- }
126
  }
127
 
128
 
1
  <?php
2
+ /**
3
+ * Plugin Name: YITH WooCommerce Catalog Mode
4
+ * Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-catalog-mode/
5
+ * Description: YITH WooCommerce Catalog Mode allows you to disable shop functions.
6
+ * Author: YITHEMES
7
+ * Text Domain: yith-woocommerce-catalog-mode
8
+ * Version: 1.5.7
9
+ * Author URI: http://yithemes.com/
10
+ * WC requires at least: 2.6.0
11
+ * WC tested up to: 3.1.2
12
+ */
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit;
16
  } // Exit if accessed directly
17
 
18
+ if ( ! function_exists( 'is_plugin_active' ) ) {
19
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
20
  }
21
 
22
  function ywctm_install_woocommerce_admin_notice() {
23
+ ?>
24
+ <div class="error">
25
+ <p><?php _e( 'YITH WooCommerce Catalog Mode is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-catalog-mode' ); ?></p>
26
+ </div>
27
+ <?php
28
  }
29
 
30
  function ywctm_install_free_admin_notice() {
31
+ ?>
32
+ <div class="error">
33
+ <p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Catalog Mode while you are using the premium one.', 'yith-woocommerce-catalog-mode' ); ?></p>
34
+ </div>
35
+ <?php
36
  }
37
 
38
+ if ( ! defined( 'YWCTM_VERSION' ) ) {
39
+ define( 'YWCTM_VERSION', '1.5.7' );
40
  }
41
 
42
+ if ( ! defined( 'YWCTM_FREE_INIT' ) ) {
43
+ define( 'YWCTM_FREE_INIT', plugin_basename( __FILE__ ) );
44
  }
45
 
46
+ if ( ! defined( 'YWCTM_FILE' ) ) {
47
+ define( 'YWCTM_FILE', __FILE__ );
48
  }
49
 
50
+ if ( ! defined( 'YWCTM_DIR' ) ) {
51
+ define( 'YWCTM_DIR', plugin_dir_path( __FILE__ ) );
52
  }
53
 
54
+ if ( ! defined( 'YWCTM_URL' ) ) {
55
+ define( 'YWCTM_URL', plugins_url( '/', __FILE__ ) );
56
  }
57
 
58
+ if ( ! defined( 'YWCTM_ASSETS_URL' ) ) {
59
+ define( 'YWCTM_ASSETS_URL', YWCTM_URL . 'assets/' );
60
  }
61
 
62
+ if ( ! defined( 'YWCTM_TEMPLATE_PATH' ) ) {
63
+ define( 'YWCTM_TEMPLATE_PATH', YWCTM_DIR . 'templates/' );
64
  }
65
 
66
  /* Plugin Framework Version Check */
67
+ if ( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YWCTM_DIR . 'plugin-fw/init.php' ) ) {
68
+ require_once( YWCTM_DIR . 'plugin-fw/init.php' );
69
  }
70
  yit_maybe_plugin_fw_loader( YWCTM_DIR );
71
 
72
  function ywctm_init() {
73
 
74
+ /* Load YWCTM text domain */
75
+ load_plugin_textdomain( 'yith-woocommerce-catalog-mode', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
76
 
77
+ global $YITH_WC_Catalog_Mode;
78
+ $YITH_WC_Catalog_Mode = new YITH_WC_Catalog_Mode();
79
  }
80
 
81
  add_action( 'ywctm_init', 'ywctm_init' );
82
 
83
  function ywctm_install() {
84
 
85
+ require_once( YWCTM_DIR . 'class.yith-woocommerce-catalog-mode.php' );
86
+
87
+ if ( ! function_exists( 'WC' ) ) {
88
+ add_action( 'admin_notices', 'ywctm_install_woocommerce_admin_notice' );
89
+ } elseif ( defined( 'YWCTM_PREMIUM' ) ) {
90
+ add_action( 'admin_notices', 'ywctm_install_free_admin_notice' );
91
+ deactivate_plugins( plugin_basename( __FILE__ ) );
92
+ } else {
93
+ do_action( 'ywctm_init' );
94
+ }
 
 
95
  }
96
 
97
  add_action( 'plugins_loaded', 'ywctm_install', 11 );
99
  /**
100
  * Init default plugin settings
101
  */
102
+ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
103
+ require_once 'plugin-fw/yit-plugin-registration-hook.php';
104
  }
105
 
106
  register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
108
 
109
  function ywctm_plugin_activation() {
110
 
111
+ $pages_to_check = array(
112
+ get_option( 'woocommerce_cart_page_id' ),
113
+ get_option( 'woocommerce_checkout_page_id' )
114
+ );
115
+
116
+ foreach ( $pages_to_check as $page_id ) {
117
+ if ( get_post_status( $page_id ) != 'publish' ) {
118
+ $page = array(
119
+ 'ID' => $page_id,
120
+ 'post_status' => 'publish'
121
+ );
122
+
123
+ wp_update_post( $page );
124
+ }
125
+ }
126
  }
127
 
128
 
plugin-fw/init.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 2.9.57
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 2.9.68
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -64,6 +64,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
64
  'image_width'
65
  );
66
 
 
 
67
  if ( ! empty( $args ) ) {
68
  $this->settings = $args;
69
  $this->_tabs_path_files = $this->get_tabs_path_files();
64
  'image_width'
65
  );
66
 
67
+ $args = apply_filters( 'yit_plugin_fw_wc_panel_option_args', $args );
68
+
69
  if ( ! empty( $args ) ) {
70
  $this->settings = $args;
71
  $this->_tabs_path_files = $this->get_tabs_path_files();
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -77,7 +77,9 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
77
  'position' => null
78
  );
79
 
80
- $this->settings = wp_parse_args( $args, $default_args );
 
 
81
  $this->_tabs_path_files = $this->get_tabs_path_files();
82
 
83
  if ( isset( $this->settings['create_menu_page'] ) && $this->settings['create_menu_page'] ) {
@@ -114,7 +116,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
114
  if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
115
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
116
  // YITH Plugins text must not be translated
117
- current_user_can( 'manage_options' ) && add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
118
  }
119
  }
120
 
77
  'position' => null
78
  );
79
 
80
+ $args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
81
+
82
+ $this->settings = $args;
83
  $this->_tabs_path_files = $this->get_tabs_path_files();
84
 
85
  if ( isset( $this->settings['create_menu_page'] ) && $this->settings['create_menu_page'] ) {
116
  if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
117
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
118
  // YITH Plugins text must not be translated
119
+ apply_filters('yit_plugin_panel_menu_page_capability', current_user_can( 'manage_options' )) && add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
120
  }
121
  }
122
 
plugin-fw/yit-plugin.php CHANGED
@@ -42,12 +42,15 @@ load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/y
42
  // ...or from plugin folder
43
  || load_textdomain( 'yith-plugin-fw', dirname(__FILE__) . '/languages/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' );
44
 
45
- if( apply_filters( 'yit_fw_wc_update_message_hook', true )
 
 
46
  &&
47
  ( function_exists( 'WC' ) && ! version_compare( WC()->version, '2.7', '>=' ) )
48
  && ! isset( $_COOKIE['yith_wc_2_7_notice'] )
49
  ){
50
  add_action( 'admin_notices', 'yit_fw_wc_update_message', 15 );
 
51
 
52
  if( ! function_exists( 'yit_fw_wc_update_message' ) ){
53
  function yit_fw_wc_update_message(){
@@ -61,8 +64,6 @@ if( apply_filters( 'yit_fw_wc_update_message_hook', true )
61
  }
62
  }
63
 
64
- add_action( 'admin_enqueue_scripts', 'yit_plugin_fw_dismissable_notice', 20 );
65
-
66
  if( ! function_exists( 'yit_plugin_fw_dismissable_notice' ) ){
67
  function yit_plugin_fw_dismissable_notice(){
68
  $assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
@@ -76,4 +77,6 @@ if( apply_filters( 'yit_fw_wc_update_message_hook', true )
76
  wp_add_inline_script( 'jquery-cookie', $js );
77
  }
78
  }
79
- }
 
 
42
  // ...or from plugin folder
43
  || load_textdomain( 'yith-plugin-fw', dirname(__FILE__) . '/languages/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' );
44
 
45
+ /* === WooCommerce Update Message === */
46
+
47
+ /*if( apply_filters( 'yit_fw_wc_update_message_hook', true )
48
  &&
49
  ( function_exists( 'WC' ) && ! version_compare( WC()->version, '2.7', '>=' ) )
50
  && ! isset( $_COOKIE['yith_wc_2_7_notice'] )
51
  ){
52
  add_action( 'admin_notices', 'yit_fw_wc_update_message', 15 );
53
+ add_action( 'admin_enqueue_scripts', 'yit_plugin_fw_dismissable_notice', 20 );
54
 
55
  if( ! function_exists( 'yit_fw_wc_update_message' ) ){
56
  function yit_fw_wc_update_message(){
64
  }
65
  }
66
 
 
 
67
  if( ! function_exists( 'yit_plugin_fw_dismissable_notice' ) ){
68
  function yit_plugin_fw_dismissable_notice(){
69
  $assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
77
  wp_add_inline_script( 'jquery-cookie', $js );
78
  }
79
  }
80
+ }*/
81
+
82
+ /* ========================== */
plugin-fw/yit-woocommerce-compatibility.php CHANGED
@@ -112,13 +112,8 @@ if ( !function_exists( 'yit_save_prop' ) ) {
112
  foreach ( $arg1 as $key => $value ) {
113
  yit_set_prop( $object, $key, $value );
114
 
115
- if ( $is_wc_data ) {
116
- if ( $force_update ) {
117
- $object->save();
118
- } else {
119
- yit_store_changes( $object, $key, $value );
120
- }
121
- } else {
122
  if ( yit_wc_check_post_columns( $key ) ) {
123
  yit_store_changes( $object->post, $key, $value );
124
  } else {
@@ -128,6 +123,10 @@ if ( !function_exists( 'yit_save_prop' ) ) {
128
  }
129
  }
130
  }
 
 
 
 
131
  }
132
  }
133
 
@@ -150,7 +149,7 @@ if ( !function_exists( 'yit_delete_prop' ) ) {
150
  $object->delete_meta_data( $key, $value );
151
  }
152
 
153
- yit_store_changes( $object, $key );
154
  } else {
155
  if ( yit_wc_check_post_columns( $key ) && ( !$value || $object->post->$key == $value ) ) {
156
  yit_store_changes( $object->post, $key, '' );
@@ -166,26 +165,36 @@ if ( !function_exists( 'yit_delete_prop' ) ) {
166
  if ( !function_exists( 'yit_return_new_attribute_map' ) ) {
167
  function yit_return_new_attribute_map() {
168
  return array(
169
- 'post_parent' => 'parent_id',
170
- 'post_title' => 'name',
171
- 'post_status' => 'status',
172
- 'post_content' => 'description',
173
- 'post_excerpt' => 'short_description',
174
  /* Orders */
175
- 'paid_date' => 'date_paid',
176
- '_paid_date' => '_date_paid',
177
- 'completed_date' => 'date_completed',
178
- '_completed_date' => '_date_completed',
179
- '_order_date' => '_date_created',
180
- 'order_date' => 'date_created',
181
- 'order_total' => 'total',
 
 
182
  /* Products */
183
- 'visibility' => 'catalog_visibility',
184
- '_visibility' => '_catalog_visibility',
185
- 'sale_price_dates_from' => 'date_on_sale_from',
186
- '_sale_price_dates_from' => '_date_on_sale_from',
187
- 'sale_price_dates_to' => 'date_on_sale_to',
188
- '_sale_price_dates_to' => '_date_on_sale_to',
 
 
 
 
 
 
 
 
189
  );
190
  }
191
  }
@@ -202,15 +211,11 @@ if ( !function_exists( 'yit_store_changes' ) ) {
202
  */
203
  $object_reference = $object->get_id();
204
 
205
- $cache_type = is_a( $object, 'WC_Product' ) ? 'product' : 'order';
206
- $cache_key = $cache_type . '-' . $object_reference;
207
- $cache_group = $cache_type . 's';
208
-
209
  $changed_objects[ $object_reference ][ 'object' ] = $object;
210
  $changed_objects[ $object_reference ][ 'changes' ][ $key ] = $value;
211
 
212
 
213
- wp_cache_set( $cache_key, $object, $cache_group );
214
  } else {
215
  $changed_objects[ $object->ID ][ $key ] = $value;
216
  }
@@ -245,7 +250,7 @@ if ( !function_exists( 'yit_get_orders' ) ) {
245
  *
246
  */
247
  function yit_get_orders( $args ) {
248
- if ( version_compare( WC()->version, '2.6', '<' ) ) {
249
  $args[ 'fields' ] = 'objects';
250
  $posts = get_posts( $args );
251
 
@@ -261,7 +266,7 @@ if ( !function_exists( 'yit_get_products' ) ) {
261
  *
262
  */
263
  function yit_get_products( $args ) {
264
- if ( version_compare( WC()->version, '2.6', '<' ) ) {
265
  $args[ 'fields' ] = 'objects';
266
  $posts = get_posts( $args );
267
 
@@ -311,6 +316,7 @@ if ( !function_exists( 'yit_wc_deprecated_filters' ) ) {
311
  'woocommerce_product_weight' => 'woocommerce_product_get_weight',
312
  'woocommerce_get_sku' => 'woocommerce_product_get_sku',
313
  'woocommerce_get_price' => 'woocommerce_product_get_price',
 
314
  'woocommerce_get_regular_price' => 'woocommerce_product_get_regular_price',
315
  'woocommerce_get_sale_price' => 'woocommerce_product_get_sale_price',
316
  'woocommerce_product_tax_class' => 'woocommerce_product_get_tax_class',
@@ -548,7 +554,7 @@ if ( !function_exists( 'yit_get_product_image_id' ) ) {
548
 
549
  if ( !function_exists( 'yit_get_refund_amount' ) ) {
550
  /**
551
- * @param $refund \WC_Order_Refund
552
  * @param $context string
553
  *
554
  * @return float
@@ -564,6 +570,44 @@ if ( !function_exists( 'yit_get_refund_amount' ) ) {
564
  }
565
  }
566
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
567
  if ( !function_exists( 'yit_add_select2_fields' ) ) {
568
  /**
569
  * Add select 2
@@ -630,7 +674,7 @@ if ( !function_exists( 'yit_add_select2_fields' ) ) {
630
  <?php
631
  else :
632
  if ( $args[ 'data-multiple' ] === false && is_array( $args[ 'data-selected' ] ) ) {
633
- $args[ 'data-selected' ] = current($args[ 'data-selected' ]);
634
  }
635
 
636
  ?>
@@ -658,7 +702,9 @@ if ( !function_exists( 'yit_product_visibility_meta' ) ) {
658
  if ( version_compare( WC()->version, '2.7.0', '<' ) ) {
659
  $args[ 'meta_query' ] = isset( $args[ 'meta_query' ] ) ? $args[ 'meta_query' ] : array();
660
  $args[ 'meta_query' ][] = WC()->query->visibility_meta_query();
661
- } else {
 
 
662
  $product_visibility_term_ids = wc_get_product_visibility_term_ids();
663
  $args[ 'tax_query' ] = isset( $args[ 'tax_query' ] ) ? $args[ 'tax_query' ] : array();
664
  $args[ 'tax_query' ][] = array(
@@ -680,7 +726,7 @@ if ( !function_exists( 'yit_datetime_to_timestamp' ) ) {
680
  */
681
  function yit_datetime_to_timestamp( $date ) {
682
 
683
- if ( version_compare( WC()->version, '2.7.0', '<' ) ) {
684
  $date = strtotime( $date );
685
  }
686
 
112
  foreach ( $arg1 as $key => $value ) {
113
  yit_set_prop( $object, $key, $value );
114
 
115
+ if ( !$is_wc_data ) {
116
+
 
 
 
 
 
117
  if ( yit_wc_check_post_columns( $key ) ) {
118
  yit_store_changes( $object->post, $key, $value );
119
  } else {
123
  }
124
  }
125
  }
126
+
127
+ if ( $is_wc_data ) {
128
+ $object->save();
129
+ }
130
  }
131
  }
132
 
149
  $object->delete_meta_data( $key, $value );
150
  }
151
 
152
+ $object->save();
153
  } else {
154
  if ( yit_wc_check_post_columns( $key ) && ( !$value || $object->post->$key == $value ) ) {
155
  yit_store_changes( $object->post, $key, '' );
165
  if ( !function_exists( 'yit_return_new_attribute_map' ) ) {
166
  function yit_return_new_attribute_map() {
167
  return array(
168
+ 'post_parent' => 'parent_id',
169
+ 'post_title' => 'name',
170
+ 'post_status' => 'status',
171
+ 'post_content' => 'description',
172
+ 'post_excerpt' => 'short_description',
173
  /* Orders */
174
+ 'paid_date' => 'date_paid',
175
+ '_paid_date' => '_date_paid',
176
+ 'completed_date' => 'date_completed',
177
+ '_completed_date' => '_date_completed',
178
+ '_order_date' => '_date_created',
179
+ 'order_date' => 'date_created',
180
+ 'order_total' => 'total',
181
+ 'customer_user' => 'customer_id',
182
+ '_customer_user' => 'customer_id',
183
  /* Products */
184
+ 'visibility' => 'catalog_visibility',
185
+ '_visibility' => '_catalog_visibility',
186
+ 'sale_price_dates_from' => 'date_on_sale_from',
187
+ '_sale_price_dates_from' => '_date_on_sale_from',
188
+ 'sale_price_dates_to' => 'date_on_sale_to',
189
+ '_sale_price_dates_to' => '_date_on_sale_to',
190
+ 'product_attributes' => 'attributes',
191
+ '_product_attributes' => '_attributes',
192
+ /*Coupons*/
193
+ 'coupon_amount' => 'amount',
194
+ 'exclude_product_ids' => 'excluded_product_ids',
195
+ 'exclude_product_categories' => 'excluded_product_categories',
196
+ 'customer_email' => 'email_restrictions',
197
+ 'expiry_date' => 'date_expires',
198
  );
199
  }
200
  }
211
  */
212
  $object_reference = $object->get_id();
213
 
 
 
 
 
214
  $changed_objects[ $object_reference ][ 'object' ] = $object;
215
  $changed_objects[ $object_reference ][ 'changes' ][ $key ] = $value;
216
 
217
 
218
+
219
  } else {
220
  $changed_objects[ $object->ID ][ $key ] = $value;
221
  }
250
  *
251
  */
252
  function yit_get_orders( $args ) {
253
+ if ( version_compare( WC()->version, '2.7', '<' ) ) {
254
  $args[ 'fields' ] = 'objects';
255
  $posts = get_posts( $args );
256
 
266
  *
267
  */
268
  function yit_get_products( $args ) {
269
+ if ( version_compare( WC()->version, '2.7', '<' ) ) {
270
  $args[ 'fields' ] = 'objects';
271
  $posts = get_posts( $args );
272
 
316
  'woocommerce_product_weight' => 'woocommerce_product_get_weight',
317
  'woocommerce_get_sku' => 'woocommerce_product_get_sku',
318
  'woocommerce_get_price' => 'woocommerce_product_get_price',
319
+ 'woocommerce_get_price' => 'woocommerce_product_variation_get_price',
320
  'woocommerce_get_regular_price' => 'woocommerce_product_get_regular_price',
321
  'woocommerce_get_sale_price' => 'woocommerce_product_get_sale_price',
322
  'woocommerce_product_tax_class' => 'woocommerce_product_get_tax_class',
554
 
555
  if ( !function_exists( 'yit_get_refund_amount' ) ) {
556
  /**
557
+ * @param $refund \WC_Order_Refund
558
  * @param $context string
559
  *
560
  * @return float
570
  }
571
  }
572
 
573
+ if ( !function_exists( 'yit_set_refund_amount' ) ){
574
+ /**
575
+ * @param $refund \WC_Order_Refund
576
+ * @param $amount float
577
+ *
578
+ * @return float
579
+ */
580
+ function yit_set_refund_amount( $refund, $amount ){
581
+ $is_wc_data = $refund instanceof WC_Data;
582
+
583
+ if( $is_wc_data ){
584
+ $refund->set_amount( $amount );
585
+ }
586
+ else{
587
+ $refund->refund_amount = $amount;
588
+ }
589
+ }
590
+ }
591
+
592
+ if ( !function_exists( 'yit_get_refund_reason' ) ){
593
+ /**
594
+ * @param $refund \WC_Order_Refund
595
+ * @param $amount float
596
+ *
597
+ * @return float
598
+ */
599
+ function yit_get_refund_reason( $refund ){
600
+ $is_wc_data = $refund instanceof WC_Data;
601
+
602
+ if( $is_wc_data ){
603
+ return $refund->get_reason();
604
+ }
605
+ else{
606
+ return $refund->get_refund_reason();
607
+ }
608
+ }
609
+ }
610
+
611
  if ( !function_exists( 'yit_add_select2_fields' ) ) {
612
  /**
613
  * Add select 2
674
  <?php
675
  else :
676
  if ( $args[ 'data-multiple' ] === false && is_array( $args[ 'data-selected' ] ) ) {
677
+ $args[ 'data-selected' ] = current( $args[ 'data-selected' ] );
678
  }
679
 
680
  ?>
702
  if ( version_compare( WC()->version, '2.7.0', '<' ) ) {
703
  $args[ 'meta_query' ] = isset( $args[ 'meta_query' ] ) ? $args[ 'meta_query' ] : array();
704
  $args[ 'meta_query' ][] = WC()->query->visibility_meta_query();
705
+ }
706
+
707
+ elseif( taxonomy_exists( 'product_visibility' ) ) {
708
  $product_visibility_term_ids = wc_get_product_visibility_term_ids();
709
  $args[ 'tax_query' ] = isset( $args[ 'tax_query' ] ) ? $args[ 'tax_query' ] : array();
710
  $args[ 'tax_query' ][] = array(
726
  */
727
  function yit_datetime_to_timestamp( $date ) {
728
 
729
+ if ( !is_int( $date ) ) {
730
  $date = strtotime( $date );
731
  }
732
 
readme.txt CHANGED
@@ -3,8 +3,8 @@
3
  Contributors: yithemes
4
  Tags: woocommerce catalog mode plugin, woocommerce catalog only, woocommerce, products, themes, yit, yith, yithemes, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
5
  Requires at least: 4.0
6
- Tested up to: 4.7
7
- Stable tag: 1.5.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -113,6 +113,10 @@ yith-woocommerce-catalog-mode-<WORDPRESS LOCALE >.mo
113
 
114
  == Changelog ==
115
 
 
 
 
 
116
  = Version 1.5.5 - Released: Mar 23, 2017 =
117
 
118
  * Tweak: Support for WooCommerce 3.0.0-RC 1
@@ -238,7 +242,7 @@ yith-woocommerce-catalog-mode-<WORDPRESS LOCALE >.mo
238
 
239
  == Upgrade Notice ==
240
 
241
- Last Stable Tag 1.4.0
242
 
243
  == Suggestions ==
244
 
3
  Contributors: yithemes
4
  Tags: woocommerce catalog mode plugin, woocommerce catalog only, woocommerce, products, themes, yit, yith, yithemes, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
5
  Requires at least: 4.0
6
+ Tested up to: 4.8
7
+ Stable tag: 1.5.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
113
 
114
  == Changelog ==
115
 
116
+ = Version 1.5.7 - Released: Sept 20, 2017 =
117
+
118
+ * Update: plugin framework
119
+
120
  = Version 1.5.5 - Released: Mar 23, 2017 =
121
 
122
  * Tweak: Support for WooCommerce 3.0.0-RC 1
242
 
243
  == Upgrade Notice ==
244
 
245
+ Last Stable Tag 1.5.7
246
 
247
  == Suggestions ==
248
 
screenshot-1.jpg DELETED
Binary file
screenshot-2.jpg DELETED
Binary file
screenshot-3.jpg DELETED
Binary file