You are here

function custom_offline_payment_load in Commerce Custom Offline Payments 7

Load a custom offline payment by ID.

Parameters

string $id:

5 calls to custom_offline_payment_load()
commerce_cop_confirm_payment_form in ./commerce_cop.module
Form to Receive the Payment
commerce_cop_form_rules_ui_edit_element_alter in ./commerce_cop.module
Implements hook_form_FORM_ID_alter().
commerce_cop_payment_access in ./commerce_cop.module
User access callback for cashing cheque
commerce_cop_submit_form in ./commerce_cop.module
Payment method callback: checkout form.
commerce_cop_tokens in ./commerce_cop.module
Implements hook_tokens().
1 string reference to 'custom_offline_payment_load'
commerce_cop_edit_payment_form in ./commerce_cop.admin.inc
Form to edit checkout payment.

File

./commerce_cop.module, line 383
Custom offline payment methods for Drupal Commerce.

Code

function custom_offline_payment_load($id) {
  static $custom_offline_payments = array();
  if (!isset($custom_offline_payments[$id])) {

    // Get custom payment properties from own table.
    $payment = db_select('commerce_custom_offline_payment', 'cop');
    $payment
      ->fields('cop');
    $payment
      ->condition('id', $id);
    $payment = $payment
      ->execute();
    $payment = $payment
      ->fetchAssoc();

    // Put payment to static variable.
    $custom_offline_payments[$id] = $payment;
  }
  return $custom_offline_payments[$id];
}