0

I have the following php code (running under magento 1.7.0.2) that finds a customer group with a particular code. The code works fine for groups that have no spaces in the code value, however it will not find any groups with a space in the code value, Can you locate the reason?

I don't want to change the code to use the group ID as this is not practical in this situation, can anyone help?

$theGrous = Mage::getModel('customer/group')->getCollection()->addFilter('customer_group_code', $groupName);

For example when the variable $groupName is 'Standard' I find results, when it is 'Standard Rate' I don't get it as it, this happens for any codes with spaces in them

thanks

4

2 回答 2

0

感谢您的研究,最后我更改了代码以迭代集合并手动比较每个代码,但它仍然无法正常工作!事实证明,名称略有不同,因为我没有注意到,所以原来的过滤器毕竟工作正常!

谢谢!

于 2013-07-03T22:09:09.963 回答
0

这是获取客户组名称的另一个选项。

$group = Mage::getModel('customer/customer_group')->load($groupId);
$group->getName();
于 2013-07-02T11:10:37.633 回答