From 16ba24f9e8337aba88ed85983586d1e45bb49069 Mon Sep 17 00:00:00 2001 From: Michel Velis Date: Thu, 9 Aug 2018 09:44:25 -0400 Subject: [PATCH] third party support --- .../admin/includes/index.html | 0 .../includes/subscriptio}/slm-subscriptio.php | 0 .../includes/wpestores/slm-wpestores.php} | 2 + .../admin/slm-lic-settings.php | 10 +- .../includes/slm-meta-boxes.php | 160 +++++++++++++++++- .../includes/slm_plugin_core.php | 17 +- 6 files changed, 182 insertions(+), 7 deletions(-) delete mode 100644 software-license-manager/admin/includes/index.html rename software-license-manager/{includes => admin/includes/subscriptio}/slm-subscriptio.php (100%) rename software-license-manager/{includes/slm-third-party-integration.php => admin/includes/wpestores/slm-wpestores.php} (99%) diff --git a/software-license-manager/admin/includes/index.html b/software-license-manager/admin/includes/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/software-license-manager/includes/slm-subscriptio.php b/software-license-manager/admin/includes/subscriptio/slm-subscriptio.php similarity index 100% rename from software-license-manager/includes/slm-subscriptio.php rename to software-license-manager/admin/includes/subscriptio/slm-subscriptio.php diff --git a/software-license-manager/includes/slm-third-party-integration.php b/software-license-manager/admin/includes/wpestores/slm-wpestores.php similarity index 99% rename from software-license-manager/includes/slm-third-party-integration.php rename to software-license-manager/admin/includes/wpestores/slm-wpestores.php index 0cdf087..205aeb0 100644 --- a/software-license-manager/includes/slm-third-party-integration.php +++ b/software-license-manager/admin/includes/wpestores/slm-wpestores.php @@ -1,7 +1,9 @@ isset($_POST['enable_debug']) ? '1':'', 'slm_woo' => isset($_POST['slm_woo']) ? '1':'', 'slm_subscriptio' => isset($_POST['slm_subscriptio']) ? '1':'', + 'slm_wpestores' => isset($_POST['slm_wpestores']) ? '1':'', ); update_option('slm_plugin_options', $options); @@ -138,8 +139,15 @@ function wp_lic_mgr_general_settings() { value="1"/>
Subscriptio is a WooCommerce extension that allows you to sell subscriptions. Subscriptio adds recurring payments capability to WooCommerce so you can sell products like magazine subscriptions, online memberships, e-learning packages and any other tangible or intangible products. Learn More - + + WP eStores Support + + value="1"/>
+ WordPress eStore Plugin – Complete Solution to Sell Digital Products from Your WordPress Blog Securely + + diff --git a/software-license-manager/includes/slm-meta-boxes.php b/software-license-manager/includes/slm-meta-boxes.php index 00ed4e1..cbde8ef 100644 --- a/software-license-manager/includes/slm-meta-boxes.php +++ b/software-license-manager/includes/slm-meta-boxes.php @@ -61,4 +61,162 @@ function save_variation_fields( $variation_id, $i) { $text_field = stripslashes( $_POST['amount_of_licenses_devices'][$i] ); update_post_meta( $variation_id, 'amount_of_licenses_devices', esc_attr( $text_field ) ); -} \ No newline at end of file +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter +add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' ); +function add_my_custom_product_data_tab( $product_data_tabs ) { + $product_data_tabs['my-custom-tab'] = array( + 'label' => __( 'License', 'woocommerce' ), + 'target' => 'my_custom_product_data', + 'class' => array( 'show_if_simple', 'show_if_variable' ), + ); + return $product_data_tabs; +} + + + + + +// functions you can call to output text boxes, select boxes, etc. +add_action('woocommerce_product_data_panels', 'woocom_custom_product_data_fields'); + +function woocom_custom_product_data_fields() { + global $post; + + // Note the 'id' attribute needs to match the 'target' parameter set above + ?>
'_text_field', + 'label' => __( 'Custom Text Field', 'woocommerce' ), + 'wrapper_class' => 'show_if_simple', //show_if_simple or show_if_variable + 'placeholder' => 'Custom text field', + 'desc_tip' => 'true', + 'description' => __( 'Enter the custom value here.', 'woocommerce' ) + ) + ); + + // Number Field + woocommerce_wp_text_input( + array( + 'id' => '_number_field', + 'label' => __( 'Custom Number Field', 'woocommerce' ), + 'placeholder' => '', + 'description' => __( 'Enter the custom value here.', 'woocommerce' ), + 'type' => 'number', + 'custom_attributes' => array( + 'step' => 'any', + 'min' => '15' + ) + ) + ); + + // Checkbox + woocommerce_wp_checkbox( + array( + 'id' => '_checkbox', + 'label' => __('Custom Checkbox Field', 'woocommerce' ), + 'description' => __( 'Check me!', 'woocommerce' ) + ) + ); + + // Select + woocommerce_wp_select( + array( + 'id' => '_select', + 'label' => __( 'Custom Select Field', 'woocommerce' ), + 'options' => array( + 'one' => __( 'Custom Option 1', 'woocommerce' ), + 'two' => __( 'Custom Option 2', 'woocommerce' ), + 'three' => __( 'Custom Option 3', 'woocommerce' ) + ) + ) + ); + + // Textarea + woocommerce_wp_textarea_input( + array( + 'id' => '_textarea', + 'label' => __( 'Custom Textarea', 'woocommerce' ), + 'placeholder' => '', + 'description' => __( 'Enter the value here.', 'woocommerce' ) + ) + ); + ?>
+ +