I'm trying to add some text in Paypal EC module, since I found in Paypal guidelines a note that explains to add a CLEARLY VISIBLE TEXT 'or' in cart, to help customers understand that Express Checkout is an alternative to Standard Drupal Checkout.
As you draw EC form in cart, this is not clear. I would like to add some extra html text between drupal 'go on with checkout' and EC checkout.

I found these are the module lines adding EC form in cart. How can I edit them?

/**
 * Displays an Express Checkout button as a form that redirects to PayPal.
 */
function commerce_paypal_ec_order_form($form, &$form_state, $payment_method, $order) {
  $form_state['payment_method'] = $payment_method;
  $form_state['order'] = $order;

  $form['#attributes'] = array(
    'class' => array('paypal-ec-order-form'),
  );

  // @todo See if we can embed this using HTTP to avoid potential browser
  // warnings if HTTPS is not enabled on the site.
  $form['paypal_ec'] = array(
    '#type' => 'image_button',
    '#value' => t('Check out with PayPal'),
    '#src' => commerce_paypal_ec_button_url(),
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'commerce_paypal_ec') . '/theme/commerce_paypal_ec.theme.css',
      ),
    ),
  );

  return $form;
}

Comments

psicomante’s picture

Try this.

adding a single line of code you should have the desired result

'#prefix' => t('or'), // or whatever string you like (in english)

in the code:

// @todo See if we can embed this using HTTP to avoid potential browser
  // warnings if HTTPS is not enabled on the site.
  $form['paypal_ec'] = array(
    '#type' => 'image_button',
    '#value' => t('Check out with PayPal'),
    '#src' => commerce_paypal_ec_button_url(),
    '#prefix' => t('or'),  // add a translated or before the button
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'commerce_paypal_ec') . '/theme/commerce_paypal_ec.theme.css',
      ),
    ),
  );

Psi.

giuvax’s picture

Thanks a lot! It works.
I finally edit the module adding a suffix too. Now I just have to give it a layout via css.

<?php
/**
 * Displays an Express Checkout button as a form that redirects to PayPal.
 */
function commerce_paypal_ec_order_form($form, &$form_state, $payment_method, $order) {
  $form_state['payment_method'] = $payment_method;
  $form_state['order'] = $order;

  $form['#attributes'] = array(
    'class' => array('paypal-ec-order-form'),
  );

  // @todo See if we can embed this using HTTP to avoid potential browser
  // warnings if HTTPS is not enabled on the site.
  $form['paypal_ec'] = array(
    '#type' => 'image_button',
    '#value' => t('Check out with PayPal'),
    '#src' => commerce_paypal_ec_button_url(),
    '#prefix' => t('OR<br />'),  // add a translated text before the button
    '#suffix' => t('<p class=\"paypal_ec\">You can choose standard checkout or Paypal Express Checkout.<br />With Paypal Express checkout option, you do not need a Paypal account to go on with payment: you can use your credit card through Paypal platform for best security.</p>'),  // add a translated text after the button
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'commerce_paypal_ec') . '/theme/commerce_paypal_ec.theme.css',
      ),
    ),
  );

  return $form;
}

?>