Support

Home Forums Event Espresso Premium Generate a registration form from 2d array.

Generate a registration form from 2d array.

Posted: March 21, 2021 at 6:14 am

Viewing 2 reply threads


DykaGonka1

March 21, 2021 at 6:14 am

Hi!
I’m building an extension for payment system WayForPay. The are requiring to send an array of data ( eg. productName[] ):

<form method="post" action="https://secure.wayforpay.com/pay" accept-charset="utf-8">
<input name="merchantAccount" value="test_merch_n1">
<input name="merchantAuthType" value="SimpleSignature">
<input name="merchantDomainName" value="www.market.ua">
<input name="orderReference" value="DH1616328678">
<input name="orderDate" value="1415379863">
<input name="amount" value="1547.36">
<input name="currency" value="UAH">
<input name="orderTimeout" value="49000">
<input name="productName[]" value="Процессор Intel Core i5-4670 3.4GHz">
<input name="productName[]" value="Память Kingston DDR3-1600 4096MB PC3-12800">
<input name="productPrice[]" value="1000">
<input name="productPrice[]" value="547.36">
<input name="productCount[]" value="1">
<input name="productCount[]" value="1">
<input name="clientFirstName" value="Вася">
<input name="clientLastName" value="Пупкин">
<input name="clientAddress" value="пр. Гагарина, 12">
<input name="clientCity" value="Днепропетровск">
<input name="clientEmail" value="some@mail.com">
<input name="defaultPaymentSystem" value="card">
<input name="merchantSignature" value="a9d11dbce60397a606dee1cafb8d4a85">
<input type="submit" value="Test">
</form>

It’s not possible with current Payment class. Can you please update it to parse 2 dimensional arrays into form?


DykaGonka1

March 21, 2021 at 9:45 am

protected function _args_as_inputs($args)
    {
        $html = '';
        if ($args !== null && is_array($args)) {
            foreach ($args as $name => $value) {
                $html .= EEH_HTML::nl(0)
                         . '<input type="hidden" name="'
                         . $name
                         . '" value="'
                         . esc_attr($value)
                         . '"/>';
            }
        }
        return $html;
    }


Tony

  • Support Staff

March 24, 2021 at 9:27 am

Hi there,

I’ve created a pull request with a possible for this for which you can follow along with HERE.

Viewing 2 reply threads

The support post ‘Generate a registration form from 2d array.’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso