@@ -167,7 +167,19 @@ public function screen_option() {
167
167
*/
168
168
public function wc_order_view_page () {
169
169
170
- require_once plugin_dir_path ( dirname ( __FILE__ ) ) . 'admin/partials/wc-order-view-admin-display.php ' ;
170
+ if ( isset ( $ _GET [ 'action ' ] ) && $ _GET [ 'action ' ] == "view " ) {
171
+
172
+ $ order = new WC_Order ( $ _GET [ 'order_id ' ] );
173
+
174
+ $ user = $ order ->get_user ();
175
+
176
+ require_once plugin_dir_path ( dirname ( __FILE__ ) ) . 'admin/partials/wc-order-view-order-details-display.php ' ;
177
+
178
+ } else {
179
+
180
+ require_once plugin_dir_path ( dirname ( __FILE__ ) ) . 'admin/partials/wc-order-view-admin-display.php ' ;
181
+
182
+ }
171
183
172
184
}
173
185
@@ -178,18 +190,27 @@ public function wc_order_view_page() {
178
190
*/
179
191
public function register_wc_order_view_settings () {
180
192
181
- //general tab settings
182
193
add_settings_section ("wc_order_view_general_settings " , "General Settings " , null , "wc-order-view-settings " );
183
194
184
195
add_settings_field ("wcov_display_mode " , "Display Mode " , array ( $ this , "wcov_display_mode_callback " ), "wc-order-view-settings " , "wc_order_view_general_settings " );
185
196
add_settings_field ("wcov_display_billing_info " , "Billing Details " , array ( $ this , "wcov_display_billing_info_callback " ), "wc-order-view-settings " , "wc_order_view_general_settings " );
186
197
add_settings_field ("wcov_display_shipping_info " , "Shipping Details " , array ( $ this , "wcov_display_shipping_info_callback " ), "wc-order-view-settings " , "wc_order_view_general_settings " );
187
198
add_settings_field ("wcov_display_order_notes " , "Order Notes " , array ( $ this , "wcov_display_order_notes_callback " ), "wc-order-view-settings " , "wc_order_view_general_settings " );
188
199
189
- register_setting ( 'wc_order_view_general_settings ' , 'wcov_display_mode ' );
190
- register_setting ( 'wc_order_view_general_settings ' , 'wcov_display_billing_info ' );
191
- register_setting ( 'wc_order_view_general_settings ' , 'wcov_display_shipping_info ' );
192
- register_setting ( 'wc_order_view_general_settings ' , 'wcov_display_order_notes ' );
200
+ register_setting ( 'wc_order_view_settings ' , 'wcov_display_mode ' );
201
+ register_setting ( 'wc_order_view_settings ' , 'wcov_display_billing_info ' );
202
+ register_setting ( 'wc_order_view_settings ' , 'wcov_display_shipping_info ' );
203
+ register_setting ( 'wc_order_view_settings ' , 'wcov_display_order_notes ' );
204
+
205
+ add_settings_section ("wc_order_view_third_party_plugins_settings " , "Third Party Plugins Support " , null , "wc-order-view-settings " );
206
+
207
+ add_settings_field ("wcov_pdf_invoices " , "PDF Invoices " , array ( $ this , "wcov_pdf_invoices_callback " ), "wc-order-view-settings " , "wc_order_view_third_party_plugins_settings " );
208
+ add_settings_field ("wcov_subscriptions " , "Woocommerce Subscriptions " , array ( $ this , "wcov_subscriptions_callback " ), "wc-order-view-settings " , "wc_order_view_third_party_plugins_settings " );
209
+ add_settings_field ("wcov_api_manager " , "Woocommerce API Manager " , array ( $ this , "wcov_api_manager_callback " ), "wc-order-view-settings " , "wc_order_view_third_party_plugins_settings " );
210
+
211
+ register_setting ( 'wc_order_view_settings ' , 'wcov_pdf_invoices ' );
212
+ register_setting ( 'wc_order_view_settings ' , 'wcov_subscriptions ' );
213
+ register_setting ( 'wc_order_view_settings ' , 'wcov_api_manager ' );
193
214
194
215
}
195
216
@@ -293,6 +314,102 @@ public function wcov_display_order_notes_callback() {
293
314
294
315
}
295
316
317
+ /**
318
+ * Callback to enable "PDF Invoices" setting.
319
+ *
320
+ * @since 1.0.0
321
+ */
322
+ public function wcov_pdf_invoices_callback () {
323
+
324
+ $ active_plugins = get_option ( 'active_plugins ' );
325
+
326
+ if ( ! in_array ( "woocommerce-pdf-invoice/woocommerce-pdf-invoice.php " , $ active_plugins ) ) {
327
+ ?>
328
+ This plugin is currently inactive / not installed in your site. To know more about this plugin please visit <a href="https://woocommerce.com/products/pdf-invoices/">PDF Invoices</a>
329
+ <?php
330
+ } else {
331
+ $ current_option = get_option ( 'wcov_pdf_invoices ' );
332
+
333
+ if ( $ current_option == "" ) {
334
+ update_option ( 'wcov_pdf_invoices ' , 'disabled ' );
335
+ $ current_option = get_option ( 'wcov_pdf_invoices ' );
336
+ }
337
+
338
+ ?>
339
+ <div class="switch-field">
340
+ <input type="radio" id="wcov_pdf_invoices_enabled" name="wcov_pdf_invoices" value="enabled" <?php echo ( $ current_option == "enabled " ) ? "checked " : "" ; ?> />
341
+ <label for="wcov_pdf_invoices_enabled">Enabled</label>
342
+ <input type="radio" id="wcov_pdf_invoices_disabled" name="wcov_pdf_invoices" value="disabled" <?php echo ( $ current_option == "disabled " ) ? "checked " : "" ; ?> />
343
+ <label for="wcov_pdf_invoices_disabled">Disabled</label>
344
+ </div>
345
+ <?php
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Callback to enable "Subscriptions" setting.
351
+ *
352
+ * @since 1.0.0
353
+ */
354
+ public function wcov_subscriptions_callback () {
355
+
356
+ $ active_plugins = get_option ( 'active_plugins ' );
357
+
358
+ if ( ! in_array ( "woocommerce-subscriptions/woocommerce-subscriptions.php " , $ active_plugins ) ) {
359
+ ?>
360
+ This plugin is currently inactive / not installed in your site. To know more about this plugin please visit <a href="https://woocommerce.com/products/woocommerce-subscriptions/">WooCommerce Subscriptions</a>
361
+ <?php
362
+ } else {
363
+ $ current_option = get_option ( 'wcov_subscriptions ' );
364
+
365
+ if ( $ current_option == "" ) {
366
+ update_option ( 'wcov_subscriptions ' , 'disabled ' );
367
+ $ current_option = get_option ( 'wcov_subscriptions ' );
368
+ }
369
+
370
+ ?>
371
+ <div class="switch-field">
372
+ <input type="radio" id="wcov_subscriptions_enabled" name="wcov_subscriptions" value="enabled" <?php echo ( $ current_option == "enabled " ) ? "checked " : "" ; ?> />
373
+ <label for="wcov_subscriptions_enabled">Enabled</label>
374
+ <input type="radio" id="wcov_subscriptions_disabled" name="wcov_subscriptions" value="disabled" <?php echo ( $ current_option == "disabled " ) ? "checked " : "" ; ?> />
375
+ <label for="wcov_subscriptions_disabled">Disabled</label>
376
+ </div>
377
+ <?php
378
+ }
379
+ }
380
+
381
+ /**
382
+ * Callback to enable "API Manager" setting.
383
+ *
384
+ * @since 1.0.0
385
+ */
386
+ public function wcov_api_manager_callback () {
387
+
388
+ $ active_plugins = get_option ( 'active_plugins ' );
389
+
390
+ if ( ! in_array ( "woocommerce-api-manager/woocommerce-api-manager.php " , $ active_plugins ) ) {
391
+ ?>
392
+ This plugin is currently inactive / not installed in your site. To know more about this plugin please visit <a href="https://woocommerce.com/products/woocommerce-api-manager/">WooCommerce API Manager</a>
393
+ <?php
394
+ } else {
395
+ $ current_option = get_option ( 'wcov_api_manager ' );
396
+
397
+ if ( $ current_option == "" ) {
398
+ update_option ( 'wcov_api_manager ' , 'disabled ' );
399
+ $ current_option = get_option ( 'wcov_api_manager ' );
400
+ }
401
+
402
+ ?>
403
+ <div class="switch-field">
404
+ <input type="radio" id="wcov_api_manager_enabled" name="wcov_api_manager" value="enabled" <?php echo ( $ current_option == "enabled " ) ? "checked " : "" ; ?> />
405
+ <label for="wcov_api_manager_enabled">Enabled</label>
406
+ <input type="radio" id="wcov_api_manager_disabled" name="wcov_api_manager" value="disabled" <?php echo ( $ current_option == "disabled " ) ? "checked " : "" ; ?> />
407
+ <label for="wcov_api_manager_disabled">Disabled</label>
408
+ </div>
409
+ <?php
410
+ }
411
+ }
412
+
296
413
/**
297
414
* WC Order View settings page that controls enabling and disabling of certain key features.
298
415
*
0 commit comments