Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error message


RojanUK

Recommended Posts

hi, I saw this is a thread from 2004. but today I still counted this problem. I met this problem not in the checkout process, but in orderhistory_info.php And I found a solution too. And I think might be an option for users who would like to only modify tep_address_format other than the tep_outputstring() which is used everywhere. Also for people who meet this problem in orderhistory_info.php instead of order_comfirmation

 

well in the function of tep_address_format(parameters...)

 

there's a line: $country = tep_output_string_protected($address['country']);

 

change it into $country = tep_output_string_protected($address['country']['title']);

 

Reasons:

 

$address['country'] is not a string but an array. so at the end the country will be null which coursed the error message. and when read order list from database, only country name is read from database, and is evaluated to title if you read the order.php from the folder /root/inlcudes/class/ from line around 65 to 85.

 

I hope this can helpe someone. or if I'm wrong, pls dicuss with me too. thx.

 

[email protected]

Link to comment
Share on other sites

  • Replies 78
  • Created
  • Last Reply
I have the same error except my error only comes up when the customer is in "my account" and they click "view" to view the order details. Can anyone help with this one?

 

 

I had this same issue, and couldnt figure out what array was causing this, so I tried tradrack's fix from above, and it worked

 

just edit your general.php function to read...

 

if ($protected == true) {

if (is_array($string)) {

$string=$string[title];

}

return htmlspecialchars($string);

 

i can now click view and see the whole order without error

Link to comment
Share on other sites

  • 2 months later...
It seems like everytime I install a store I get this error and I forget how I fixed it earlier. This is the latest fix that I did that worked for me. I just plow throught stuff to fix it, maybe not the best method.

 

Ok here goes:

1. I get the error, crap, then it tells me what line of includes/functions/general.php it is on. Line 44 in my case.

 

2. I go to the file and I see this:

if ($protected == true) {
  return htmlspecialchars($string);

Because PHP is so great with error messages I know exactly what is wrong, at some point the variable $string is an array instead of a $string. So to find out whay is going on I used my favorite function in the whole world for debugging: print_r(

 

3. I now change the code to this for debugging:

if ($protected == true) {
print_r($string);
  return htmlspecialchars($string);

, save it and rerun the page I'm having problems with. Now it seems obvious that it was the country because that is the only one that returned an array. The array had 3-

 

4 parts and the part I wanted to show was [title] (you might want something else). So now I want the PHP code to check if it is an array, and if it is I want it to only show me the title, then I won't get that error.

So I changed the original code from:

if ($protected == true) {
  return htmlspecialchars($string);

 

to:

 

if ($protected == true) {
if (is_array($string)) {
$string=$string[title];
}
  return htmlspecialchars($string);

 

And it works great for me.

 

explanation:

if (is_array($string)) {

$string=$string[title];

}

 

This if statement checks the $string variable each time to see if it is an array, then if it is it only grabs the [title] portion for me to use.

 

I put the logic into this post to help you diagnose your OWN problem and follow my logic that I used to fix mine. Usually I have seen this is just a problem with the country array. I think my blurp of code is very easy, and very unobtrusive because $string should NEVER be an array or it will throw that error, and so my code just fixes it if it is an array. Good fix.

B)

 

 

THANKS BEN, GREAT JOB !!!

The creator of www.futomart.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...