문제

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

도움이 되었습니까?

해결책 2

thanks for looking into it, in the end I changed the code to iterate over collection and manually compare each code, and it still didn't work! Turns out that there was a slight difference in the names which for reason I didn't notice so the original filter was working correctly after all!

Thanks!

다른 팁

This is another option to get customer group name.

$group = Mage::getModel('customer/customer_group')->load($groupId);
$group->getName();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top