The PayPal button can look pretty clunky as an option in the "Payment methods" list. It seems like a good idea to provide an option to use the text only.

Further, sometimes you don't want the "Express Checkout" as an option on the Cart page, e.g. when it doesn't work properly like the site requires a user to complete billing and shipping details first. It would be nice to have an option to disable that too.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aidanlis’s picture

Patch attached which provides rules-configurable options for both of these.

aidanlis’s picture

Fixed the default values.

heddn’s picture

Status: Active » Needs review
FileSize
4.57 KB

Re-rolled against current HEAD.

haggins’s picture

Status: Needs review » Needs work

Would be great if this was integrated!

Here's a quick review of the patch. I didn't test it, though:

+++ b/modules/ec/commerce_paypal_ec.module
@@ -404,6 +406,18 @@ function commerce_paypal_ec_settings_form($settings = array()) {
+    '#title' => t('Show the PayPal Express Checkout button on Cart pages.'),

'Cart' lowercase.

+++ b/modules/ec/commerce_paypal_ec.module
@@ -435,14 +449,18 @@ function commerce_paypal_ec_form_alter(&$form, &$form_state, $form_id) {
+        // Grab payment_method settings

Append dot.

+++ b/modules/ec/commerce_paypal_ec.module
@@ -540,8 +558,17 @@ function commerce_paypal_ec_submit_form($payment_method, $pane_values, $checkout
+    $markup .= '<div>' . t('Continue with checkout to complete payment via PayPal.') . '</span>';

Should be </div>.

aidanlis’s picture

Status: Needs work » Needs review
FileSize
4.57 KB

Thanks for the review

haggins’s picture

I cannot apply the patch against 7.x-2.x-dev, sorry. Wrong format?

Also found another one:

+++ b/modules/ec/commerce_paypal_ec.module
@@ -435,14 +449,18 @@ function commerce_paypal_ec_form_alter(&$form, &$form_state, $form_id) {
+        // Check whether we want the radio label replaced by the icon

Append dot.

aidanlis’s picture

Is the full stop after a comment a new policy for DC? It seems a bit superfluous ...

haggins’s picture

I probably wouldn't have mentioned it, if it was possible to apply the patch. But since the patch needs some rework nevertheless, it doesn't hurt, does it?

markisatacomputer’s picture

Here's a version of the patch that works for me. Rolled for 7.x-2.2

haggins’s picture

Status: Needs review » Needs work

Thank you Mark!
I just tested it and it seems to work fine.

+++ b/sites/all/modules/commerce_paypal/modules/ec/commerce_paypal_ec.module
@@ -640,8 +663,15 @@ function commerce_paypal_ec_submit_form($payment_method, $pane_values, $checkout
+    $icons = commerce_paypal_icons();
+
+    $markup = '<div>' . t('Pay securely without sharing your financial information.') . '</div>';
+    $markup .= '<div class="commerce-paypal-icons">'. implode(' ', $icons). '</div>';
+    $markup .= '<div>' . t('Continue with checkout to complete payment via PayPal.') . '</div>';
+
+    $form['paypal_ec_information']['#attached']['css'][] = drupal_get_path('module', 'commerce_paypal_wps') . '/theme/commerce_paypal_wps.theme.css';
     $form['paypal_ec_information'] = array(
-      '#markup' => '<span class="commerce-paypal-ec-info">' . t('(Continue with checkout to complete payment via PayPal.)') . '</span>',
+      '#markup' => $markup,

I'm wondering why you added this? This seems not related to this topic...and it adds wrong information since not everyone provides credit card functionality via paypay (like me).
Please revert this change.

+++ b/sites/all/modules/commerce_paypal/modules/ec/commerce_paypal_ec.module
@@ -470,14 +484,16 @@ function commerce_paypal_ec_form_alter(&$form, &$form_state, $form_id) {
+  ¶
...
+  ¶

Remove spaces.


And last but not least: patchfiles should be created from the module root not from Drupal root.

aidanlis’s picture

@haggins That's the text which appears by default, this patch just moves it out-of-line.

haggins’s picture

No, the icons do only appear in the wps module not in ec module.

markisatacomputer’s picture

Oops - sorry guys - here it again.

haggins’s picture

There are still icons which should only be shown by wps module.

aidanlis’s picture

Why should it be shown on one module and not the other?

haggins’s picture

I just wanted to point out, that the icons were not shown before this patch. However, this issue is about disabling the button on the cart page and not about showing icons.
So it's better to open another issue for that. If you want to show them, you should also take care of the configuration made at the paypal_ec rules setting page:

Express Checkout mode

  • Require a PayPal account (this is the standard configuration). => Don't show icons
  • Allow PayPal AND credit card payments, defaulting to the PayPal form. => Show icons
  • Allow PayPal AND credit card payments, defaulting to the credit card form. => Show icons
aidanlis’s picture

Status: Needs work » Needs review

This issue is about two things, Express Checkout looking clunky and providing an extra option to disable EC on cart pages. The patch addresses both these issues, bringing the styling of EC inline with the other payment methods, specifically paypal standard and the standard credit card form. Let's stop bikeshedding and get this 3 month old issue committed.

haggins’s picture

Ok, however the credit card icons should only be shown if credit card option is enabled (see #16).

Exploratus’s picture

Tried the patch and it worked wonderfully. Really wanted to get the button out of the cart, it was sending the total to Paypal without Shipping / tax costs. Nice!

Can we get this committed?

svouthi’s picture

Issue summary: View changes

I've applied the patch and am so happy to get rid of the Express Checkout button from the cart. However, the Paypal logo is still displaying on my payment page rather than the plain text.

BrianLP’s picture

Same here, no text but only the Paypal logo regardless which setting I select. Any ideas what I might have missed?

torgosPizza’s picture

I need this option too. Will see if I can help soon.

daveparrish’s picture

#13 applied cleanly but there were some white space issues and #20 pointed to a problem which I fixed in my attached patch.

As to @haggins concerns I've also split this issue into three more issues each with their own, smaller patches. I hope this will be enough to get at least some of these improvements committed. I personally need to be able to hide the Paypal button on cart pages.

Here are the new issues:
#2415489: Provide option for text only radio button
#2415495: Improve Paypal payment message
#2415501: Add option for disabling the Paypal button on cart page

zhoudrupal’s picture

I followed the new steps (#23), but I got this information in "Review order" page. What should I do?
In my file, line 517 : if ($settings[$key]['settings']['display_name_as_logo']) {

Notice: Undefined index: display_name_as_logo in commerce_paypal_ec_form_alter() (line 517 of/var/www/www.XXXX.com/profiles/commerce_kickstart/modules/contrib/commerce_paypal...)

RobbMLewis’s picture

Patch 23 worked for me.

RobbMLewis’s picture

Could this be added into the code? I've been using patch 23, and just had to manually update it due to latest module update.

bensey’s picture

Yes, was using #23 on a client's site too, but suddenly found that button back again after an update.

Can somebody on the project please review and commit this, as it is such a simple setting, so harmless, and not everyone wants it on the cart page. And in many cases the express checkout directly from the cart page doesn't work with all of our order and checkout workflows. In our case assigning licenses etc.