From 0aea9ad353f139be0d1506a69880abda34175a08 Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Thu, 31 Oct 2019 17:17:51 +0530 Subject: [PATCH] Hide all smart button option when Enable Smart Buttons is disable, PFW-517 --- assets/js/angelleye-admin.js | 8 +++++++- classes/wc-gateway-paypal-express-angelleye.php | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/assets/js/angelleye-admin.js b/assets/js/angelleye-admin.js index c17dbedbc..df10e9d69 100644 --- a/assets/js/angelleye-admin.js +++ b/assets/js/angelleye-admin.js @@ -45,6 +45,9 @@ jQuery(document).ready(function ($) { jQuery('woocommerce_paypal_express_enable_google_analytics_click').closest('tr').hide(); jQuery('#woocommerce_paypal_express_checkout_with_pp_button_type').closest('tr').hide(); jQuery('.angelleye_smart_button_setting_left').show(); + jQuery('.in_context_checkout_part').show(); + jQuery('.in_context_checkout_part').next('p').show(); + jQuery('.in_context_checkout_part').parents('table').show(); } else { jQuery('.display_smart_button_previews').hide(); jQuery('.angelleye_button_settings_selector').hide(); @@ -52,7 +55,10 @@ jQuery(document).ready(function ($) { jQuery('#woocommerce_paypal_express_checkout_with_pp_button_type').closest('tr').show(); jQuery('.angelleye_smart_button_setting_left').hide(); jQuery('woocommerce_paypal_express_enable_google_analytics_click').closest('tr').show(); - + jQuery('.in_context_checkout_part').hide(); + jQuery('.in_context_checkout_part').next('p').hide(); + jQuery('.in_context_checkout_part').parents('table').hide(); + } }).change(); $("#woocommerce_paypal_express_customer_service_number").attr("maxlength", "16"); diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index e37b27501..0884c636a 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -1253,6 +1253,7 @@ public function init_form_fields() { ), 'enable_google_analytics_click' => array( 'title' => __('Google Analytics', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __('Enable Google Analytics Click Tracking.'), 'default' => 'no' @@ -1265,11 +1266,13 @@ public function init_form_fields() { ), 'single_product_button_settings' => array( 'title' => __('Single Product Button Settings', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'description' => __( 'Enable the Product specific button settings, and the options set will be applied to the PayPal buttons on your Product pages.', 'paypal-for-woocommerce' ), 'type' => 'title' ), 'single_product_configure_settings' => array( 'title' => __('Enable', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __( 'Configure settings specific to Single Product pages.', 'paypal-for-woocommerce' ), 'default' => 'no', @@ -1313,11 +1316,13 @@ public function init_form_fields() { ), 'cart_button_settings' => array( 'title' => __('Cart Button Settings', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'description' => __( 'Enable the Cart specific button settings, and the options set will be applied to the PayPal buttons on your shopping cart page.', 'paypal-for-woocommerce' ), 'type' => 'title' ), 'cart_configure_settings' => array( 'title' => __('Enable', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __( 'Configure settings specific to the Cart page.', 'paypal-for-woocommerce' ), 'default' => 'no', @@ -1361,11 +1366,13 @@ public function init_form_fields() { ), 'mini_cart_button_settings' => array( 'title' => __('Mini-cart Button Settings', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'description' => __( 'Enable the Mini-Cart specific button settings, and the options set will be applied to the PayPal buttons on your mini-cart.', 'paypal-for-woocommerce' ), 'type' => 'title' ), 'mini_cart_configure_settings' => array( 'title' => __('Enable', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __( 'Configure settings specific to the mini-cart display.', 'paypal-for-woocommerce' ), 'default' => 'no', @@ -1409,11 +1416,13 @@ public function init_form_fields() { ), 'checkout_page_button_settings' => array( 'title' => __('Checkout Page Button Settings', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'description' => __( 'Enable the Checkout Page specific button settings, and the options set will be applied to the PayPal buttons on your Checkout page.', 'paypal-for-woocommerce' ), 'type' => 'title' ), 'checkout_page_configure_settings' => array( 'title' => __('Enable', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __( 'Configure settings specific to the Checkout page.', 'paypal-for-woocommerce' ), 'default' => 'no', @@ -1422,6 +1431,7 @@ public function init_form_fields() { ), 'checkout_page_disable_smart_button' => array( 'title' => __('Enable/Disable', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __( 'Disable smart buttons in the regular list of payment gateways.', 'paypal-for-woocommerce' ), 'default' => 'no', @@ -1467,11 +1477,13 @@ public function init_form_fields() { if (defined('XOO_WSC_PATH')) { $this->form_fields['wsc_cart_button_settings'] = array( 'title' => __('Woo Side Cart Button Settings', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'description' => __( 'Enable the Woo Side Cart specific button settings, and the options set will be applied to the PayPal buttons on your Woo Side Cart.', 'paypal-for-woocommerce' ), 'type' => 'title' ); $this->form_fields['wsc_cart_configure_settings'] = array( 'title' => __('Enable', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __( 'Configure settings specific to the Woo Side Cart display.', 'paypal-for-woocommerce' ), 'default' => 'no', @@ -1480,6 +1492,7 @@ public function init_form_fields() { ); $this->form_fields['wsc_cart_disable_smart_button'] = array( 'title' => __('Enable/Disable', 'paypal-for-woocommerce'), + 'class' => 'in_context_checkout_part', 'type' => 'checkbox', 'label' => __( 'Disable the buttons in the Woo Side Cart', 'paypal-for-woocommerce' ), 'default' => 'no',