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

  • SEARCH
  • Home
  • 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 4625464
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:16:34+00:00 2026-05-22T03:16:34+00:00

I’m currently implementing a plugin to manage quotation requests in a magento shop system.

  • 0

I’m currently implementing a plugin to manage quotation requests in a magento shop system. The idea is, that the request is associated with an quote and somebody in the backend should be able to apply individual sales rules per quote item.

There was no problem to implement the functionality to create and edit the involved entities on the frontend as well in backend. But I’m unable to apply a certain sales-rule to a quote item and have that rule reflected in the row total as well as the subtotal of the quote.

My current approach is to use the sales_quote_address_discount_item-Hook. There I use an instance of a class derived from Mage_SalesRule_Model_Validator which overloaded _getRules()-Method gives the relevant Mage_SalesRule_Model_Rules. The relevant code of the event-observer looks like:

$quote_item = $event->getItem();

$request_item = $this->helper->getRequestItemByQuoteItemId($quote_item->getItemId());
if (! $this->isRelevantRequestItem($request_item))
    return $this;

$validator = Mage::getModel("requestquotation/request_validator")
                 ->addRule($request_item->getRule());
$validator->process($quote_item);

When I step with the debugger through process()-Method, my supplied rule works and is applied to the quote item. But any further collectTotals()on the quote and an $quote_item->save() has no effects on the of row-totals and the subtotal of the quote.

Is there any documentation or example how to add an sales-rule (better in my opinion as it is traceable) or an discount manually, programatically to an quote-item and/or to the quote itself.

Thank you in advance and best regards!

Joachim

  • 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-22T03:16:35+00:00Added an answer on May 22, 2026 at 3:16 am

    unfortunately Chuck isn’t currently doing consulting work. So I had to dig deeper into the entangled magento discount calculation.

    The recalculation by totals_collected_flag is IMHO no options, as it triggers tax calculation twice, which means the quote totals get totally wrong.

    I had success to populate my own discount type by implementing a new Mage_Sales_Model_Quote_Address_Total_Abstract. This one is using in it’s collect()-method a slightly customized version of Mage_SalesRule_Model_Validator which loads custom sales rules according to my discount strategy.

    The custom class is included into the Magento totals calculation by adding the following XML to the modules config.

    <global>
        ... 
        <sales>
            <quote>
               <totals>
                   <requestquotation_discount>
                       <class>requestquotation/request_discount</class>
                       <after>discount</after>
                       <before>grand_total</before>
                   </requestquotation_discount>
               </totals>
            </quote>
        </sales>
    </global>
    

    In the implementation the “code” of the totals-calculator is set to “discount” and no previous calculated discount is reset. With this method, the custom discount can run side by side with Magento’s default discount system as well it doesn’t interfere with tax-calculation, etc.

    Hope, this helps somebody struggling with the same problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.