I decided to write this post since there is not much documentation related to getting the customer group id for a coupon.
The best way to achieve this is to grab the customer group id using the function getCustomerGroupIds().
Below is a simple and fast way to get this using the salesrule/rule model.
$collection = Mage::getModel('salesrule/rule')->getCollection() ->addFieldToFilter('is_active', 1); $this->setCollection($collection);
Now you can call your function and grab the customer_group_id for each coupon.
foreach($couponcollection as $rule): $myArray = implode(",", $rule->getCustomerGroupIds()); echo $myArray; endforeach;
Hope this helps someone out there!
Perfect, thank you for this!