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 6613767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:15:28+00:00 2026-05-25T20:15:28+00:00

I am attempting to create an order total module to do some custom price

  • 0

I am attempting to create an order total module to do some custom price adjustments. Just to get started with this I am just trying to get it to add $20 to every single order (eventually putting in the real logic).

I am having issues with the module that I created. The first issue is that it appears to be running twice (so it is taking $40 off instead of only $20 — Logging showed me that both the collect and fetch methods are being run twice)

The second issue is that the discount line item is appearing below the Grand Total line.

Can someone tell me what I am doing wrong here? The contents of my config.xml and order total class are below.

config.xml Content

<global>
    <sales>
        <quote>
            <totals>
                <mud>
                    <class>Wpe_Multiunitdiscount_Model_Multiunitdiscount</class>
                    <before>grand_total</before>
                </mud>
            </totals>
        </quote>
    </sales>    
</global>

Wpe_Multiunitdiscount_Model_Multiunitdiscount Content

class Wpe_Multiunitdiscount_Model_Multiunitdiscount extends Mage_Sales_Model_Quote_Address_Total_Abstract {

public function collect(Mage_Sales_Model_Quote_Address $address) {
    $address->setGrandTotal($address->getGrandTotal() + 20 );
    $address->setBaseGrandTotal($address->getBaseGrandTotal() + 20);
    return $this;
}

public function fetch(Mage_Sales_Model_Quote_Address $address) {
    $address->addTotal(array(
        'code'  => $this->getCode(),
        'title' => Mage::helper('sales')->__('Super Tax'),
        'value' => 20,
    ));
    return $this;
}
}
  • 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-25T20:15:28+00:00Added an answer on May 25, 2026 at 8:15 pm

    Regarding the “double” issue, as far as I understand it, it’s because magento collects your total twice, once for the shipping address and once for the billing address.
    I’m sure there has to be a better way to manage this, but for now I’ve added in the first line of my collect method:

        if ($address->getData('address_type')=='billing') return $this;
    

    And for the “placement”, have you try with “after” instead of “before” (changing the total alias, of course, let’s say “tax” for example”)?
    HTH

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

Sidebar

Related Questions

I'm attempting to create a custom calendar control that inherits from ASP.Net's built in
I am attempting to create my own custom Autocomplete style dropdown control in c#
I'm attempting to create an order number for customers to use. I will have
I'm attempting to create a class that extends a CursorAdapter in order to display
In order to get XML data from a server repeatedly, I'm attempting to use
I am attempting to add some multi-threading to a WPF application I have created
I'm trying to aggregate some customer order data into one table for analysis. The
I'm currently attempting to create a tabbed interface in a web application, and based
I am attempting to create a small application to collect data received from an
I am attempting to create new membership users in an Ektron CMS400.NET-based website by

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.