Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFW-334 #1261

Merged
merged 8 commits into from Jan 16, 2019

Express Checkout - Button Size Options for Specific Locations, PFW-334

  • Loading branch information...
kcppdevelopers committed Dec 31, 2018
commit 30882c931163d6ef9c1d85f2c70538c14d69770d
@@ -63,6 +63,9 @@ public function __construct() {
$this->testmode_value = !empty($this->setting['testmode']) ? $this->setting['testmode'] : 'yes';
$this->testmode = 'yes' === $this->testmode_value;
$this->billing_address_value = !empty($this->setting['billing_address']) ? $this->setting['billing_address'] : 'no';
// Globale setting
$this->disallowed_funding_methods = !empty($this->setting['disallowed_funding_methods']) ? $this->setting['disallowed_funding_methods'] : array();
if (!in_array('card', $this->disallowed_funding_methods)) {
$this->disallowed_card_types = !empty($this->setting['disallowed_card_types']) ? $this->setting['disallowed_card_types'] : array();
@@ -72,9 +75,71 @@ public function __construct() {
$this->button_color = !empty($this->setting['button_color']) ? $this->setting['button_color'] : 'gold';
$this->button_shape = !empty($this->setting['button_shape']) ? $this->setting['button_shape'] : 'pill';
$this->button_label = !empty($this->setting['button_label']) ? $this->setting['button_label'] : 'checkout';
$this->button_tagline = !empty($this->setting['button_tagline']) ? $this->setting['button_tagline'] : 'false';
$this->button_tagline = !empty($this->setting['button_tagline']) ? $this->setting['button_tagline'] : 'false';
$this->button_layout = !empty($this->setting['button_layout']) ? $this->setting['button_layout'] : 'horizontal';
$this->button_fundingicons = !empty($this->setting['button_fundingicons']) ? $this->setting['button_fundingicons'] : 'false';
// Product Page
$this->single_product_configure_settings_value = !empty($this->setting['single_product_configure_settings']) ? $this->setting['single_product_configure_settings'] : 'no';
$this->single_product_configure_settings = 'yes' === $this->single_product_configure_settings_value;
if($this->single_product_configure_settings) {
$this->single_product_button_layout = !empty($this->setting['single_product_button_layout']) ? $this->setting['single_product_button_layout'] : 'horizontal';
$this->single_product_button_size = !empty($this->setting['single_product_button_size']) ? $this->setting['single_product_button_size'] : 'small';
$this->single_product_disallowed_funding_methods = !empty($this->setting['single_product_disallowed_funding_methods']) ? $this->setting['single_product_disallowed_funding_methods'] : array();
if (!in_array('card', $this->single_product_disallowed_funding_methods)) {
$this->disallowed_card_types = !empty($this->setting['disallowed_card_types']) ? $this->setting['disallowed_card_types'] : array();
$this->single_product_disallowed_funding_methods = array_merge($this->disallowed_card_types, $this->single_product_disallowed_funding_methods);
}
}
// Cart Page
$this->cart_configure_settings_value = !empty($this->setting['cart_configure_settings']) ? $this->setting['cart_configure_settings'] : 'no';
$this->cart_configure_settings = 'yes' === $this->cart_configure_settings_value;
if($this->cart_configure_settings) {
$this->cart_button_layout = !empty($this->setting['cart_button_layout']) ? $this->setting['cart_button_layout'] : 'horizontal';
$this->cart_button_size = !empty($this->setting['cart_button_size']) ? $this->setting['cart_button_size'] : 'small';
$this->cart_disallowed_funding_methods = !empty($this->setting['cart_disallowed_funding_methods']) ? $this->setting['cart_disallowed_funding_methods'] : array();
if (!in_array('card', $this->cart_disallowed_funding_methods)) {
$this->disallowed_card_types = !empty($this->setting['disallowed_card_types']) ? $this->setting['disallowed_card_types'] : array();
$this->cart_disallowed_funding_methods = array_merge($this->disallowed_card_types, $this->cart_disallowed_funding_methods);
}
}
// Mini Cart Page
$this->mini_cart_configure_settings_value = !empty($this->setting['mini_cart_configure_settings']) ? $this->setting['mini_cart_configure_settings'] : 'no';
$this->mini_cart_configure_settings = 'yes' === $this->mini_cart_configure_settings_value;
if($this->mini_cart_configure_settings) {
$this->mini_cart_button_layout = !empty($this->setting['mini_cart_button_layout']) ? $this->setting['mini_cart_button_layout'] : 'horizontal';
$this->mini_cart_button_size = !empty($this->setting['mini_cart_button_size']) ? $this->setting['mini_cart_button_size'] : 'small';
$this->mini_cart_disallowed_funding_methods = !empty($this->setting['mini_cart_disallowed_funding_methods']) ? $this->setting['mini_cart_disallowed_funding_methods'] : array();
if (!in_array('card', $this->mini_cart_disallowed_funding_methods)) {
$this->disallowed_card_types = !empty($this->setting['disallowed_card_types']) ? $this->setting['disallowed_card_types'] : array();
$this->mini_cart_disallowed_funding_methods = array_merge($this->disallowed_card_types, $this->mini_cart_disallowed_funding_methods);
}
}
// Checkout Page
$this->checkout_page_configure_settings_value = !empty($this->setting['checkout_page_configure_settings']) ? $this->setting['checkout_page_configure_settings'] : 'no';
$this->checkout_page_configure_settings = 'yes' === $this->checkout_page_configure_settings_value;
if($this->checkout_page_configure_settings) {
$this->checkout_page_button_layout = !empty($this->setting['checkout_page_button_layout']) ? $this->setting['checkout_page_button_layout'] : 'horizontal';
$this->checkout_page_button_size = !empty($this->setting['checkout_page_button_size']) ? $this->setting['checkout_page_button_size'] : 'small';
$this->checkout_page_disallowed_funding_methods = !empty($this->setting['checkout_page_disallowed_funding_methods']) ? $this->setting['checkout_page_disallowed_funding_methods'] : array();
if (!in_array('card', $this->checkout_page_disallowed_funding_methods)) {
$this->disallowed_card_types = !empty($this->setting['disallowed_card_types']) ? $this->setting['disallowed_card_types'] : array();
$this->checkout_page_disallowed_funding_methods = array_merge($this->disallowed_card_types, $this->checkout_page_disallowed_funding_methods);
}
}
$this->billing_address = 'yes' === $this->billing_address_value;
$this->cancel_page = !empty($this->setting['cancel_page']) ? $this->setting['cancel_page'] : '';
$this->order_review_page_custom_message = !empty($this->setting['order_review_page_custom_message']) ? $this->setting['order_review_page_custom_message'] : '';
@@ -502,6 +567,19 @@ public function ec_enqueue_scripts_product_page($is_mini_cart = false) {
return false;
}
}
if(is_product() && $this->single_product_configure_settings) {
$this->button_layout = $this->single_product_button_layout;
$this->button_size = $this->single_product_button_size;
$this->disallowed_funding_methods = $this->single_product_disallowed_funding_methods;
} elseif(is_cart() && $this->cart_configure_settings) {
$this->button_layout = $this->cart_button_layout;
$this->button_size = $this->cart_button_size;
$this->disallowed_funding_methods = $this->cart_disallowed_funding_methods;
} elseif (is_checkout() && $this->checkout_page_configure_settings) {
$this->button_layout = $this->checkout_page_button_layout;
$this->button_size = $this->checkout_page_button_size;
$this->disallowed_funding_methods = $this->checkout_page_disallowed_funding_methods;
}
if ($this->button_layout == 'vertical') {
$this->button_label = '';
$this->button_tagline = '';
@@ -514,6 +592,9 @@ public function ec_enqueue_scripts_product_page($is_mini_cart = false) {
$this->button_color = '';
$this->button_fundingicons = '';
}
$js_value = array('is_page_name' => '', 'enable_in_context_checkout_flow' => ( $this->enable_in_context_checkout_flow == 'yes' ? 'yes' : 'no'));
if ($this->angelleye_is_in_context_enable() == true) {
$cancel_url = !empty($this->cancel_page) ? get_permalink($this->cancel_page) : wc_get_cart_url();
@@ -1166,19 +1166,19 @@ public function init_form_fields() {
'class' => '',
'description' => '<div><div class="display_smart_button_previews_button"></div><div class="display_smart_button_previews"></div></div>',
),
'mini_cart_button_settings' => array(
'title' => __('Mini-cart Button Settings', 'paypal-for-woocommerce'),
'single_product_button_settings' => array(
'title' => __('Single Product Button Settings', 'paypal-for-woocommerce'),
'type' => 'title'
),
'mini_cart_configure_settings' => array(
'single_product_configure_settings' => array(
'title' => __('Configure Settings', 'paypal-for-woocommerce'),
'type' => 'checkbox',
'label' => __( 'Configure settings specific to mini-cart', 'paypal-for-woocommerce' ),
'label' => __( 'Configure settings specific to Single Product', 'paypal-for-woocommerce' ),
'default' => 'no',
'desc_tip' => true,
'description' => __( 'Optionally override global button settings above and configure buttons for this context.', 'paypal-for-woocommerce' ),
),
'mini_cart_button_layout' => array(
'single_product_button_layout' => array(
'title' => __('Button Layout', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
@@ -1190,7 +1190,7 @@ public function init_form_fields() {
'vertical' => __('Vertical', 'paypal-for-woocommerce')
),
),
'mini_cart_button_size' => array(
'single_product_button_size' => array(
'title' => __('Button Size', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
@@ -1204,7 +1204,7 @@ public function init_form_fields() {
'responsive' => __('Responsive', 'paypal-for-woocommerce'),
),
),
'mini_cart_disallowed_funding_methods' => array(
'single_product_disallowed_funding_methods' => array(
'title' => __('Hide Funding Method(s)', 'paypal-for-woocommerce'),
'type' => 'multiselect',
'class' => 'wc-enhanced-select in_context_checkout_part',
@@ -1213,19 +1213,19 @@ public function init_form_fields() {
'desc_tip' => true,
'options' => $this->disallowed_funding_methods_array,
),
'single_product_button_settings' => array(
'title' => __('Single Product Button Settings', 'paypal-for-woocommerce'),
'cart_button_settings' => array(
'title' => __('Cart Button Settings', 'paypal-for-woocommerce'),
'type' => 'title'
),
'single_product_configure_settings' => array(
'cart_configure_settings' => array(
'title' => __('Configure Settings', 'paypal-for-woocommerce'),
'type' => 'checkbox',
'label' => __( 'Configure settings specific to Single Product', 'paypal-for-woocommerce' ),
'label' => __( 'Configure settings specific to Cart', 'paypal-for-woocommerce' ),
'default' => 'no',
'desc_tip' => true,
'description' => __( 'Optionally override global button settings above and configure buttons for this context.', 'paypal-for-woocommerce' ),
),
'single_product_button_layout' => array(
'cart_button_layout' => array(
'title' => __('Button Layout', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
@@ -1237,7 +1237,7 @@ public function init_form_fields() {
'vertical' => __('Vertical', 'paypal-for-woocommerce')
),
),
'single_product_button_size' => array(
'cart_button_size' => array(
'title' => __('Button Size', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
@@ -1251,7 +1251,54 @@ public function init_form_fields() {
'responsive' => __('Responsive', 'paypal-for-woocommerce'),
),
),
'single_product_disallowed_funding_methods' => array(
'cart_disallowed_funding_methods' => array(
'title' => __('Hide Funding Method(s)', 'paypal-for-woocommerce'),
'type' => 'multiselect',
'class' => 'wc-enhanced-select in_context_checkout_part',
'description' => __('Funding methods selected here will be hidden from buyers during checkout.', 'paypal-for-woocommerce'),
'default' => '',
'desc_tip' => true,
'options' => $this->disallowed_funding_methods_array,
),
'mini_cart_button_settings' => array(
'title' => __('Mini-cart Button Settings', 'paypal-for-woocommerce'),
'type' => 'title'
),
'mini_cart_configure_settings' => array(
'title' => __('Configure Settings', 'paypal-for-woocommerce'),
'type' => 'checkbox',
'label' => __( 'Configure settings specific to mini-cart', 'paypal-for-woocommerce' ),
'default' => 'no',
'desc_tip' => true,
'description' => __( 'Optionally override global button settings above and configure buttons for this context.', 'paypal-for-woocommerce' ),
),
'mini_cart_button_layout' => array(
'title' => __('Button Layout', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
'description' => __('Select Vertical for stacked buttons, and Horizontal for side-by-side buttons.', 'paypal-for-woocommerce'),
'default' => 'horizontal',
'desc_tip' => true,
'options' => array(
'horizontal' => __('Horizontal', 'paypal-for-woocommerce'),
'vertical' => __('Vertical', 'paypal-for-woocommerce')
),
),
'mini_cart_button_size' => array(
'title' => __('Button Size', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
'description' => __('Set the size of the buttons you would like displayed. Responsive will fit to the current element on the page.', 'paypal-for-woocommerce'),
'default' => 'small',
'desc_tip' => true,
'options' => array(
'small' => __('Small', 'paypal-for-woocommerce'),
'medium' => __('Medium', 'paypal-for-woocommerce'),
'large' => __('Large', 'paypal-for-woocommerce'),
'responsive' => __('Responsive', 'paypal-for-woocommerce'),
),
),
'mini_cart_disallowed_funding_methods' => array(
'title' => __('Hide Funding Method(s)', 'paypal-for-woocommerce'),
'type' => 'multiselect',
'class' => 'wc-enhanced-select in_context_checkout_part',
@@ -1309,7 +1356,6 @@ public function init_form_fields() {
),
);
if( $this->is_us == true ) {
$this->form_fields['paypal_marketing_solutions'] = array(
'title' => __( '<hr></hr>PayPal Marketing Solutions', 'paypal-for-woocommerce' ),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.