PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, November 10, 2022

[FIXED] How to get the Customer Group binded to a Sale rule in Magento?

 November 10, 2022     magento, magento-1.7     No comments   

Issue

I've got a Shopping Cart Price Rule allowed for one Customer Group.

How can I get this Customer Group id programmatically?


Solution

Try below code to retrieve customer id which is allowed for customer group.

$rules = Mage::getResourceModel('salesrule/rule_collection')->load();
 foreach ($rules as $rule) {
    if ($rule->getIsActive()) {
        $rule = Mage::getModel('salesrule/rule')->load($rule->getId());
        $customer_ids = $rule->getData('customer_group_ids'); 
    }
 }

You will have customer group id array.



Answered By - Mufaddal
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing