WooCommerce Stock Manager - Version 2.5.6

Version Description

Admin footer text for WooCommerce Stock Manager pages, Code Improvements, POT file. Recommended upgrade.

Download this release

Release Info

Developer storeapps
Plugin Icon 128x128 WooCommerce Stock Manager
Version 2.5.6
Comparing to
See all releases

Code changes from version 2.5.5 to 2.5.6

admin/assets/js/admin.js CHANGED
@@ -4,260 +4,244 @@
4
  $(function () {
5
 
6
  /**
7
- * Fix for stupids
8
- *
9
- */
10
- jQuery( '.manage_stock_select' ).on( 'change' , function(){
11
-
12
- var id = jQuery( this ).data( 'item' );
13
- var manage = jQuery( this ).val();
14
-
15
- if( manage == 'no' ){
16
-
17
- //jQuery( '.stock_status_' + id ).val( 'outofstock' );
18
- jQuery( '.stock_status_' + id ).prop( 'disabled', false );
19
- jQuery( '.backorders_' + id ).val( 'no' );
20
- jQuery( '.backorders_' + id ).prop( 'disabled', 'disabled' );
21
- jQuery( '.stock_' + id ).val( '0' );
22
- jQuery( '.stock_' + id ).prop( 'disabled', 'disabled' );
23
-
24
- }else{
25
-
26
- jQuery( '.stock_status_' + id ).prop( 'disabled', 'disabled' );
27
- jQuery( '.backorders_' + id ).prop( 'disabled', false );
28
- jQuery( '.stock_' + id ).prop( 'disabled', false );
29
-
30
- var data = {
31
- 'action' : 'wsm_get_product_data',
32
- 'productid' : id
33
- };
34
-
35
- jQuery.post( ajaxurl, data, function( response ) {
36
-
37
- var result = jQuery.parseJSON( response );
38
-
39
- //console.log( result );
40
-
41
- if( result.stock_status ){
42
- jQuery( '.stock_status_' + result.productid ).val( result.stock_status );
43
- }
44
- if( result.backorders ){
45
- jQuery( '.backorders_' + result.productid ).val( result.backorders );
46
- }
47
- if( result.stock ){
48
- jQuery( '.stock_' + result.productid ).val( result.stock );
49
- }
50
-
51
- });
52
-
53
- }
54
-
55
- });
56
-
57
- /**
58
- * Fix for stupids 2
59
- *
60
- */
61
- jQuery( '.backorders_select' ).on( 'change' , function(){
62
-
63
- var id = jQuery( this ).data( 'item' );
64
- var backorders = jQuery( this ).val();
65
-
66
- if( backorders == 'no' ){
67
-
68
- var number = jQuery( '.stock_' + id ).val();
69
-
70
- if( number ){
71
- if( number > 0 ){
72
- jQuery( '.stock_status_' + id ).val( 'instock' );
73
- }else{
74
- jQuery( '.stock_status_' + id ).val( 'outofstock' );
75
- }
76
- }else{
77
- jQuery( '.stock_status_' + id ).val( 'outofstock' );
78
- }
79
-
80
- }else{
81
-
82
- jQuery( '.stock_status_' + id ).val( 'onbackorder' );
83
-
84
- }
85
-
86
- });
87
-
88
- /**
89
- * Fix for stupids 3
90
- *
91
- */
92
- jQuery( '.stock_number' ).on( 'change' , function(){
93
-
94
- var id = jQuery( this ).data( 'item' );
95
- var stock = jQuery( this ).val();
96
- //console.log( stock );
97
 
98
- if( stock ){
99
- if( stock > 0 ){
100
- jQuery( '.stock_status_' + id ).val( 'instock' );
101
- }else{
102
- var backorder = jQuery( '.backorders_' + id ).val();
103
- if( backorder == 'no' ){
104
- jQuery( '.stock_status_' + id ).val( 'outofstock' );
105
- }else{
106
- jQuery( '.stock_status_' + id ).val( 'onbackorder' );
107
- }
108
- }
109
- }else{
110
- jQuery( '.stock_status_' + id ).val( 'outofstock' );
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
- /**
116
  * Save single product line in stock table
117
  *
118
  */
119
- jQuery('.save-product').on('click', function(){
120
- jQuery('.lineloader').css('display','block');
121
- var product = jQuery(this).data('product');
122
-
123
-
124
- var sku = jQuery('.sku_' + product).val();
125
- var manage_stock = jQuery('.manage_stock_' + product).val();
126
- var stock_status = jQuery('.stock_status_' + product).val();
127
- var backorders = jQuery('.backorders_' + product).val();
128
- var stock = jQuery('.stock_' + product).val();
129
- var regular_price = jQuery('.regular_price_' + product).val();
130
- var sales_price = jQuery('.sales_price_' + product).val();
131
- var weight = jQuery('.weight_' + product).val();
132
- var tax_status = jQuery('.tax_status' + product).val();
133
- var tax_class = jQuery('.tax_class' + product).val();
134
- var shipping_class = jQuery('.shipping_class' + product).val();
135
- var secure = jQuery('.wsm-ajax-nonce_' + product).val();
136
-
137
- var data = {
138
- action : 'save_one_product',
139
- product : product,
140
- sku : sku,
141
- manage_stock : manage_stock,
142
- stock_status : stock_status,
143
- backorders : backorders,
144
- stock : stock,
145
- regular_price : regular_price,
146
- sales_price : sales_price,
147
- weight : weight,
148
- tax_status : tax_status,
149
- tax_class : tax_class,
150
- shipping_class : shipping_class,
151
- secure : secure
152
- };
153
-
154
-
155
- jQuery.post(ajaxurl, data, function(response){
156
-
157
- jQuery('.lineloader').css('display','none');
158
-
159
- });
160
-
161
- });
162
-
163
-
164
- /**
165
- * Show variations of selected product
166
- *
167
- */
168
- jQuery('.show-variable').on('click', function(){
169
- var variable = jQuery(this).data('variable');
170
- jQuery('.variation-item-' + variable).toggleClass('show-variations');
171
-
172
- });
173
-
174
-
175
- /**
176
- * Navigation
177
- *
178
- */
179
- jQuery('.stock-manager-navigation li span').on('click', function(){
180
- jQuery('.stock-manager-navigation li span').removeClass('activ');
181
- jQuery(this).addClass('activ');
182
- });
183
- jQuery('.stock-manager-navigation li span.navigation-filter-default').on('click', function(){
184
- jQuery('.filter-block').removeClass('active-filter');
185
- jQuery('.stock-filter').addClass('active-filter');
186
- });
187
- jQuery('.stock-manager-navigation li span.navigation-filter-by-sku').on('click', function(){
188
- jQuery('.filter-block').removeClass('active-filter');
189
- jQuery('.filter-by-sku').addClass('active-filter');
190
- });
191
- jQuery('.stock-manager-navigation li span.navigation-filter-by-title').on('click', function(){
192
- jQuery('.filter-block').removeClass('active-filter');
193
- jQuery('.filter-by-title').addClass('active-filter');
194
- });
195
- jQuery('.stock-manager-navigation li span.navigation-filter-display').on('click', function(){
196
- jQuery('.filter-block').removeClass('active-filter');
197
- jQuery('.filter-display').addClass('active-filter');
198
- });
199
-
200
 
201
- //Open box for product title saving
202
- jQuery('.table_name_box .dashicons').on('click', function(){
203
- var item = jQuery(this).data('item');
204
- jQuery('.item-post-title-wrap-'+item).css('display','block');
205
- });
206
- //Close box for product title saving
207
- jQuery('.item-post-title-button-close').on('click', function(){
208
- jQuery(this).parent().css('display', 'none');
209
- });
210
- //Save product title
211
- jQuery('.item-post-title-button').on('click', function(ajax_object){
212
-
213
- var item = jQuery(this).data('item');
214
- var title = jQuery('.item-post-title-'+item).val();
215
- var data = {
216
- action : 'wsm_save_title_product',
217
- item : item,
218
- title : title,
219
- secure : ajax_object.ajax_nonce
220
- };
221
- jQuery('.item-post-title-'+item).val(title);
222
- jQuery('.item-post-link-'+item).text(title);
223
-
224
- jQuery.post(ajaxurl, data, function(response, item, title){
225
- jQuery('.item-post-title-wrap-'+response).css('display', 'none');
226
- });
227
-
228
- });
229
-
230
-
231
-
232
- //Open box for sku saving
233
- jQuery('.item_sku_box .dashicons').on('click', function(){
234
- var item = jQuery(this).data('item');
235
- jQuery('.item-sku-wrap-'+item).css('display','block');
236
- });
237
- //Close box for sku saving
238
- jQuery('.item-sku-button-close').on('click', function(){
239
- jQuery(this).parent().css('display', 'none');
240
- });
241
- //Save sku
242
- jQuery('.item-sku-button').on('click', function(ajax_object){
243
-
244
- var item = jQuery(this).data('item');
245
- var sku = jQuery('.sku_'+item).val();
246
- var data = {
247
- action : 'wsm_save_sku',
248
- item : item,
249
- sku : sku,
250
- secure : ajax_object.ajax_nonce
251
- };
252
- jQuery('.sku_-'+item).val(sku);
253
- jQuery('.item-sku-text-'+item).text(sku);
254
-
255
- jQuery.post(ajaxurl, data, function(response, item, sku){
256
- jQuery('.item-sku-wrap-'+response).css('display', 'none');
257
- });
258
-
259
- });
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
 
262
  });
263
 
4
  $(function () {
5
 
6
  /**
7
+ * Fix for
8
+ *
9
+ */
10
+ jQuery( '.manage_stock_select' ).on( 'change' , function() {
11
+
12
+ var id = jQuery( this ).data( 'item' );
13
+ var manage = jQuery( this ).val();
14
+
15
+ if( manage == 'no' ){
16
+
17
+ //jQuery( '.stock_status_' + id ).val( 'outofstock' );
18
+ jQuery( '.stock_status_' + id ).prop( 'disabled', false );
19
+ jQuery( '.backorders_' + id ).val( 'no' );
20
+ jQuery( '.backorders_' + id ).prop( 'disabled', 'disabled' );
21
+ jQuery( '.stock_' + id ).val( '0' );
22
+ jQuery( '.stock_' + id ).prop( 'disabled', 'disabled' );
23
+
24
+ }else{
25
+
26
+ jQuery( '.stock_status_' + id ).prop( 'disabled', 'disabled' );
27
+ jQuery( '.backorders_' + id ).prop( 'disabled', false );
28
+ jQuery( '.stock_' + id ).prop( 'disabled', false );
29
+
30
+ var data = {
31
+ 'action' : 'wsm_get_product_data',
32
+ 'productid' : id
33
+ };
34
+
35
+ jQuery.post( ajaxurl, data, function( response ) {
36
+
37
+ var result = jQuery.parseJSON( response );
38
+
39
+ if( result.stock_status ){
40
+ jQuery( '.stock_status_' + result.productid ).val( result.stock_status );
41
+ }
42
+ if( result.backorders ){
43
+ jQuery( '.backorders_' + result.productid ).val( result.backorders );
44
+ }
45
+ if( result.stock ){
46
+ jQuery( '.stock_' + result.productid ).val( result.stock );
47
+ }
48
+
49
+ });
50
+
51
+ }
52
+
53
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ /**
56
+ * Fix for 2
57
+ *
58
+ */
59
+ jQuery( '.backorders_select' ).on( 'change' , function(){
60
+
61
+ var id = jQuery( this ).data( 'item' );
62
+ var backorders = jQuery( this ).val();
63
+
64
+ if( backorders == 'no' ){
65
+
66
+ var number = jQuery( '.stock_' + id ).val();
67
+
68
+ if( number ){
69
+ if( number > 0 ){
70
+ jQuery( '.stock_status_' + id ).val( 'instock' );
71
+ }else{
72
+ jQuery( '.stock_status_' + id ).val( 'outofstock' );
73
+ }
74
+ }else{
75
+ jQuery( '.stock_status_' + id ).val( 'outofstock' );
76
+ }
77
+
78
+ }else{
79
+
80
+ jQuery( '.stock_status_' + id ).val( 'onbackorder' );
81
+
82
+ }
83
+
84
+ });
85
 
86
+ /**
87
+ * Fix for 3
88
+ *
89
+ */
90
+ jQuery( '.stock_number' ).on( 'change' , function(){
91
+
92
+ var id = jQuery( this ).data( 'item' );
93
+ var stock = jQuery( this ).val();
94
+
95
+ if( stock ){
96
+ if( stock > 0 ){
97
+ jQuery( '.stock_status_' + id ).val( 'instock' );
98
+ }else{
99
+ var backorder = jQuery( '.backorders_' + id ).val();
100
+ if( backorder == 'no' ){
101
+ jQuery( '.stock_status_' + id ).val( 'outofstock' );
102
+ }else{
103
+ jQuery( '.stock_status_' + id ).val( 'onbackorder' );
104
+ }
105
+ }
106
+ }else{
107
+ jQuery( '.stock_status_' + id ).val( 'outofstock' );
108
+ }
109
+
110
+ });
111
 
112
+ /**
113
  * Save single product line in stock table
114
  *
115
  */
116
+ jQuery('.save-product').on('click', function(){
117
+ jQuery('.lineloader').css('display','block');
118
+ var product = jQuery(this).data('product');
119
+ var sku = jQuery('.sku_' + product).val();
120
+ var manage_stock = jQuery('.manage_stock_' + product).val();
121
+ var stock_status = jQuery('.stock_status_' + product).val();
122
+ var backorders = jQuery('.backorders_' + product).val();
123
+ var stock = jQuery('.stock_' + product).val();
124
+ var regular_price = jQuery('.regular_price_' + product).val();
125
+ var sales_price = jQuery('.sales_price_' + product).val();
126
+ var weight = jQuery('.weight_' + product).val();
127
+ var tax_status = jQuery('.tax_status' + product).val();
128
+ var tax_class = jQuery('.tax_class' + product).val();
129
+ var shipping_class = jQuery('.shipping_class' + product).val();
130
+ var secure = jQuery('.wsm-ajax-nonce_' + product).val();
131
+
132
+ var data = {
133
+ action : 'save_one_product',
134
+ product : product,
135
+ sku : sku,
136
+ manage_stock : manage_stock,
137
+ stock_status : stock_status,
138
+ backorders : backorders,
139
+ stock : stock,
140
+ regular_price : regular_price,
141
+ sales_price : sales_price,
142
+ weight : weight,
143
+ tax_status : tax_status,
144
+ tax_class : tax_class,
145
+ shipping_class : shipping_class,
146
+ secure : secure
147
+ };
148
+
149
+ jQuery.post(ajaxurl, data, function(response){
150
+ jQuery('.lineloader').css('display','none');
151
+ });
152
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
+ /**
155
+ * Show variations of selected product
156
+ *
157
+ */
158
+ jQuery('.show-variable').on('click', function(){
159
+ var variable = jQuery(this).data('variable');
160
+ jQuery('.variation-item-' + variable).toggleClass('show-variations');
161
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
+ /**
164
+ * Navigation
165
+ *
166
+ */
167
+ jQuery('.stock-manager-navigation li span').on('click', function(){
168
+ jQuery('.stock-manager-navigation li span').removeClass('activ');
169
+ jQuery(this).addClass('activ');
170
+ });
171
+ jQuery('.stock-manager-navigation li span.navigation-filter-default').on('click', function(){
172
+ jQuery('.filter-block').removeClass('active-filter');
173
+ jQuery('.stock-filter').addClass('active-filter');
174
+ });
175
+ jQuery('.stock-manager-navigation li span.navigation-filter-by-sku').on('click', function(){
176
+ jQuery('.filter-block').removeClass('active-filter');
177
+ jQuery('.filter-by-sku').addClass('active-filter');
178
+ });
179
+ jQuery('.stock-manager-navigation li span.navigation-filter-by-title').on('click', function(){
180
+ jQuery('.filter-block').removeClass('active-filter');
181
+ jQuery('.filter-by-title').addClass('active-filter');
182
+ });
183
+ jQuery('.stock-manager-navigation li span.navigation-filter-display').on('click', function(){
184
+ jQuery('.filter-block').removeClass('active-filter');
185
+ jQuery('.filter-display').addClass('active-filter');
186
+ });
187
+
188
+ //Open box for product title saving
189
+ jQuery('.table_name_box .dashicons').on('click', function(){
190
+ var item = jQuery(this).data('item');
191
+ jQuery('.item-post-title-wrap-'+item).css('display','block');
192
+ });
193
+ //Close box for product title saving
194
+ jQuery('.item-post-title-button-close').on('click', function(){
195
+ jQuery(this).parent().css('display', 'none');
196
+ });
197
+ //Save product title
198
+ jQuery('.item-post-title-button').on('click', function(ajax_object){
199
+
200
+ var item = jQuery(this).data('item');
201
+ var title = jQuery('.item-post-title-'+item).val();
202
+ var data = {
203
+ action : 'wsm_save_title_product',
204
+ item : item,
205
+ title : title,
206
+ secure : ajax_object.ajax_nonce
207
+ };
208
+ jQuery('.item-post-title-'+item).val(title);
209
+ jQuery('.item-post-link-'+item).text(title);
210
+
211
+ jQuery.post(ajaxurl, data, function(response, item, title){
212
+ jQuery('.item-post-title-wrap-'+response).css('display', 'none');
213
+ });
214
+
215
+ });
216
+
217
+ //Open box for sku saving
218
+ jQuery('.item_sku_box .dashicons').on('click', function(){
219
+ var item = jQuery(this).data('item');
220
+ jQuery('.item-sku-wrap-'+item).css('display','block');
221
+ });
222
+ //Close box for sku saving
223
+ jQuery('.item-sku-button-close').on('click', function(){
224
+ jQuery(this).parent().css('display', 'none');
225
+ });
226
+ //Save sku
227
+ jQuery('.item-sku-button').on('click', function(ajax_object){
228
+
229
+ var item = jQuery(this).data('item');
230
+ var sku = jQuery('.sku_'+item).val();
231
+ var data = {
232
+ action : 'wsm_save_sku',
233
+ item : item,
234
+ sku : sku,
235
+ secure : ajax_object.ajax_nonce
236
+ };
237
+ jQuery('.sku_-'+item).val(sku);
238
+ jQuery('.item-sku-text-'+item).text(sku);
239
+
240
+ jQuery.post(ajaxurl, data, function(response, item, sku){
241
+ jQuery('.item-sku-wrap-'+response).css('display', 'none');
242
+ });
243
+
244
+ });
245
 
246
  });
247
 
admin/assets/js/subscribe.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function () {
2
+ // For Klawoo subscribe
3
+ jQuery("form[name=wsm_klawoo_subscribe]").submit(function (e) {
4
+ e.preventDefault();
5
+ var formData = {};
6
+ jQuery.each(jQuery('form[name=wsm_klawoo_subscribe]').serializeArray(), function() {
7
+ formData[this.name] = this.value;
8
+ });
9
+
10
+ var data = {
11
+ action : 'wsm_klawoo_subscribe',
12
+ params : formData,
13
+ };
14
+
15
+ jQuery.post( ajaxurl, data, function( response ) {
16
+ var result = jQuery(response);
17
+ if ( result.find("h2").text() == "You\'re subscribed!" ) {
18
+ jQuery("td[id=wsm_promo_msg_content]").html("<div class='wsm_success'>Thank you for subscribing!!!</div>");
19
+ }
20
+
21
+ });
22
+ });
23
+ });
admin/class-stock-manager-admin.php CHANGED
@@ -55,6 +55,10 @@ class Stock_Manager_Admin {
55
  add_action( 'admin_init', array( $this, 'generate_csv_file' ) );
56
 
57
  add_action( 'admin_init', array( $this, 'wsm_dismiss_admin_notice' ) );
 
 
 
 
58
  }
59
 
60
  /**
@@ -80,11 +84,25 @@ class Stock_Manager_Admin {
80
  * @since 1.0.0
81
  */
82
  private function includes() {
 
 
 
 
 
 
 
 
 
 
 
 
83
  if( isset( $_GET ) && isset( $_GET['page'] ) ) {
84
  if ( 'stock-manager' === $_GET['page'] || 'stock-manager-import-export' === $_GET['page'] || 'stock-manager-log' === $_GET['page'] || 'stock-manager-setting' === $_GET['page'] || 'stock-manager-storeapps-plugins' === $_GET['page'] ) {
85
- $this->may_be_show_sa_in_app_offer();
86
  }
87
  }
 
 
88
  }
89
 
90
  /**
@@ -104,7 +122,7 @@ class Stock_Manager_Admin {
104
  * @return null Return early if no settings page is registered.
105
  */
106
  public function enqueue_admin_styles() {
107
- if( isset( $_GET['page'] ) && ( $_GET['page'] == 'stock-manager' || $_GET['page'] == 'stock-manager-import-export' || $_GET['page'] == 'stock-manager-log' ) ){
108
  wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), Stock_Manager::VERSION );
109
 
110
  $old_styles = get_option( 'woocommerce_stock_old_styles' );
@@ -121,13 +139,12 @@ class Stock_Manager_Admin {
121
  * @return null Return early if no settings page is registered.
122
  */
123
  public function enqueue_admin_scripts() {
124
- if( isset( $_GET['page'] ) && ( $_GET['page'] == 'stock-manager' || $_GET['page'] == 'stock-manager-import-export' ) ){
125
-
126
- $low_stock_threshold = get_option( 'woocommerce_notify_low_stock_amount', 5 );
127
- $low_stock_threshold = ( ! empty( $low_stock_threshold ) ) ? $low_stock_threshold : 5;
128
 
129
  $params = array(
130
- 'ajax_nonce' => wp_create_nonce('wsm_update'),
131
  );
132
  wp_localize_script( $this->plugin_slug . '-admin-script', 'ajax_object', $params );
133
  wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), Stock_Manager::VERSION );
@@ -168,6 +185,16 @@ class Stock_Manager_Admin {
168
 
169
  wp_set_script_translations( $this->plugin_slug . '-admin-script-react', 'stock-manager', STOCKDIR . 'languages' );
170
  }
 
 
 
 
 
 
 
 
 
 
171
  }
172
 
173
  public function get_free_menu_position($start, $increment = 0.0001) {
@@ -455,4 +482,140 @@ class Stock_Manager_Admin {
455
 
456
  }
457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  }//End class
55
  add_action( 'admin_init', array( $this, 'generate_csv_file' ) );
56
 
57
  add_action( 'admin_init', array( $this, 'wsm_dismiss_admin_notice' ) );
58
+
59
+ // To update footer text on WSM screens.
60
+ add_filter( 'admin_footer_text', array( $this, 'wsm_footer_text' ), 99999 );
61
+ add_filter( 'update_footer', array( $this, 'wsm_update_footer_text' ), 99999 );
62
  }
63
 
64
  /**
84
  * @since 1.0.0
85
  */
86
  private function includes() {
87
+ $is_wsm_admin = $this->is_wsm_admin_page();
88
+ if ( $is_wsm_admin ) {
89
+ $this->may_be_show_sa_in_app_offer();
90
+ $this->wsm_add_subscribe_notice();
91
+
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Function to check if WSM admin page.
97
+ */
98
+ public function is_wsm_admin_page() {
99
  if( isset( $_GET ) && isset( $_GET['page'] ) ) {
100
  if ( 'stock-manager' === $_GET['page'] || 'stock-manager-import-export' === $_GET['page'] || 'stock-manager-log' === $_GET['page'] || 'stock-manager-setting' === $_GET['page'] || 'stock-manager-storeapps-plugins' === $_GET['page'] ) {
101
+ return true;
102
  }
103
  }
104
+
105
+ return false;
106
  }
107
 
108
  /**
122
  * @return null Return early if no settings page is registered.
123
  */
124
  public function enqueue_admin_styles() {
125
+ if( isset( $_GET['page'] ) && ( $_GET['page'] == 'stock-manager' || $_GET['page'] == 'stock-manager-import-export' || $_GET['page'] == 'stock-manager-log' ) ){
126
  wp_enqueue_style( $this->plugin_slug .'-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), Stock_Manager::VERSION );
127
 
128
  $old_styles = get_option( 'woocommerce_stock_old_styles' );
139
  * @return null Return early if no settings page is registered.
140
  */
141
  public function enqueue_admin_scripts() {
142
+ if( isset( $_GET['page'] ) && ( $_GET['page'] == 'stock-manager' || $_GET['page'] == 'stock-manager-import-export' ) ) {
143
+ $low_stock_threshold = get_option( 'woocommerce_notify_low_stock_amount', 5 );
144
+ $low_stock_threshold = ( ! empty( $low_stock_threshold ) ) ? $low_stock_threshold : 5;
 
145
 
146
  $params = array(
147
+ 'ajax_nonce' => wp_create_nonce( 'wsm_update' ),
148
  );
149
  wp_localize_script( $this->plugin_slug . '-admin-script', 'ajax_object', $params );
150
  wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), Stock_Manager::VERSION );
185
 
186
  wp_set_script_translations( $this->plugin_slug . '-admin-script-react', 'stock-manager', STOCKDIR . 'languages' );
187
  }
188
+
189
+ $is_wsm_admin = $this->is_wsm_admin_page();
190
+ if ( $is_wsm_admin ) {
191
+ $params = array(
192
+ 'ajax_nonce' => wp_create_nonce( 'wsm_update' ),
193
+ );
194
+ wp_localize_script( $this->plugin_slug . '-admin-script-w', 'ajax_object', $params );
195
+ wp_enqueue_script( $this->plugin_slug . '-admin-script-w', plugins_url( 'assets/js/subscribe.js', __FILE__ ), array( 'jquery' ), Stock_Manager::VERSION );
196
+
197
+ }
198
  }
199
 
200
  public function get_free_menu_position($start, $increment = 0.0001) {
482
 
483
  }
484
 
485
+ /**
486
+ * Function to show notice in the admin.
487
+ */
488
+ public function wsm_add_subscribe_notice() {
489
+ $wsm_dismiss_admin_notice = get_option( 'wsm_dismiss_subscribe_admin_notice', false );
490
+
491
+ if ( empty( $wsm_dismiss_admin_notice ) ) {
492
+ ?>
493
+ <style type="text/css">
494
+ #wsm_promo_msg {
495
+ display: block !important;
496
+ background-color: #f2f6fc;
497
+ color: #fff;
498
+ border-left-color: #5850ec;
499
+ }
500
+ #wsm_promo_msg table {
501
+ width: 100%;
502
+ padding-bottom: 0.25em;
503
+ }
504
+ #wsm_promo_msg #dashicon {
505
+ width: 3%;
506
+ }
507
+ #wsm_dashicon {
508
+ padding: 0.5em;
509
+ }
510
+ #wsm_promo_msg_content {
511
+ padding: 0.5em;
512
+ }
513
+ #wsm_promo_msg .dashicons.dashicons-awards {
514
+ font-size: 4em;
515
+ color: #b08d57;
516
+ margin-left: -0.2em;
517
+ margin-bottom: 0.65em;
518
+ }
519
+ .wsm_headline {
520
+ padding: 0.5em 0;
521
+ font-size: 1.1em;
522
+ }
523
+ form.wsm_klawoo_subscribe {
524
+ padding: 0.5em 0;
525
+ margin-block-end: 0 !important;
526
+ }
527
+ form.wsm_klawoo_subscribe #email {
528
+ width: 14em;
529
+ height: 1.75em;
530
+ }
531
+ form.wsm_klawoo_subscribe #wsm_gdpr_agree {
532
+ margin-left: 0.5em;
533
+ vertical-align: sub;
534
+ }
535
+ form.wsm_klawoo_subscribe .wsm_gdpr_label {
536
+ margin-right: 0.5em;
537
+ }
538
+ form.wsm_klawoo_subscribe #wsm_submit {
539
+ font-size: 1.1em;
540
+ line-height: 0em;
541
+ margin-top: 0;
542
+ font-weight: bold;
543
+ background: #5850ec;
544
+ border-color: #5850ec;
545
+ }
546
+ .wsm_success {
547
+ font-size: 1.3em;
548
+ font-weight: bold;
549
+ }
550
+ </style>
551
+ <div id="wsm_promo_msg" class="updated fade">
552
+ <table>
553
+ <tbody>
554
+ <tr>
555
+ <td id="wsm_dashicon">
556
+ <span class="dashicons dashicons-awards"></span>
557
+ </td>
558
+ <td id="wsm_promo_msg_content">
559
+ <div class="wsm_headline">Get latest hacks & tips to better manage your store using WooCommerce Stock Manager!</div>
560
+ <form name="wsm_klawoo_subscribe" class="wsm_klawoo_subscribe" action="#" method="POST" accept-charset="utf-8">
561
+ <input type="email" class="regular-text ltr" name="email" id="email" placeholder="Your email address" required="required" />
562
+ <input type="checkbox" name="wsm_gdpr_agree" id="wsm_gdpr_agree" value="1" required="required" />
563
+ <label for="wsm_gdpr_agree" class="wsm_gdpr_label">I have read and agreed to your <a href="https://www.storeapps.org/privacy-policy/" target="_blank">Privacy Policy</a>.</label>
564
+ <input type="hidden" name="list" value="3pFQTnTsH763gAKTuvOGhPzA"/>
565
+ <input type="submit" name="submit" id="wsm_submit" class="button button-primary" value="Subscribe" />
566
+ </form>
567
+ </td>
568
+ </tr>
569
+ </tbody>
570
+ </table>
571
+ </div>
572
+ <?php
573
+ }
574
+ }
575
+
576
+ /**
577
+ * Function to ask to review the plugin in footer
578
+ *
579
+ * @param string $wsm_rating_text Text in footer (left).
580
+ * @return string $wsm_rating_text
581
+ */
582
+ public function wsm_footer_text( $wsm_rating_text ) {
583
+
584
+ $is_wsm_admin = $this->is_wsm_admin_page();
585
+ if ( $is_wsm_admin ) {
586
+ /* translators: %1$s & %2$s: Opening & closing strong tag. %3$s: link to WooCommerce Stock Manager on WordPress.org */
587
+ $wsm_rating_text = sprintf( __( 'If you are liking %1$sWooCommerce Stock Manager%2$s, please rate us %3$s. A huge thanks from StoreApps in advance!', 'woocommerce-stock-manager' ), '<strong>', '</strong>', '<a target="_blank" href="' . esc_url( 'https://wordpress.org/support/plugin/woocommerce-stock-manager/reviews/?filter=5' ) . '" style="color: #5850EC;">5-star</a>' );
588
+ }
589
+
590
+ return $wsm_rating_text;
591
+
592
+ }
593
+
594
+ /**
595
+ * Function to show installed version of the plugin
596
+ *
597
+ * @param string $wsm_text Text in footer (right).
598
+ * @return string $wsm_text
599
+ */
600
+ public function wsm_update_footer_text( $wsm_text ) {
601
+
602
+ $is_wsm_admin = $this->is_wsm_admin_page();
603
+ if ( $is_wsm_admin ) {
604
+ $wsm_text = 'Installed Version: '. Stock_Manager::VERSION . '!';
605
+ ?>
606
+ <style type="text/css">
607
+ #wpfooter {
608
+ position: unset;
609
+ }
610
+ #wpfooter #footer-upgrade {
611
+ color: #5850EC;
612
+ }
613
+ </style>
614
+ <?php
615
+ }
616
+
617
+ return $wsm_text;
618
+
619
+ }
620
+
621
  }//End class
admin/views/class-storeapps-marketplace.php CHANGED
@@ -20,8 +20,9 @@ class WSM_StoreApps_Marketplace {
20
  body {
21
  background-color: white;
22
  }
 
23
  #wpfooter {
24
- display: none;
25
  }
26
  .wsm-marketplace .addons-banner-block-items {
27
  display: flex;
20
  body {
21
  background-color: white;
22
  }
23
+ #wsm_promo_msg,
24
  #wpfooter {
25
+ display: none !important;
26
  }
27
  .wsm-marketplace .addons-banner-block-items {
28
  display: flex;
languages/woocommerce-stock-manager.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the WooCommerce Stock Manager plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Stock Manager 2.5.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-stock-manager\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-03-19T11:57:18+05:30\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.1.0\n"
15
  "X-Domain: woocommerce-stock-manager\n"
@@ -34,41 +34,46 @@ msgstr ""
34
  msgid "https://www.storeapps.org/"
35
  msgstr ""
36
 
37
- #: admin/class-stock-manager-admin.php:152
38
  #: admin/includes/wcm-class-table.php:541
39
  msgid "No shipping class"
40
  msgstr ""
41
 
42
- #: admin/class-stock-manager-admin.php:158
43
  msgid "Taxable"
44
  msgstr ""
45
 
46
- #: admin/class-stock-manager-admin.php:159
47
  msgid "Shipping only"
48
  msgstr ""
49
 
50
- #: admin/class-stock-manager-admin.php:160
51
  msgctxt "Tax status"
52
  msgid "None"
53
  msgstr ""
54
 
55
- #: admin/class-stock-manager-admin.php:163
56
  #: admin/includes/wcm-class-table.php:634
57
  #: admin/includes/wcm-class-table.php:664
58
  msgid "No"
59
  msgstr ""
60
 
61
- #: admin/class-stock-manager-admin.php:164
62
  #: admin/includes/wcm-class-table.php:665
63
  msgid "Notify"
64
  msgstr ""
65
 
66
- #: admin/class-stock-manager-admin.php:165
67
  #: admin/includes/wcm-class-table.php:633
68
  #: admin/includes/wcm-class-table.php:666
69
  msgid "Yes"
70
  msgstr ""
71
 
 
 
 
 
 
72
  #: admin/includes/config.php:6
73
  #: admin/includes/config.php:16
74
  #: admin/includes/config.php:21
2
  # This file is distributed under the same license as the WooCommerce Stock Manager plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Stock Manager 2.5.6\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-stock-manager\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-03-26T16:27:43+05:30\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.1.0\n"
15
  "X-Domain: woocommerce-stock-manager\n"
34
  msgid "https://www.storeapps.org/"
35
  msgstr ""
36
 
37
+ #: admin/class-stock-manager-admin.php:169
38
  #: admin/includes/wcm-class-table.php:541
39
  msgid "No shipping class"
40
  msgstr ""
41
 
42
+ #: admin/class-stock-manager-admin.php:175
43
  msgid "Taxable"
44
  msgstr ""
45
 
46
+ #: admin/class-stock-manager-admin.php:176
47
  msgid "Shipping only"
48
  msgstr ""
49
 
50
+ #: admin/class-stock-manager-admin.php:177
51
  msgctxt "Tax status"
52
  msgid "None"
53
  msgstr ""
54
 
55
+ #: admin/class-stock-manager-admin.php:180
56
  #: admin/includes/wcm-class-table.php:634
57
  #: admin/includes/wcm-class-table.php:664
58
  msgid "No"
59
  msgstr ""
60
 
61
+ #: admin/class-stock-manager-admin.php:181
62
  #: admin/includes/wcm-class-table.php:665
63
  msgid "Notify"
64
  msgstr ""
65
 
66
+ #: admin/class-stock-manager-admin.php:182
67
  #: admin/includes/wcm-class-table.php:633
68
  #: admin/includes/wcm-class-table.php:666
69
  msgid "Yes"
70
  msgstr ""
71
 
72
+ #. translators: %1$s & %2$s: Opening & closing strong tag. %3$s: link to WooCommerce Stock Manager on WordPress.org
73
+ #: admin/class-stock-manager-admin.php:587
74
+ msgid "If you are liking %1$sWooCommerce Stock Manager%2$s, please rate us %3$s. A huge thanks from StoreApps in advance!"
75
+ msgstr ""
76
+
77
  #: admin/includes/config.php:6
78
  #: admin/includes/config.php:16
79
  #: admin/includes/config.php:21
public/class-stock-manager.php CHANGED
@@ -17,7 +17,7 @@ class Stock_Manager {
17
  *
18
  * @var string
19
  */
20
- const VERSION = '2.5.5';
21
 
22
  /**
23
  * Plugin slug
17
  *
18
  * @var string
19
  */
20
+ const VERSION = '2.5.6';
21
 
22
  /**
23
  * Plugin slug
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: stock manager, woocommerce, stock management, inventory, products
7
  Requires at least: 5.0.0
8
  Tested up to: 5.7.0
9
  Requires PHP: 5.6
10
- Stable tag: 2.5.5
11
  License: GPLv3
12
 
13
  == Description ==
@@ -80,6 +80,7 @@ Want to add a new language to WooCommerce Stock Manager? Contribute via [transla
80
  Feel free to [contact us](https://www.storeapps.org/support/contact-us/?utm_source=wprepo&utm_medium=web_contact&utm_campaign=wsm_readme).
81
 
82
  **Recommended Readings for faster WooCommerce stock management**
 
83
  1. [How to bulk edit sale price and regular price](https://www.storeapps.org/woocommerce-bulk-edit-price/?utm_source=wprepo&utm_medium=links&utm_campaign=stock_management_how_tos)
84
  2. [How to manage Backorders in bulk?](https://www.storeapps.org/woocommerce-backorder/?utm_source=wprepo&utm_medium=links&utm_campaign=stock_management_how_tos)
85
  3. [How to create Excel-like custom views to manage product stock](https://www.storeapps.org/excel-custom-views-woocommerce-wordpress/?utm_source=wprepo&utm_medium=links&utm_campaign=stock_management_how_tos)
@@ -148,6 +149,11 @@ Be sure, that you have active stock manage.
148
 
149
  == Changelog ==
150
 
 
 
 
 
 
151
  = 2.5.5 (19.03.2021) =
152
  * New: WooCommerce 5.0.0, 5.1.0 compatible
153
  * New: WordPress 5.7.0 compatible
@@ -226,6 +232,9 @@ For the changelog of earlier versions, please refer to the separate [changelog.t
226
 
227
  == Upgrade Notice ==
228
 
 
 
 
229
  = 2.5.5 =
230
  WooCommerce 5.0.0, 5.1.0 compatible, WordPress 5.7.0 compatible, PHP Fatal error: Call to a member function set_sku() on bool when importing products via CSV, jQuery 'ready' event is deprecated, Column names on Import/Export page, POT file. Recommended upgrade.
231
 
7
  Requires at least: 5.0.0
8
  Tested up to: 5.7.0
9
  Requires PHP: 5.6
10
+ Stable tag: 2.5.6
11
  License: GPLv3
12
 
13
  == Description ==
80
  Feel free to [contact us](https://www.storeapps.org/support/contact-us/?utm_source=wprepo&utm_medium=web_contact&utm_campaign=wsm_readme).
81
 
82
  **Recommended Readings for faster WooCommerce stock management**
83
+
84
  1. [How to bulk edit sale price and regular price](https://www.storeapps.org/woocommerce-bulk-edit-price/?utm_source=wprepo&utm_medium=links&utm_campaign=stock_management_how_tos)
85
  2. [How to manage Backorders in bulk?](https://www.storeapps.org/woocommerce-backorder/?utm_source=wprepo&utm_medium=links&utm_campaign=stock_management_how_tos)
86
  3. [How to create Excel-like custom views to manage product stock](https://www.storeapps.org/excel-custom-views-woocommerce-wordpress/?utm_source=wprepo&utm_medium=links&utm_campaign=stock_management_how_tos)
149
 
150
  == Changelog ==
151
 
152
+ = 2.5.6 (26.03.2021) =
153
+ * Update: Admin footer text for WooCommerce Stock Manager pages
154
+ * Update: Code Improvements
155
+ * Update: POT file
156
+
157
  = 2.5.5 (19.03.2021) =
158
  * New: WooCommerce 5.0.0, 5.1.0 compatible
159
  * New: WordPress 5.7.0 compatible
232
 
233
  == Upgrade Notice ==
234
 
235
+ = 2.5.6 =
236
+ Admin footer text for WooCommerce Stock Manager pages, Code Improvements, POT file. Recommended upgrade.
237
+
238
  = 2.5.5 =
239
  WooCommerce 5.0.0, 5.1.0 compatible, WordPress 5.7.0 compatible, PHP Fatal error: Call to a member function set_sku() on bool when importing products via CSV, jQuery 'ready' event is deprecated, Column names on Import/Export page, POT file. Recommended upgrade.
240
 
woocommerce-stock-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Stock Manager
4
  * Plugin URI: https://www.storeapps.org/woocommerce-plugins/
5
  * Description: Manage product's stock and price in your WooCommerce store.
6
- * Version: 2.5.5
7
  * Author: StoreApps
8
  * Author URI: https://www.storeapps.org/
9
  * Requires at least: 5.0.0
@@ -25,7 +25,7 @@ if ( ! defined( 'WPINC' ) ) {
25
 
26
  define( 'STOCKDIR', plugin_dir_path( __FILE__ ) );
27
  define( 'STOCKURL', plugin_dir_url( __FILE__ ) );
28
- define( 'STOCKVERSION', '2.5.5' );
29
  if( !defined( 'WSM_PLUGIN_FILE' ) ) {
30
  define( 'WSM_PLUGIN_FILE', __FILE__ );
31
  }
@@ -273,3 +273,54 @@ function wsm_get_product_data(){
273
  exit();
274
 
275
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Plugin Name: WooCommerce Stock Manager
4
  * Plugin URI: https://www.storeapps.org/woocommerce-plugins/
5
  * Description: Manage product's stock and price in your WooCommerce store.
6
+ * Version: 2.5.6
7
  * Author: StoreApps
8
  * Author URI: https://www.storeapps.org/
9
  * Requires at least: 5.0.0
25
 
26
  define( 'STOCKDIR', plugin_dir_path( __FILE__ ) );
27
  define( 'STOCKURL', plugin_dir_url( __FILE__ ) );
28
+ define( 'STOCKVERSION', '2.5.6' );
29
  if( !defined( 'WSM_PLUGIN_FILE' ) ) {
30
  define( 'WSM_PLUGIN_FILE', __FILE__ );
31
  }
273
  exit();
274
 
275
  }
276
+
277
+ // for Klawoo subscribe.
278
+ add_action( 'wp_ajax_wsm_klawoo_subscribe', 'wsm_klawoo_subscribe' );
279
+ function wsm_klawoo_subscribe() {
280
+ $url = 'http://app.klawoo.com/subscribe';
281
+ if( !empty( $_POST ) ) {
282
+ $params = $_POST['params'];
283
+ } else {
284
+ exit();
285
+ }
286
+
287
+ if( empty($params['name']) ) {
288
+ $params['name'] = '';
289
+ }
290
+
291
+ $method = 'POST';
292
+ $qs = http_build_query( $params );
293
+
294
+ $options = array(
295
+ 'timeout' => 15,
296
+ 'method' => $method
297
+ );
298
+
299
+ if ( $method == 'POST' ) {
300
+ $options['body'] = $qs;
301
+ } else {
302
+ if ( strpos( $url, '?' ) !== false ) {
303
+ $url .= '&'.$qs;
304
+ } else {
305
+ $url .= '?'.$qs;
306
+ }
307
+ }
308
+
309
+ $response = wp_remote_request( $url, $options );
310
+ if ( wp_remote_retrieve_response_code( $response ) == 200 ) {
311
+ $data = $response['body'];
312
+
313
+ if ( $data != 'error' ) {
314
+ $message_start = substr( $data, strpos( $data,'<body>' ) + 6 );
315
+ $remove = substr( $message_start, strpos( $message_start,'</body>' ) );
316
+ $message = trim( str_replace( $remove, '', $message_start ) );
317
+
318
+ // Hide the in-app lead notice.
319
+ update_option( 'wsm_dismiss_subscribe_admin_notice', true, 'no' );
320
+
321
+ echo ( $message );
322
+ exit();
323
+ }
324
+ }
325
+ exit();
326
+ }