You are here:  » array_merge(): Argument


array_merge(): Argument

Submitted by george-p on Thu, 2013-06-06 10:14 in

Hello David

in some products i get those errors

Warning: array_merge(): Argument #2 is not an array in /home/webapps/eshoping/products.php on line 137

Warning: array_merge(): Argument #2 is not an array in /home/webapps/eshoping/products.php on line 137

Warning: Cannot modify header information - headers already sent by (output started at /home/webapps/eshoping/products.php:137) in /home/web2design/webapps/eshoping/html/header.php on line 6

like here {link saved}

at products line 137 is this code

$searchresults["products"][$k] = array_merge($searchresults["products"][$k],$rows3[$p["name"]]);

lines 135-140

 foreach($searchresults["products"] as $k => $p)
      {
        $searchresults["products"][$k] = array_merge($searchresults["products"][$k],$rows3[$p["name"]]);
        $searchresults["products"][$k]["productHREF"] = tapestry_productHREF($searchresults["products"][$k]);
      }

and at header on line 6 is this code

header("Content-Type: text/html;charset=".$config_charset);

Submitted by support on Thu, 2013-06-06 11:33

Hello George,

That's the related products re-query code (where the search results array is fully populated after the initial fast search SQL) but it looks like it's not returning the full result set. Please could you email me your full products.php and I'll check it out for you...

Thanks,
David.
--
PriceTapestry.com

Submitted by george-p on Thu, 2013-06-06 14:10

this is products.php

{code saved}

Submitted by support on Thu, 2013-06-06 14:23

Thanks George,

Everything looks in order, assuming that the error is consistent rather than spurious (in other words you can go to a particular product page and it always causes the error), if you could temporarily enable database debug mode by changing line 6 of config.advanced.php as follows:

  $config_databaseDebugMode = TRUE:

...then re-view the page and if it is a database issue extended MySQL error information should be displayed. If so, if you could copy the error message and let me know what is displayed that should indicate the problem, otherwise let me know that there is no difference and I'll check it out further for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by george-p on Thu, 2013-06-06 15:43

i enabled databaseDebugMode but not see any database error {link saved}

i think only some products of this merchant {link saved} have the problem

Submitted by support on Thu, 2013-06-06 16:21

Thanks George,

It looks like a character encoding issue; I see that the character encoding of your site is ISO-8859-1 (set in config.php line 4) which I think you will have set to correct incorrect character display previously, but the feed of the merchant where the errors happen is UTF-8 encoded.

You should be able to fix this using the UTF8 Decode filter (UTF-8 to ISO-8859-1 conversion). From your /admin/ area, click Filters alongside the Highend Fasion feed, and add new UTF8 Decode filters to the Product Name and Description fields, and then re-import the feed - that should be all it is...

(the same filters would need to be added to any other new feeds that are UTF-8 encoded when your site is configured for ISO-8859-1). Of course, it would only appear as a problem when characters outside of the ASCII range (e.g. accented vowels) appear in the data.

Cheers,
David.
--
PriceTapestry.com

Submitted by george-p on Thu, 2013-06-06 17:34

my $config_charset = "utf-8"; not ISO-8859-1

and at database.php i have this code database_queryModify("SET NAMES 'utf8'",$result);

Submitted by support on Thu, 2013-06-06 17:59

Hello George,

Thanks for the updates, it sounds like the default charset and collation on the products table may be the cause - this method has helped other users with charset problems like this. To set the charset and collation of your `products` table to utf-8 and utf8_general_ci respectively, create a new dbmod.php script in the top level of your Price Tapestry installation as follows:

<?php
  
require("includes/common.php");
  
$sql "TRUNCATE `".$config_databaseTablePrefix."products`"
  
database_queryModify($sql,$result);
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
            CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci"
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Browse to the script once, and then delete the file. Note: This will empty the `products` table so after running the above script a full re-import will be required.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by george-p on Thu, 2013-06-06 18:16

products table are utf8_general_ci {link saved}

will try to see if that help

Submitted by george-p on Thu, 2013-06-06 18:25

ok run this code, reimport and is fine now

thanks :)