cancel
Showing results for 
Search instead for 
Did you mean: 

x_line_item= (270) line item 1 is invalid.

Hello-

    I am trying to follow the instructions I found online in terms of formatting with delimiters and am getting the above error with the following syntax.

 

$lineItem = "x_line_item=item1<|>home3<|>Basic (Reuse)<|>$29.99<|>Y&x_line_item=item2<|>4<|>New Basic<|>$49.99<|>Y&";

 

echo "<INPUT type='hidden' name='x_line_item' value='$lineItem' />";

 

All other fields work using PHP so am wondering what is wrong with my syntax or if I am even going about correctly. 

 

Thank you,

Josh

imyourjosh
Member
1 ACCEPTED SOLUTION

Accepted Solutions

<?php

while($x != $i){

  $lineItem = $_SESSION['lineItem'][$x];

   echo "<INPUT type=\"hidden\" name=\"x_line_item\" value=\"$lineItem\" />";

   $x++

}

?>

 

$i = the number of individual items purchased.

$x = 0

$_SESSION['lineItem'][$x] = looks like your comment #2.  but is associated with however many items are purchased

 

This works for me!!!

 

Thanks for your help!

Josh

View solution in original post

10 REPLIES 10

Greetings,

 

You have two things wrong with the format of the line item string below that is easily fixable!

 

1) quantity parameter is missing from line item string

2) you may not include a "$" sign inside the amount field

 

Once these items were removed the processing was absolutely flawless.

 

 

Correct Format:

 

 

item1<|>home3<|>Basic (Reuse)<|>1<|>29.99<|>Y

 

Also placing (') single quotes around a PHP variable may cause it not to be evaluated, I would use double quotes please, or remove the single quotes entirely.

 

Thanks!

 

soundcommerce
Trusted Contributor
Trusted Contributor

Thank you,

Will give this a try and post back with success or more questions. 

Cheers,

Josh

item1<|>home3<|>Basic (Reuse)<|>1<|>29.99<|>Y&item2<|>home4<|>Pro (Reuse)<|>1<|>49.99<|>Y&

Does not seem to work for me.  What would I need to format to have x_line_item except multiple items in a single string?

I am putting the above line into one $variable and passing it along in the 'hidden' field.

Please echo this hidden field and see what you receive. I believe the single quotes you original used around the variable name is causing it not to be read properly.

I tried using double quotes and I have also tried piping each line into an array and then using a while loop to post each element in the array.  What I get when I post with only one item purchased from my site is successful and it looks great on the athorize.net credit card page but when I order more than one item invoking a second or third item then I get the (270) line item 1 is invalid.  If I use the while loop and array method I get a (270) per line item vs. just line item 1...

 

 

Please post your code for review.

 

Thanks!

<?php

while($x != $i){

  $lineItem = $_SESSION['lineItem'][$x];

   echo "<INPUT type=\"hidden\" name=\"x_line_item\" value=\"$lineItem\" />";

   $x++

}

?>

 

$i = the number of individual items purchased.

$x = 0

$_SESSION['lineItem'][$x] = looks like your comment #2.  but is associated with however many items are purchased

 

This works for me!!!

 

Thanks for your help!

Josh

My site is having the similiar error. I read up on the error and tried to make the necessary corrction, but it is still having the error. Maybe some one can take a look at the web site and advise what exactly needs to be fixed?

 

www.orientairsolution.com 

thedoctor_21
Member