zaus / forms-3rdparty-xpost

Converts external submission from [Forms: 3rdparty Integration](http://wordpress.org/plugins/forms-3rdparty-integration/) plugin to XML post; optionally can add custom headers (to allow SOAP submissions).
4 stars 2 forks source link

Separate same 3rd party field mapping #7

Closed RSpecianJr closed 8 years ago

RSpecianJr commented 9 years ago

Hey!

I hope this is the right place! I love the plugin and am having just a minor hiccup.

I'm submitting data to a 3rd party and they require separation of fields named the same:

        <DisplayField>
            <DisplayPrompt>info</DisplayPrompt>
            <DisplayValue>info value</DisplayValue>
        </DisplayField>
        <DisplayField>
            <DisplayPrompt>info</DisplayPrompt>
            <DisplayValue>info value</DisplayValue>
        </DisplayField>

I can't seem to find a way to accomplish this based of the UI, is this function built in? Is it something I can easily fix?

Thanks,

Robert

zaus commented 9 years ago

That's actually behavior determined by the main plugin Forms 3rdparty Integration. I'm not looking at it atm, but try setting the multiple values separator setting to either [] or [#] (as opposed to the default ,).

RSpecianJr commented 9 years ago

Hey, Do you want me to re-post this on the Forms 3rdparty integration page?

Neither [] or [#] worked unfortunately. [] threw out an error while [#] did the following:

<DisplayField>
    <DisplayPrompt>
        <n0>info</n0>
        <n1>info</n1>
    </DisplayPrompt>
    <DisplayValue>
        <n0>info value</n0>
        <n1>info value</n1>
    </DisplayValue>
</DisplayField>

Any other suggestions?

Thanks,

Robert

zaus commented 9 years ago

Hmmm...keep it here; if it's something incompatible in xpost that conflicts with the root plugin (which I think it is) I'll track it here.

What was the error you got? Are you nesting fields?

RSpecianJr commented 9 years ago

Hey zaus,

Yeah, I'm nesting fields, i'll attach a picture so you get the full idea.

If i have the separator as [], then I get the following two errors when i submit the form:

Warning: Invalid argument supplied for foreach() in "folderlocation"/forms/wp-content/plugins/forms-3rd-party-xpost/forms-3rdparty-xpost.php on line 126

Warning: array_merge(): Argument #2 is not an array in "folderlocation"/forms/wp-content/plugins/forms-3rd-party-xpost/forms-3rdparty-xpost.php on line 143

Where "folderlocation" is the actual start directory.

Then, when I look at the submitted form, it only shows the open/close XML root elements, none of the submitted data.

Just for reference, I am using Ninja Forms. nesting

Thanks,

Robert

zaus commented 9 years ago

Not sure about the error from [], I'll have to look at that some other time. I see the problem with [#] though, it has to do with how it combines the multiple values and then splits the nested keys before working on the values, whereas you need it to work on the multiple values before splitting keys. I'll have to think about that a bit, your case might actually be the correct behavior.

zaus commented 8 years ago

Almost works with via issue #11 -- if you use [%] separator and add %i to the destination key it'll split them, but with numbers in the element name:

/DisplayFields/DisplayField%i/Value
/DisplayFields/DisplayField%i/Prompt
/DisplayFields/DisplayField%i/Etc

would result in

<DisplayFields>
    <DisplayField1>
        <Value>A</Value>
        <Prompt>B</Prompty>
        <Etc>C</Etc>
    </DisplayField1>
    <DisplayField2>
        <Value>A</Value>
        <Prompt>B</Prompty>
        <Etc>C</Etc>
    </DisplayField2>
    ...

Still thinking about this...I want to add a similar 'separator' that'll manage this without including the number.

RSpecianJr commented 8 years ago

Hey Zaus,

You rock. Yes, that last statement is what I need (no number) in order to submit extra random fields.

Thanks,

Robert

zaus commented 8 years ago

@RSpecianJr sorry it took so long! Let me know if this actually fixes it for you.

RSpecianJr commented 8 years ago

Hey Zaus,

thanks for getting back to it. Taking a look at this now. My only concern is the way the grouping works with [#]. It doesn't group the information within their own "display field". This is what I'm needing it to do:

  <DisplayFields>
        <DisplayField>
             <DisplayPrompt>info</DisplayPrompt>
             <DisplayValue>info value</DisplayValue>
         </DisplayField>
         <DisplayField>
             <DisplayPrompt>info</DisplayPrompt>
             <DisplayValue>info value</DisplayValue>
         </DisplayField>
    </DisplayFields>

While this is what it is doing:

<DisplayFields>
        <DisplayField>
             <DisplayPrompt>info</DisplayPrompt>
             <DisplayPrompt>info</DisplayPrompt>
             <DisplayValue>info value</DisplayValue>
             <DisplayValue>info value</DisplayValue>
         </DisplayField>
    </DisplayFields>

Thanks,

Robert

RSpecianJr commented 8 years ago

@zaus if it is possible to get this figured out in the next couple days, i'd be willing to throw some money at you = P

RSpecianJr commented 8 years ago

@zaus I'd really appreciate a look at this = )

zaus commented 8 years ago

Wait, are you using [#] or [%] as the separator? Should be the latter.

RSpecianJr commented 8 years ago

I've tried [%] and it is the same result as [#]

<DisplayFields>
<DisplayField>
<DisplayPrompt>info</DisplayPrompt>
<DisplayPrompt>info</DisplayPrompt>
<DisplayPrompt>info</DisplayPrompt>
<DisplayValue>info value</DisplayValue>
<DisplayValue>info value</DisplayValue>
<DisplayValue>info value</DisplayValue>
</DisplayField>
</DisplayFields>
RSpecianJr commented 8 years ago

Hey Zaus,

Any luck?

Thanks,

Robert