按自定义字段过滤客户
我使用magento 1.6.1
我只有客户的手机号码和姓名。我需要加载这些客户。
如何在 magento 中选择这些客户。
I using magento 1.6.1
I have only mobile number and name of the customers. I need to load those customers.
How it is possible to select those customers in magento.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(2)
下面的代码帮助我过滤客户。
The below code helps me to filter the customers.
$customers = Mage::getResourceModel('customer/customer_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('firstname', $firstName)
上面的代码只会加载集合。
要按名字获取客户详细信息,我们需要循环访问客户集合对象,然后获取客户 ID。最后只需加载单个客户对象
,如下所示如果我们想按姓氏过滤,只需更改为
$customers = Mage::getResourceModel('customer/customer_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('firstname', $firstName)
The above code will only load the collection.
To get customer details by firstname, we need to loop through customer collection object and then get customer id. Finally just load the individual customer object as below
In case, if we want to filter by lastname, just change to