Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6675959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:55:36+00:00 2026-05-26T03:55:36+00:00

does anyone know how one can get the catalog- and cart price rules from

  • 0

does anyone know how one can get the catalog- and cart price rules from an order?

I know that I can get the discount percentage from an order item via the method getDiscountPercent(), but how can I get all the rules that were applied to the whole order?

For example, I have a rule “Customer Group X gets 20% off all items in the store”.

Now I want to determine which rules were actually applied when the order has been submitted by the user. I need this for an order export interface where I have to supply all discounts that the user got.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:55:37+00:00Added an answer on May 26, 2026 at 3:55 am

    Have a look in the sales_flat_order_item table. there is a field called applied_rule_ids which will give you the id of the rule applied to that item. Also you can find out in this table how much discount was applied and the percentage.

    Example

    //The order I want to check
        $order_id = 859;
    
        //Get the list of items for your order
        $items = Mage::getModel('sales/order_item')
        ->getCollection()
        ->addFilter('order_id',array('eq'=>$order_id));
    
        //loop through each item
        foreach($items as $item){
    
            //if the item has not had a rule applied to it skip it
            if($item->getAppliedRuleIds() == '')continue;
    
            /*
            * I cant remember in the database they might be comma separated or space if multiple rules were applied
            * the getAppliedRuleIds() function is the one you want
            */
            foreach(explode(",",$item->getAppliedRuleIds()) as $ruleID){        
    
                //Load the rule object
                $rule = Mage::getModel('catalogrule/rule')->load($ruleID);
    
                // Throw out some information like the rule name what product it was applied to
    
                echo "<p>".$item->getSku()." had rule ".$rule->getName()."(".$item->getAppliedRuleIds().") applied </p>";
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a web service where I can get price feeds and
Does anyone know how one can get the total number of calls to an
Does any one know from where can I download source code for Cassini. I
Does any one know of a control that i can use with a ASP.Net
Does anyone know of an easy way to copy a database from one computer
Does anyone know of papers/books/etc. that document patterns for databases? For example, one common
Does anyone know where i can get a C# -> Objective-C translator? I found
Does anyone know how I can get my results currently in qry IQueryable object
Does anyone know IF , WHEN or HOW I can get Memcached running on
Does anyone know where I can get a list of BaseDefinitions for the ClassificationTypeDefitions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.