如何在magento客户选择代码中给出where条件
我使用此代码选择所有客户详细信息如何在magento客户选择代码中给出where条件,magento,magento-1.7,Magento,Magento 1.7,我使用此代码选择所有客户详细信息 function getCustomers() { /* Magento's Mage.php path * Mage Enabler users may skip these lines */ require_once ("../mysite/app/Mage.php"); umask(0); Mage::app("default"); /* Magento's Mage.php path */
function getCustomers() {
/* Magento's Mage.php path
* Mage Enabler users may skip these lines
*/
require_once ("../mysite/app/Mage.php");
umask(0);
Mage::app("default");
/* Magento's Mage.php path */
/* Get customer model, run a query */
$collection = Mage::getModel('customer/customer')
->getCollection()
->addAttributeToSelect('*');
$result = array();
foreach ($collection as $customer) {
$result[] = $customer->toArray();
}
return $result;
}
但我想检查一个字段值
也就是说,在eav_属性表中有一列“usertypecurrent”
我需要检查它的值是否为0
这意味着选择其用户类型为0的所有客户
如何执行此操作?您可以使用addAttributeToFilter根据属性值筛选结果
$collection = Mage::getModel('customer/customer')
->getCollection()
->addAttributeToFilter('usertypecurrent', array('eq' =>0))
->addAttributeToSelect('*');