Zen Cart Logo
Forums / General Questions / Added customer field, getting Argument #1 is not an array in admin

Added customer field, getting Argument #1 is not an array in admin

Locked

Views: 1,047

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
2 Oct 2008, 7:36 PM
#1
elslozzo avatar

elslozzo

New Zenner

Join Date:
Feb 2008
Location:
Edmonton, AB
Posts:
60
Plugin Contributions:
1

Added customer field, getting Argument #1 is not an array in admin

Hello and thank you for your time. I needed to add some customer details fields to my site and I did so following the guidance from this link:

http://www.zen-cart.com/forum/showthread.php?t=73181&highlight=add+customer+field&page=2

Everything works good, I added Address line 3 and urbanization code. I can make changes in My Account, in admin I can do updates, etc, everythings splendid. But in admin on the Customers >> Customers page, I have 4 errors, that only show up when a customer is not selected, for example when first navigating to the page.

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/hume2/public_html/admin/customers.php on line 1136

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/hume2/public_html/admin/customers.php on line 1138

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/hume2/public_html/admin/includes/classes/object_info.php on line 29

Warning: Variable passed to each() is not an array or object in /home/hume2/public_html/admin/includes/classes/object_info.php on line 30

The first two errors, refer to untouched core code on customers.php:

$customer_info = array_merge($country->fields, $info->fields, $reviews->fields);
$cInfo_array = array_merge($customers->fields, $customer_info);

Anyone with ideas I'm listening. Everything works fine just those errors.... Also, I've recently upgraded it to Zen 1.3.8a, PHP 5.2.6, and MySql 5.0.58 but funny enough all that went off without a hitch. haha! and thanks!

2 Oct 2008, 10:01 PM
#2
elslozzo avatar

elslozzo

New Zenner

Join Date:
Feb 2008
Location:
Edmonton, AB
Posts:
60
Plugin Contributions:
1

Re: Added customer field, getting Argument #1 is not an array in admin

I just did this...

        $customer_info = array_merge(array($country->fields), array($info->fields), $reviews->fields);

I migrated some customers in and had some NULLs in the customers_info_date_account_last_modified and customers_info_date_of_last_logon fields. If those values were coming back NULL in the script, an actual array couldn't be created for use in array_merge. Here, I'm just typecasting whatever variable is being used ($country->fields) into an array, if it isn't already one. So if a NULL gets passed in, It becomes an array of 1 element, with value of NULL. **In PHP5, array_merge accepts only arrays. **