Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an order string to send for payment processing

Status
Not open for further replies.

shawntbanks

Programmer
Oct 29, 2003
48
0
0
CA
I need to create an orderstring to send to my payment processing company, fine if there is only one, but what if I have an array full of items and I have to create an orderstring for each one. The string has to follow this fromat

<input type=&quot;hidden&quot; name=&quot;orderstring&quot; value=&quot;ItemNum~ItemDesc~0.00~1~Y~||
ItemNum2~ItemDesc~0.00~1~Y~||
ItemNum3~ItemDesc~0.00~1~Y~||&quot;>

I have an array that contains more than one item but I don't know how to dynamicaly create the string.

MAYBE

<CFLOOP from=&quot;1&quot; to=&quot;#ArrayLen(aryLocalArray)#&quot; index=&quot;whichItem&quot;>
<cfoutput><input type=&quot;hidden&quot; name=&quot;orderstring&quot; value=&quot;#aryLocalArray[whichItem].orderid#~#aryLocalArray[whichItem].itemname#~#fees.price#~1~Y~||
>

</cfoutput>
</cfloop>

Any ideas!!
 
<!--- I HAD TO SET UP MY OWN ARRAY SO HERE IT IS --->
<cfparam name=&quot;variables.itemList&quot; default=&quot;&quot;>
<cfset aryLocalArray = arrayNew(2)>
<cfset aryLocalArray[1][1] = &quot;0001&quot;>
<cfset aryLocalArray[1][2] = &quot;apples&quot;>
<cfset aryLocalArray[1][3] = &quot;10.00&quot;>

<cfset aryLocalArray[2][1] = &quot;0002&quot;>
<cfset aryLocalArray[2][2] = &quot;oranges&quot;>
<cfset aryLocalArray[2][3] = &quot;15.25&quot;>

<cfset aryLocalArray[3][1] = &quot;0003&quot;>
<cfset aryLocalArray[3][2] = &quot;peaches&quot;>
<cfset aryLocalArray[3][3] = &quot;5.50&quot;>

<cfset aryLocalArray[4][1] = &quot;0004&quot;>
<cfset aryLocalArray[4][2] = &quot;grapes&quot;>
<cfset aryLocalArray[4][3] = &quot;11.75&quot;>

<!--- CHANGE THIS CODE WITH YOUR ARRAY AND THIS WOULD WORK.... --->
<cfscript>
for( i=1; i LT ArrayLen(aryLocalArray); i=i+1 ){
variables.itemList = variables.itemList & aryLocalArray[1] & &quot;~&quot; & aryLocalArray[2] & &quot;~&quot; & aryLocalArray[3] & &quot;~1~Y~||&quot;;
}
</cfscript>

<cfdump var=&quot;#aryLocalArray#&quot;>
<cfoutput>#variables.itemList#</cfoutput>
<input type=&quot;hidden&quot; name=&quot;orderstring&quot; value=&quot;<cfoutput>#variables.itemList#</cfoutput>&quot;>

------------------------------------------------------------------------------
brannonH
if( !succeed ) try( );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top