Skip to content

Commit

Permalink
Possible adjustment to cart buttons, ref #312
Browse files Browse the repository at this point in the history
  • Loading branch information
kcppdevelopers committed Mar 8, 2016
1 parent fb28552 commit 7648e46
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 47 deletions.
46 changes: 4 additions & 42 deletions assets/css/cart.css
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
.cart .paypal_checkout_button img {
vertical-align: middle;
}
.paypal_box_button {
/* clear: both;*/
float: left;
margin-left:4%;
margin-bottom:10px;

}
.woocommerce #content table.cart .paypal_box_button img, .woocommerce table.cart .paypal_box_button img, .woocommerce-page #content table.cart .paypal_box_button img, .woocommerce-page table.cart .paypal_box_button img {
width: 150px;
border-radius: 0px;
box-shadow: none;
padding: 0px;
display: inline;
}
.paypal_box_button div a img {
border: none;
}
#paypal_ec_paypal_credit_button, #paypal_ec_button, .paypal_ec_textbutton {
position: relative;
}
#paypal_ec_paypal_credit_button a {
display: block;
text-align: center;
width: 100%;
}
#paypal_ec_button, .paypal_ec_textbutton {
margin-bottom: 3px;
}
.woocommerce .cart-collaterals .cart_totals, .woocommerce-page .cart-collaterals .cart_totals {
width:100%;
}
.wc-proceed-to-checkout {
.angelleye_cart_button a.paypal_checkout_button {
clear: both;
float: left;
}
.cart_totals .clear {display:none !important;}
.woocommerce-cart .wc-proceed-to-checkout {
padding: 1em 0;

font-size: 15px;
}
.woocommerce-cart .cart-collaterals .cart_totals table {width:80%;}
border: none; padding: 0;
}
3 changes: 1 addition & 2 deletions assets/js/angelleye-frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ jQuery(document).ready(function ($){
$(this).attr('disabled', 'disabled');
$('form.cart').submit();
jQuery(this).parent().parent().parent().find(".angelleyeOverlay").show();
//jQuery(".angelleyeOverlay").show();
return false;
return false;
});
}
if (angelleye_frontend.is_cart == "yes"){
Expand Down
49 changes: 48 additions & 1 deletion classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ static function woocommerce_before_cart() {
* Triggered from the 'woocommerce_proceed_to_checkout' action.
* Displays the PayPal Express button.
*/
static function woocommerce_paypal_express_checkout_button_angelleye() {
static function woocommerce_paypal_express_checkout_button_angelleye_old() {
global $pp_settings, $pp_pro, $pp_payflow;
$payment_gateways = WC()->payment_gateways->get_available_payment_gateways();
// Pay with Credit Card
Expand Down Expand Up @@ -2087,6 +2087,51 @@ static function woocommerce_paypal_express_checkout_button_angelleye() {
echo "<div class='clear'></div></div>";
}
}

static function woocommerce_paypal_express_checkout_button_angelleye() {
global $pp_settings;
if (@$pp_settings['enabled'] == 'yes' && (empty($pp_settings['show_on_cart']) || $pp_settings['show_on_cart'] == 'yes') && 0 < WC()->cart->total) {
if (empty($pp_settings['checkout_with_pp_button_type'])) {
$pp_settings['checkout_with_pp_button_type'] = 'paypalimage';
}
$angelleyeOverlay = '<div class="blockUI blockOverlay angelleyeOverlay" style="display:none;z-index: 1000; border: none; margin: 0px; padding: 0px; width: 100%; height: 100%; top: 0px; left: 0px; opacity: 0.6; cursor: default; position: absolute; background: url('. WC()->plugin_url() .'/assets/images/select2-spinner.gif) 50% 50% / 16px 16px no-repeat rgb(255, 255, 255);"></div>';
switch ($pp_settings['checkout_with_pp_button_type']) {
case "textbutton":
if (!empty($pp_settings['pp_button_type_text_button'])) {
$button_text = $pp_settings['pp_button_type_text_button'];
} else {
$button_text = __('Proceed to Checkout', 'woocommerce');
}
echo '<a class="paypal_checkout_button button alt" href="' . esc_url(add_query_arg('pp_action', 'expresscheckout', add_query_arg('wc-api', 'WC_Gateway_PayPal_Express_AngellEYE', home_url('/')))) . '">' . $button_text . '</a>';
echo $angelleyeOverlay;
break;
case "paypalimage":
echo '<a class="paypal_checkout_button" href="' . esc_url(add_query_arg('pp_action', 'expresscheckout', add_query_arg('wc-api', 'WC_Gateway_PayPal_Express_AngellEYE', home_url('/')))) . '">';
echo "<img src='https://www.paypal.com/" . WC_Gateway_PayPal_Express_AngellEYE::get_button_locale_code() . "/i/btn/btn_xpressCheckout.gif' border='0' alt='" . __('Pay with PayPal', 'paypal-for-woocommerce') . "'/>";
echo "</a>";
echo $angelleyeOverlay;
break;
case "customimage":
$button_img = $pp_settings['pp_button_type_my_custom'];
echo '<a class="paypal_checkout_button" href="' . esc_url(add_query_arg('pp_action', 'expresscheckout', add_query_arg('wc-api', 'WC_Gateway_PayPal_Express_AngellEYE', home_url('/')))) . '">';
echo "<img src='{$button_img}' width='150' border='0' alt='" . __('Pay with PayPal', 'paypal-for-woocommerce') . "'/>";
echo "</a>";
echo $angelleyeOverlay;
break;
}

/**
* Displays the PayPal Credit checkout button if enabled in EC settings.
*/
if (isset($pp_settings['show_paypal_credit']) && $pp_settings['show_paypal_credit'] == 'yes') {
$paypal_credit_button_markup = '<a class="paypal_checkout_button" href="' . esc_url(add_query_arg('use_paypal_credit', 'true', add_query_arg('pp_action', 'expresscheckout', add_query_arg('wc-api', 'WC_Gateway_PayPal_Express_AngellEYE', home_url('/'))))) . '" >';
$paypal_credit_button_markup .= "<img src='https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppcredit-logo-small.png' alt='Check out with PayPal Credit'/>";
$paypal_credit_button_markup .= '</a>';
$paypal_credit_button_markup .= $angelleyeOverlay;
echo $paypal_credit_button_markup;
}
}
}

static function get_button_locale_code() {
$locale_code = defined("WPLANG") && get_locale() != '' ? get_locale() : 'en_US';
Expand Down Expand Up @@ -2192,7 +2237,9 @@ public function process_refund($order_id, $amount = null, $reason = '') {

function top_cart_button() {
if (!empty($this->settings['button_position']) && ($this->settings['button_position'] == 'top' || $this->settings['button_position'] == 'both')) {
echo '<div class="wc-proceed-to-checkout angelleye_cart_button">';
$this->woocommerce_paypal_express_checkout_button_angelleye();
echo '</div>';
}
}

Expand Down
4 changes: 2 additions & 2 deletions paypal-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ function init(){
if (!class_exists("WC_Payment_Gateway")) return;
load_plugin_textdomain('paypal-for-woocommerce', false, dirname(plugin_basename(__FILE__)). '/i18n/languages/');
add_filter( 'woocommerce_payment_gateways', array($this, 'angelleye_add_paypal_pro_gateway'),1000 );
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_paypal_express_checkout_button', 12 );
//remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_paypal_express_checkout_button', 12 );
if( isset($pp_settings['button_position']) && ($pp_settings['button_position'] == 'bottom' || $pp_settings['button_position'] == 'both')){
add_action( 'woocommerce_after_cart_totals', array( 'WC_Gateway_PayPal_Express_AngellEYE', 'woocommerce_paypal_express_checkout_button_angelleye'), 12 );
add_action( 'woocommerce_proceed_to_checkout', array( 'WC_Gateway_PayPal_Express_AngellEYE', 'woocommerce_paypal_express_checkout_button_angelleye'), 22 );
}
add_action( 'woocommerce_before_cart', array( 'WC_Gateway_PayPal_Express_AngellEYE', 'woocommerce_before_cart'), 12 );
remove_action( 'init', 'woocommerce_paypal_express_review_order_page') ;
Expand Down

0 comments on commit 7648e46

Please sign in to comment.