Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php magento客户/客户返回错误的值_Php_Magento - Fatal编程技术网

Php magento客户/客户返回错误的值

Php magento客户/客户返回错误的值,php,magento,Php,Magento,我正在尝试将一组客户信息从Magento导入到外部应用程序中。外部应用程序已经知道了它们的实体ID,我基本上希望获取它们的客户对象并修改一些条目 这是代码谢谢你帮我安装 $collection = Mage::getModel('customer/customer'); /* each $key is an entity ID */ foreach (array_keys($concatresult) as $key) { $collection->load($key); Ze

我正在尝试将一组客户信息从Magento导入到外部应用程序中。外部应用程序已经知道了它们的实体ID,我基本上希望获取它们的客户对象并修改一些条目

这是代码谢谢你帮我安装

$collection = Mage::getModel('customer/customer');
/* each $key is an entity ID */
foreach (array_keys($concatresult) as $key) {
   $collection->load($key);
   Zend_Debug::Dump("Key: " . $key . " Forum username:" . $collection->getForumUsername() . " Name: " .  $collection->getName());
}
这是输出。实体38、48、131的论坛用户名为空,这是一个自定义字段:

string(53) "Key: 10955 Forum username:user1 Name: F1 L1"
string(47) "Key: 38 Forum username:user1 Name: F2 L2"
string(51) "Key: 48 Forum username:user1 Name: F3 L3"
string(50) "Key: 131 Forum username:user1 Name: F4 L4"
然而,返回的最后一个值是重复的

我查过:

仅返回38、48、131的论坛_用户名条目将按预期返回空值。
可能出了什么问题?

解决了。我需要在循环中加载customer对象

/* each $key is an entity ID */
foreach (array_keys($concatresult) as $key) {
    $collection = Mage::getModel('customer/customer');
    $collection->load($key);
    Zend_Debug::Dump("Key: " . $key . " Forum username:" . $collection->getForumUsername() . " Name: " .  $collection->getName());
}