Zen Cart Logo
Forums / Bug Reports / [Done 155b] collectsCardDataOnsite: payment-class not creating correctly-named fields

[Done 155b] collectsCardDataOnsite: payment-class not creating correctly-named fields

Views: 1,447

Results 1 to 2 of 2
30 Aug 2016, 17:11
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

[Done 155b] collectsCardDataOnsite: payment-class not creating correctly-named fields

When a payment method (e.g. authorizenet_aim) collects card data onsite, there is supposed to be a hidden variable created for that payment method so that the jQuery running on the checkout_payment page "knows" this condition.

The processing that's supposed to insert that field is the *selection *function of /includes/classes/payment.php, but the hidden-input's name is winding up as _collects_onsite instead of (for example) authorizenet_aim_collects_onsite.

The issue is that that function's using the wrong variable name to create that/those hidden variables. The function needs to be changed from:

  function selection() {
    $selection_array = array();
    if (is_array($this->modules)) {
      reset($this->modules);
      while (list(, $value) = each($this->modules)) {
        $class = substr($value, 0, strrpos($value, '.'));
        if ($GLOBALS[$class]->enabled) {
          $selection = $GLOBALS[$class]->selection();
          if (isset($GLOBALS[$class]->collectsCardDataOnsite) && $GLOBALS[$class]->collectsCardDataOnsite == true) {
            $selection['fields'][] = array('title' => '',
                                         'field' => zen_draw_hidden_field($this->code . '_collects_onsite', 'true', 'id="' . $this->code. '_collects_onsite"'),
                                         'tag' => '');

          }
          if (is_array($selection)) $selection_array[] = $selection;
        }
      }
    }
    return $selection_array;
  }

to

  function selection() {
    $selection_array = array();
    if (is_array($this->modules)) {
      reset($this->modules);
      while (list(, $value) = each($this->modules)) {
        $class = substr($value, 0, strrpos($value, '.'));
        if ($GLOBALS[$class]->enabled) {
          $selection = $GLOBALS[$class]->selection();
          if (isset($GLOBALS[$class]->collectsCardDataOnsite) && $GLOBALS[$class]->collectsCardDataOnsite == true) {
            $selection['fields'][] = array('title' => '',
                                         'field' => zen_draw_hidden_field([B]$class[/B] . '_collects_onsite', 'true', 'id="' . [B]$class[/B]. '_collects_onsite"'),
                                         'tag' => '');

          }
          if (is_array($selection)) $selection_array[] = $selection;
        }
      }
    }
    return $selection_array;
  }
12 Oct 2016, 01:18
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done 155b] collectsCardDataOnsite: payment-class not creating correctly-named fields