Skip to content

Commit

Permalink
Express Checkout - JSv4, ref #997
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed Feb 22, 2018
1 parent c6c1c09 commit 5ba7906
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ public function __construct($version) {
$this->allowed_funding_methods = !empty($this->setting['allowed_funding_methods']) ? $this->setting['allowed_funding_methods'] : array(
'credit', 'card', 'elv'
);
$this->button_size = !empty($this->setting['button_size']) ? $this->setting['button_size'] : 'medium';
$this->button_size = !empty($this->setting['button_size']) ? $this->setting['button_size'] : 'small';
$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_layout = !empty($this->setting['button_layout']) ? $this->setting['button_layout'] : 'horizontal';
$this->button_fundingicons = !empty($this->setting['button_fundingicons']) ? $this->setting['button_fundingicons'] : 'false';
$this->billing_address = 'yes' === $this->billing_address_value;
$this->cancel_page = !empty($this->setting['cancel_page']) ? $this->setting['cancel_page'] : '';
$this->use_wp_locale_code = !empty($this->setting['use_wp_locale_code']) ? $this->setting['use_wp_locale_code'] : 'yes';
Expand Down Expand Up @@ -459,10 +460,11 @@ public function ec_enqueue_scripts_product_page() {
if($this->button_layout == 'vertical') {
$this->button_label = '';
$this->button_tagline = '';
$this->button_fundingicons = '';
if( $this->button_size == 'small' ) {
$this->button_size = 'medium';
}
}
}
if($this->button_label == 'credit') {
$this->button_color = '';
}
Expand Down Expand Up @@ -490,6 +492,7 @@ public function ec_enqueue_scripts_product_page() {
'button_label' => $this->button_label,
'button_tagline' => $this->button_tagline,
'button_layout' => $this->button_layout,
'button_fundingicons' => $this->button_fundingicons,
'allowed_funding_methods' => json_encode($this->allowed_funding_methods),
'set_express_checkout' => add_query_arg('pp_action', 'set_express_checkout', add_query_arg('wc-api', 'WC_Gateway_PayPal_Express_AngellEYE', home_url('/')))
)
Expand Down
4 changes: 3 additions & 1 deletion assets/js/angelleye-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ jQuery(document).ready(function ($) {
var angelleye_label = jQuery("#woocommerce_paypal_express_button_label").val();
var angelleye_layout = jQuery("#woocommerce_paypal_express_button_layout").val();
var angelleye_tagline = jQuery("#woocommerce_paypal_express_button_tagline").val();
var angelleye_fundingicons = jQuery("#woocommerce_paypal_express_button_fundingicons").val();
var angelleye_woocommerce_paypal_express_allowed_funding_methods = jQuery('#woocommerce_paypal_express_allowed_funding_methods').val();
if(angelleye_layout === 'vertical') {
angelleye_label = '';
Expand All @@ -332,7 +333,8 @@ jQuery(document).ready(function ($) {
shape: angelleye_shape,
label: angelleye_label,
layout: angelleye_layout,
tagline: angelleye_tagline
tagline: angelleye_tagline,
fundingicons : angelleye_fundingicons
},
funding: {
allowed: angelleye_woocommerce_paypal_express_allowed_funding_methods
Expand Down
7 changes: 4 additions & 3 deletions assets/js/angelleye-in-context-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
shape: angelleye_in_content_param.button_shape,
label: angelleye_in_content_param.button_label,
layout: angelleye_in_content_param.button_layout,
tagline: angelleye_in_content_param.button_tagline
tagline: angelleye_in_content_param.button_tagline,
fundingicons : angelleye_in_content_param.button_fundingicons
},
funding: {
allowed: JSON.parse(angelleye_in_content_param.allowed_funding_methods)
Expand Down Expand Up @@ -71,7 +72,6 @@
};
} else {
window.paypalCheckoutReady = function () {
console.log(paypal.FUNDING);
var get_attributes = function () {
var select = $('.variations_form').find('.variations select'),
data = {},
Expand Down Expand Up @@ -100,7 +100,8 @@
shape: angelleye_in_content_param.button_shape,
label: angelleye_in_content_param.button_label,
layout: angelleye_in_content_param.button_layout,
tagline: angelleye_in_content_param.button_tagline
tagline: angelleye_in_content_param.button_tagline,
fundingicons : angelleye_in_content_param.button_fundingicons
},
funding: {
allowed: JSON.parse(angelleye_in_content_param.allowed_funding_methods)
Expand Down
14 changes: 14 additions & 0 deletions classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@ function display_notice_and_disable_marketing_solution() {
jQuery("#woocommerce_paypal_express_button_layout").change(function () {
var angelleye_button_label = jQuery("#woocommerce_paypal_express_button_label").closest('tr');
var angelleye_button_tagline = jQuery("#woocommerce_paypal_express_button_tagline").closest('tr');
var angelleye_button_fundingicons = jQuery("#woocommerce_paypal_express_button_fundingicons").closest('tr');
if ( this.value === 'vertical' ) {
jQuery('#woocommerce_paypal_express_button_size option[value="small"]').remove();
angelleye_button_label.hide();
angelleye_button_tagline.hide();
angelleye_button_fundingicons.hide();
} else {
if( jQuery("#woocommerce_paypal_express_button_size option[value='small']").length == 0) {
jQuery('#woocommerce_paypal_express_button_size').append(jQuery("<option></option>").attr("value","small").text("Small"));
Expand Down Expand Up @@ -940,6 +942,18 @@ public function init_form_fields() {
'false' => __('Disable', 'paypal-for-woocommerce'),
'true' => __('Enable', 'paypal-for-woocommerce')
),
),
'button_fundingicons' => array(
'title' => __('Button Fundingicons ', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
'description' => __('To display or hide funding instrument icons beneath the payment button.', 'paypal-for-woocommerce'),
'default' => 'false',
'desc_tip' => true,
'options' => array(
'false' => __('Disable', 'paypal-for-woocommerce'),
'true' => __('Enable', 'paypal-for-woocommerce')
),
),
'angelleye_smart_button_preview_title' => array(
'title' => __('', 'paypal-for-woocommerce'),
Expand Down

0 comments on commit 5ba7906

Please sign in to comment.