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 21, 2018
1 parent 6808745 commit 1b64033
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ public function ec_enqueue_scripts_product_page() {
$this->button_size = 'medium';
}
}
if($this->button_label == 'credit') {
$this->button_color = '';
}
$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 && ( is_checkout() || is_product() || is_cart())) {
wp_enqueue_script('angelleye-in-context-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true);
Expand Down
16 changes: 10 additions & 6 deletions assets/js/angelleye-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,16 @@ jQuery(document).ready(function ($) {


if(angelleye_layout === 'vertical') {
angelleye_label = '';
angelleye_tagline = '';
if( angelleye_size === 'small' ) {
angelleye_size = 'medium';
}
}
angelleye_label = '';
angelleye_tagline = '';
if( angelleye_size === 'small' ) {
angelleye_size = 'medium';
}
}

if(angelleye_label === 'credit') {
angelleye_color = '';
}



Expand Down
3 changes: 2 additions & 1 deletion assets/js/angelleye-in-context-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
allowed: JSON.parse(angelleye_in_content_param.allowed_funding_methods)
},
client: {
sandbox: angelleye_in_content_param.payer_id
sandbox: angelleye_in_content_param.payer_id,
production: angelleye_in_content_param.payer_id
},
payment: function () {
$(selector).block({
Expand Down
49 changes: 31 additions & 18 deletions classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ function callback_onsuccess_production(containerId) {
jQuery('#woocommerce_paypal_express_pending_authorization_order_status').closest('tr').hide();
}
}).change();

jQuery('#woocommerce_paypal_express_button_label').change(function () {
if ( this.value === 'credit' ) {
jQuery('#woocommerce_paypal_express_button_color').closest('tr').hide();
} else {
jQuery('#woocommerce_paypal_express_button_color').closest('tr').show();

}
}).change();



var display_disable_terms = "<?php echo $display_disable_terms; ?>";
<?php if ($guest_checkout === 'no') { ?>
jQuery("#woocommerce_paypal_express_skip_final_review").prop("checked", false);
Expand Down Expand Up @@ -865,15 +877,32 @@ public function init_form_fields() {
'title' => __('Button Size', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
'description' => __('Type of PayPal Button Size (small | medium | responsive).', 'paypal-for-woocommerce'),
'description' => __('Type of PayPal Button Size (small | medium | large | responsive).', 'paypal-for-woocommerce'),
'default' => 'medium',
'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'),
),
),
'button_label' => array(
'title' => __('Button Label', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
'description' => __('Type of PayPal Button Label (checkout | credit | pay | buynow | paypal).', 'paypal-for-woocommerce'),
'default' => 'checkout',
'desc_tip' => true,
'options' => array(
'checkout' => __('Checkout', 'paypal-for-woocommerce'),
'credit' => __('Credit', 'paypal-for-woocommerce'),
'pay' => __('Pay', 'paypal-for-woocommerce'),
'buynow' => __('Buynow', 'paypal-for-woocommerce'),
'paypal' => __('Paypal', 'paypal-for-woocommerce')

),
),
'button_color' => array(
'title' => __('Button Color', 'paypal-for-woocommerce'),
'type' => 'select',
Expand All @@ -899,22 +928,6 @@ public function init_form_fields() {
'rect' => __('Rect', 'paypal-for-woocommerce')
),
),
'button_label' => array(
'title' => __('Button Label', 'paypal-for-woocommerce'),
'type' => 'select',
'class' => 'wc-enhanced-select in_context_checkout_part',
'description' => __('Type of PayPal Button Label (checkout | credit | pay | buynow | paypal).', 'paypal-for-woocommerce'),
'default' => 'checkout',
'desc_tip' => true,
'options' => array(
'checkout' => __('Checkout', 'paypal-for-woocommerce'),
'credit' => __('Credit', 'paypal-for-woocommerce'),
'pay' => __('Pay', 'paypal-for-woocommerce'),
'buynow' => __('Buynow', 'paypal-for-woocommerce'),
'paypal' => __('Paypal', 'paypal-for-woocommerce')

),
),
'button_tagline' => array(
'title' => __('Button Tagline ', 'paypal-for-woocommerce'),
'type' => 'select',
Expand All @@ -931,7 +944,7 @@ public function init_form_fields() {
'title' => __('', 'paypal-for-woocommerce'),
'type' => 'title',
'class' => '',
'description' => '<div><div class="display_smart_button_previews_button">Wow</div><div class="display_smart_button_previews">Wow</div></div>',
'description' => '<div><div class="display_smart_button_previews_button"></div><div class="display_smart_button_previews"></div></div>',
),

);
Expand Down

0 comments on commit 1b64033

Please sign in to comment.