Magento Add Fee or Discount to Order Totals

Banners
In this tutorial, we will see how to add new line item to magento order totals.

What this means is that, how to add an additional Fee or Discount, or any kind of charge to order total of the magento checkout process.
In a typical order, the order totals usually comprises of Sub Total, Shipping Cost, Taxes, Discount, based on these values the total order grand total is calculated. Now if we want to add an additional Credit Card Fee or Convince Free or Affiliate Discount or any other order total which will affect the order grand total we need to create a magento module. This extra fee which we are adding to the total would reflect in the

  • Checkout Page Order Total
  • Cart Page Order Total
  • My Account Order View Page
  • Print Order PDF
  • Order EMails
  • Admin Order View/Email/PDF
  • Admin Invoice View/Email/PDF
  • Admin Credit Memo View/Email/PDF

as you can see based on the above list this module is not be simple. In this tutorial, i am attaching the source of such a very basic module which you can use a your starting point to add an extra change. I would also explain the basics of how to implement this. In this tutorial i will add a new order total called ‘Fee’ with a fixed cost of 10$.
P.S: This module only applies Fee to the order when order is placed from frontend. If you create an order admin, this module is not tested for that case. Also this module is tested in magento version 1.6, but should work on 1.4-1.7
Here are few screenshots of the module

Admin Order View Page

Admin Order View Page

Order Email

Order Email

Checkout Page Order Totals

Checkout Page Order Totals

Module Name: Order Totals Module


Before starting with explanation, this is quite an advanced and big tutorial so it would be difficult to explain all things in details. I will just put in the basic stuff here, rest you need to debug from the source code itself.

Checkout Page Total Order Total Basics

We will see how to add the totals only to the checkout page. All the totals line items that show up the checkout page come from files located at folder Mage\Sales\Model\Quote\Address\Total. In magento before order is placed all order data is stored in a quote object and after order is placed it gets transferred to the order object. The quote totals follow the collector pattern and we can add collector as many collector classes. To add collector to the quote object in our config.xml we add the lines

<global>
    	<sales>
            <quote>
                <totals>
                    <fee>
                        <class>fee/sales_quote_address_total_fee</class>
                    </fee>
                </totals>
            </quote>
       </sales>
</global>

This means whenever the totals are calculated for a quote, it will also call this class. All collectors are called from the collectTotals() function in the Quote Model.
In our collector class we put in the code

<?php
class Excellence_Fee_Model_Sales_Quote_Address_Total_Fee extends Mage_Sales_Model_Quote_Address_Total_Abstract{
	protected $_code = 'fee';

	public function collect(Mage_Sales_Model_Quote_Address $address)
	{
		parent::collect($address);

		$this->_setAmount(0);
		$this->_setBaseAmount(0);

		$items = $this->_getAddressItems($address);
		if (!count($items)) {
			return $this; //this makes only address type shipping to come through
		}


		$quote = $address->getQuote();

		if(Excellence_Fee_Model_Fee::canApply($address)){ //your business logic
			$exist_amount = $quote->getFeeAmount();
			$fee = Excellence_Fee_Model_Fee::getFee();
			$balance = $fee - $exist_amount;
			$address->setFeeAmount($balance);
			$address->setBaseFeeAmount($balance);
				
			$quote->setFeeAmount($balance);

			$address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
			$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
		}
	}

	public function fetch(Mage_Sales_Model_Quote_Address $address)
	{
		$amt = $address->getFeeAmount();
		$address->addTotal(array(
				'code'=>$this->getCode(),
				'title'=>Mage::helper('fee')->__('Fee'),
				'value'=> $amt
		));
		return $this;
	}
}

The two main functions here are collect() and fetch(). In collect function you add whatever amount you want to the order totals, and fetch() is used for display purposes. If this is done properly, you should see your order total line in the checkout and cart page.
Here we are using two fields fee_amount and base_fee_amount, which contain our fee amount. We will have to see save these two fields to database, so in our module installer file we add this code

ALTER TABLE  `".$this->getTable('sales/quote_address')."` ADD  `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
		ALTER TABLE  `".$this->getTable('sales/quote_address')."` ADD  `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
Order Page

Till now, all code written has been done only for the quote object. But after order is placed, we need to transfer all information to the order object. As you would have seen above we are using two fields fee_amount and base_fee_amount, we now need to store these two fields in the order table as well. To do all the above we need to do two things. First in the config.xml file add this code inside the global tab,

<fieldsets>
            <sales_convert_quote_address>
                <fee_amount><to_order>*</to_order></fee_amount>
                <base_fee_amount><to_order>*</to_order></base_fee_amount>
            </sales_convert_quote_address>
        </fieldsets>

and in our module install file

ALTER TABLE  `".$this->getTable('sales/order')."` ADD  `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
	ALTER TABLE  `".$this->getTable('sales/order')."` ADD  `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;

After doing this, these two fields should get saved to the order table from the quote table.

This is only basics of the adding a line item to order total. Rest there is lot of code written inside the attached module, please go through it in detail to understand more.
  • Rahilhusain

    How can i apply tax on this custom fee ?

    • Manish Prakash

      I will check and update tutorial for this

    • Manish Prakash

      Adding tax to fee would be a big tax, I will write a separate blog post on this later.

  • Papango

    Hi Manish
    really good code.
    I’ve tested it but had to upgrade to 1.4.1.0 first as it does’nt work on 1.4.0.1

    Everything seems ok but i’m facing one issue : the Fees are not transfered to Orders so on the Paypal page, it is not applied so i do not get the fees !

    - i have the fieldsets on the config.xml, but how to be sure that the converted quote to order has the fee_amount and base_fee_amount applied ?

    regards

    • Manish Prakash

      I have updated code to add fee to the paypal line items.

      A new observer function has been added in Excellence_Fee_Model_Observer

      public function updatePaypalTotal($evt){

      $cart = $evt->getPaypalCart();
      $cart->updateTotal(Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL,$cart->getSalesEntity()->getFeeAmount());
      }

      And code added in config.xml file

      fee/observer

      updatePaypalTotal

      • swamy

        it was working only for the pay pal website payment standards not for other payment gateways

  • Boomer

    i tried this module and when i go to Fee -> Manage items.  It just gives me 404 Error.  I can’t figure out how to fix this?  I am running 1.5.1 of magento

    • Manish Prakash

      The Fee -> Manage Item should not be there I have removed it and uploaded new module.

  • Daniel

    Hi Manish
    Thanks for the code.
    The module works fine here. I only have one problem. The fee doesn’t show up in the order email. Do you have an idea why?

  • http://profile.yahoo.com/KLVGI3OU74AN6UULCWUDBZ7JFU Jenish

    it’s not working in magento 1.6.1.0…i’m getting error ”

    Fatal error: Call to a member function setTotals() on a non-object in /opt/lampp/htdocs/magento/app/code/core/Mage/Checkout/Block/Cart/Totals.php on line 63 “

  • Max

    Hallo,

    After installing the module, in the cart page, the “Checkout button” diappear. Where can i set up the fee amount? In the backend, i can’t find Excellence module. But in the configuration -> Advance: the module is enabled. I have clear the cache. Please help me.

    Best Regards

    • Manish Prakash

      You have to set the amount in the code. Please read the tutorial.

  • Max

    ok , i will check this out. But please, if i set the amount, is it going to apply to all products?  or do i have the possibilty to set it on individual product?  How can i get to the module at the backend?
    Regards

  • Megaamind

    Above module will pass the extra fee to only paypal or other payment methods as well?

  • Pingback: Your Questions About Installation Products | RoInstallation

  • G Donat

    Hi,

    thanks for this module, he is very useful ! One question do, in my back-office (invoice), the Fee line is shown after Taxes (I would like to see it just before subtotal), I had in config.xml :

    subtotalBut no changes.Do you have an idea ?

  • http://profile.yahoo.com/KBAB6MY6NUAXGEQMZPISXWTS54 Pravin C

    Hello Manish,
    I have used this module and its working fine, but having a small issue with Reward Points.
    It adds my fee to the reward amount.

    If i comment the below 2 lines then reward points are working fine , but then i get the wrong total as it miss that extra amount.

     $address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount()); $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());

    Do you have any idea whats going wrong here.

  • http://twitter.com/biswal805 Tanmaya Biswal

    Hi,

    thanks for this module, he is very useful ! One question do, in my
    back-office (invoice), the Fee line is shown after subtotal (I would like
    to see it in between tax and grandtotal).So please help me.

  • http://twitter.com/biswal805 Tanmaya Biswal

    Hi,
    Would you please help me to get the credit card information as well as number of items to calculate a surcharge amount dynamically depending upon the surcharge type.
    Its urgent.

  • http://www.facebook.com/profile.php?id=1600448954 Tiago Lourenço

    This is not working when you have multi currencies activated. Can you fix this? Thank you.

  • Down321

    why i can’t download the code. the link is failed.

  • Chida Tarek

     hi,
    i’m new on magento and i’m working on a module that permt a user to choose and to have the gfit with the product that he purchase.
    my question is, how can i set a discount on product in the checkout ?
    i’ve  used :
    i make the modification in the observer .

    $_cart_products = Mage::getModel(&quot;checkout/cart&quot;) -&amp;gt; getItems();
    
    //foreache...
    //if ...
    $_cart_product-&amp;gt;setDiscountAmount($realPrice-$giftPrice);
    $_cart_product-&amp;gt;setBaseDiscountAmount($realPrice-$giftPrice);
    

    But it dosen’t work
    thank you for your help  :)

  • srikanth thandra

     Hi,

         I want to have rule like depending on the customer group there should be two priced add one will be direct value in $ & another will be % both has to be added as fee1 and fee2. Please can you help me how can I do it.

    Thanks & Regards,
    Srikanth Thandra

  • http://www.facebook.com/raina.shikha Shikha Raina

    m nt able to download

  • http://www.facebook.com/iehsan Ehsan Ul Haq

     hi ,,

    i just copy the code in my magento folder ,.  when i refresh my cart i get this error :
    Fatal error: Call to a member function setTotals() on a non-object in C:xampphtdocsmagentoappcodecoreMageCheckoutBlockCartTotals.php on line 63is there something wrong  ?

    • http://www.facebook.com/hugo.mishra Hugo Mishra

        This error can be corrected by removing
      “fee/checkout_total” on line 52 from
      from file Fee/etc/config.xml

  • http://www.facebook.com/khusyal Khusyal Singh

    Fatal error: Call to a member function setTotals() on a non-object inD:AppServwwwMagento_16appcodecoreMageCheckoutBlockCartTotals.phpon line 63

    • http://www.facebook.com/hugo.mishra Hugo Mishra

       This error can be corrected by removing
      “fee/checkout_total” on line 52 from
      from file Fee/etc/config.xml 

  • http://www.facebook.com/greg.croasdill Greg Croasdill

    The module is missing the renderer file. There should be a Fee/Block/Checkout/Total.php file. 

    There is a Fee/Block/Sales/Order/Total.php file, so try patching that in.  To do this, Fee/etc/config.xml change line 52 from fee/checkout_total to                         fee/sales_order_total
    Now the module will run, but does not show the Fee line the checkout page (but you will note a $10 increase in the GrandTotal 

  • http://muralikalpana.myopenid.com/ murali

    hello manish,

    nice code. but when i click on “multiple shipping” on checkout page fee amount not working. it is displaying zero only. so plz tell me where i have to change for multiple shipping checkout page.

    Thanks

     

  • Zanghuagz

     Fatal error: Call to a member function setTotals() on a non-object in appcodecoreMageCheckoutBlockCartTotals.php on line 63

    • http://www.facebook.com/hugo.mishra Hugo Mishra

        This error can be corrected by removing
      “fee/checkout_total” on line 52 from
      from file Fee/etc/config.xml

      • Asif

        When we remove this renderer then it do not update the total in Orders, and even dont show the fee row

  • http://www.facebook.com/hugo.mishra Hugo Mishra

     This error can be corrected by removing “fee/checkout_total” on line 52 from from file Fee/etc/config.xml

  • http://www.magikcommerce.com/ Ashish @Magento Themes

    Excellent post Manish. Even many of our customers were asking for this feature that’s why we have created Magento extra fee extension which helps creating any number of additional charges which can be applied to entire cart, categories, individual products or shipping.

    I would love if you can take a look at it and share your feedback.

  • Siddiqur Rehman

    Hello,
    Thanks for this wonderful module. It is really very helpful. Actually I am trying to add one more fee “Fee 2″ (say) , through this module, for this i did the following :-
    1) I added required columns in corresponding tables.
    2) Changed the collect function to look like following :-
    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
    parent::collect($address);

    $this->_setAmount(0);
    $this->_setBaseAmount(0);

    $items = $this->_getAddressItems($address);
    if (!count($items)) {
    return $this; //this makes only address type shipping to come through
    }

    $quote = $address->getQuote();

    if(Excellence_Fee_Model_Fee::canApply($address)){
    $exist_amount = $quote->getFeeAmount();
    //$fee = Excellence_Fee_Model_Fee::getFee();
    $fee = 10;
    $balance = $fee – $exist_amount;
    $address->setFeeAmount($balance);
    $address->setBaseFeeAmount($balance);
    $quote->setFeeAmount($balance);
    $address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
    $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());

    $exist_amount = $quote->getFee2Amount();
    //$fee = Excellence_Fee_Model_Fee::getFee();
    $fee = 20;
    $balance = $fee – $exist_amount;
    $address->setFee2Amount($balance);
    $address->setBaseFee2Amount($balance);
    $quote->setFee2Amount($balance);
    $address->setGrandTotal($address->getGrandTotal() + $address->getFee2Amount());
    $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFee2Amount());
    }
    }

    3) Changed the collect function to look like following :-
    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
    $amt = $address->getFeeAmount();
    $this->setCode(‘fee_amount’);
    $address->addTotal(array(
    ‘code’=>$this->getCode(),
    ‘title’=>Mage::helper(‘fee’)->__(‘Fee’),
    ‘value’=> $amt
    ));

    $amt = $address->getFee2Amount();
    $this->setCode(‘fee2_amount’);
    $address->addTotal(array(
    ‘code’=>$this->getCode(),
    ‘title’=>Mage::helper(‘fee’)->__(‘Fee 2′),
    ‘value’=> $amt
    ));
    return $this;
    }

    Now, the problem is that it is adding both the fees to the grand total, but showing only the second fee on cart totals and on checkout page order review step. It is saving only first fee in “sales_flat_quote_address” table and not my second fee in their columns.
    And on creating order, it is not saving the values of my second fee to “sales_flat_order” table.

  • swamy

    i am using express check but i was not working correctly for that,if we update the subtotal amount when it redirect to pay pal site it as showing the desription summary was empty

    • jur

      do you fix this?

      • swamy

        yes i have fix the problem

  • Samit

    Hi i tried to use this extension with onestepcheckout, The fee is not being saved in the database

  • Asif

    Hello
    this seems v goog. i have a little issue with this :

    fee/sales_quote_address_total_fee
    fee/checkout_total

    Without this fee/checkout_total , grand total update only on cart , and checkout page. not in creditmemo and invoice . if i add this renderer then it gives me error on cart page, where total appear.

    Can anyone know about this issue, how to resolve

  • Dat Pham

    Thanks for this module. I want have a textbox and a button “Apply” to enter discount price. When i enter discount price and click button apply, Total price will discount with discount price i had enter.
    Please help me!

  • Ryan

    Do you have a version of this where it is a fee with a select box?

    Non-profit organisations would find it useful e.g. add £1 to chosen charity on order checkout similar to what ebay do.

  • Omar

    Call to a member function setTotals() on a non-object in……Can you tell me how to fix that . working on magento 1.7

  • Daniel

    Dat Pham I have the same problem. I want apply the discount when I click button. How I do it?

  • Manan

    hi….manish thanx a lot for code but it’s not working in magento
    1.7.0.2…i’m getting error “Fatal error: Call to a member function
    setTotals() on a non-object in
    /opt/lampp/htdocs/magento/app/code/core/Mage/Checkout/Block/Cart/Totals.php” and i am using blaco theme for magento. I was manually installed it and in the template/theme(blanco) folder but the error remains. And i want to know from where i can see change the extra fee for payment in the admin module or in the code itself?

    • akash

      Hello Manan I also get same error.do you find any solution??

      Please let me know if is there any solution.

      Thanks.

    • akash

      Hi manan i get solution thanks to nikhilravindran.

      Solution is remove fee/checkout_total in config.xml on line No. 52.

      good luck.

      • Anuj Sharma

        Hey! I removed it but now i don’t see anything on backend.

  • Ann

    Hi, could you tell how add custom total to the invoice/creditmemo pdf (button Print)?

    • Ann

      Sorry, I found mistake, I missed ‘_amount’ in the

  • http://www.facebook.com/asra.shoaib.1 Asra Shoaib

    Not working for me!! Review is not displaying !! Stucks on payment information !!

  • http://www.facebook.com/asra.shoaib.1 Asra Shoaib

    i put all files as were in sample code but the system stuck on payment information !! review order does not appear !! what shoul i do ?? or how can i remove this error

  • LiquidIce

    Another problem,

    When I set the activation conditions in

    public static function canApply($address){

    //put here your business logic to check if fee should be applied or not

    //if($address->getAddressType() == ‘billing’){

    return true;

    //}

    }

    I want it to be activated in case the payment method is Check /Money Order.

    The variable age::getSingleton(‘checkout/session’)->getQuote()->getPayment()->getMethodInstance()->getTitle() only has a value when you are checking out. So, for the mean time that variable has no value, it doesn’t work. So if I go to my cart, it doesnt load because Fee doesnt have a value.

    • http://www.facebook.com/asra.shoaib.1 Asra Shoaib

      i am facing the same problem!!

  • http://www.facebook.com/asra.shoaib.1 Asra Shoaib

    The module does not contain Fee/etc/config.xml !! can u upload that file?

  • Mary Brook

    Hi! You can also do this with Special promotions extension http://amasty.com/special-promotions-pro.html

  • Oscar O

    Hello, I have a bug in the checkout, when I go to pay I realize that the value of the fee is $ 0 and I have changed to $ 5, someone has the same error?

  • anand

    how i can download this module..please send me link..facebook login is not working here

    Thanks,

    • Manish Prakash

      Hi anand
      You can download this by facebook login. Its working.

  • Max

    Hi Manish, thanks you for the module and explanation. I installed module and it works but, when customers receive email receipt by email Total amount is with Fee but there is no Fee in range of Subtotal, Shipping … e.t.c How to add Fee to email template ? Thanks

    • arul

      I have the same problem… pls give any solution …

  • jur

    not working in paypal express checkout. the order summary details does not display. works fine in standard paypal payment

  • jur

    just got my solution for other payment method., other than paypal standard.. thanks :)

  • hafeez

    great work.i have installed on magento 1.4.2.0 and it works fine and issue is that no fee is being displayed in customer email..any help

  • http://www.facebook.com/Gurname Gurname Singh Saini

    Please give me a download link how i download this module?

    • Manish Prakash

      Hi gurname,
      the download link is given in this blog itself. you can download the module by logging into your facebook account.

  • pardeep

    how to override or update grand total in magento .pls help

  • arul

    Hi, this module is working good. but order and invoice Email discount amount is not showing.. Pls help anyone. thanks in advance.

  • Adam Kernig

    Hi Manish,

    I have installed your tutorial on Adding a fee, and it works absolutely perfect, I was wondering, having a set fee is fine, but is it possible to set it as a percentage.

    Im looking at the fee generation files (both fee.php files) And I keep playing with the code but unfortunatel y I just seem to change the fee to the grand total, and then doesnt add up to the grand total.

    Any kind of push is greatly appreciated, btw this is my first module installation / customizing!

  • nikhilravindran

    Hi manish ,

    I added the module in my magento installation ..

    But in checkout part after selecting ‘Payment method’ it redirects again to View Cart page . . .

    Exception log : Invalid block type: Excellence_Fee_Block_Checkout_Total’ …

    Please help

    • nikhilravindran

      Fine . Done with this .
      Below in discussion everyone have advised to remove fee/sales_order_total

      in line 52 – config.xml .
      After removing it is showing properly fee part .
      Delete cache of magento and after that delete browser cache also .

      • http://www.facebook.com/shakyaabiral Abiral Shakya

        Or create your own renderer Block Class at app/code/local/Excellence/Fee/Block/Checkout/Total.php
        class Excellence_Fee_Block_Checkout_Total extends Mage_Checkout_Block_Total_Default
        {
        }

  • murali

    hello manish.

    its nice plugin. is it possible to apply this fee to cart subtotal lessthan 100$.

    thanks

  • murali

    here how can i restrict with cart subtotal amount. i need to apply this fee to below 100$ cart subtotal orders only. but here “class Excellence_Fee_Model_Sales_Quote_Address_Total_Fee” i am getting cart subtotal zero. so how can i restrict this fee? please help

  • akash

    Hello Manish I get error “Call to a member function setTotals() on a non-object in appcodecoreMageCheckoutBlockCartTotals.php on line 63″. on checkout page when i install this module in Magento ver. 1.7.0.0.

    Please let me know if is there any solution.

    Thanks.

    • Wilson Sheldon

      Hi Akash. Did you find a solution for this?

      • Wilson Sheldon

        Looks like it’s to do with the node in config.xml. I’ve removed and that appears to have fixed it.

  • Luciano Bonfim

    Please, Where do i change the label “Fee” in my frontend?

  • Luciano Bonfim

    Please, Where do i change the label “Fee” in my frontend?

  • Cristian

    Hi Manish! Is it possible to customize this module to apply a tax or discount to the checkout via a option chosen by the customer? What I mean is if it is possible that the customer to chose during the checkout one of three options discount, regular price or tax (let’s say depending on how quick one chooses to have the products delivered).

    One step further is to have the discount automatically calculated using the cost price and the regular selling price.

    Let me know… Best regards!

  • Cristian

    Hi Manish,

    I was wondering if you can customize on request this module as a checkout option with three options: a discounted total, the normal price and a fee.

    I can give you more details by mail if you are interested.
    Thanks a lot!

  • Chris

    Hi Manish
    Im a very new beginner of magento and I want to ask you how can I install this module in magento?
    Thank you very much

  • Janak Bhimani

    Hi manish,

    I have develop custom module discount like fee module my custom module flow same as fee module, in fee module fee is added to subtotal and calculate grand total while in my custom discount module discount is subtract from subtotal and than calculate grand total but it conflict with core shoppin cart price rule, shopping cart price rule is not apply on cart, while i am disable to my discount module than it apply..

    can you help me why it happened..?

    Thanks in advance

  • Janak Bhimani

    Hi Manish,

    Fee module is very good and helpful but it conflict with core shopping cart price rule, could you help me to find out where this module is touching the core shopping cart price rule functionality..? The problem is when i create shopping cart price rule its not applyed on shoppin cart but when i disable fee module its apply, i am using Magento ver. 1.7.0.0

    Thanks in advance

  • Rameshwar Solanki

    hi….manish thanx a lot for code but when I create invoice at admin panel,invoice do not include fee amount. I want to know from where i can see change the extra fee for payment in the admin module or in the code itself?

  • Sunil

    Hello,

    Good article.

    Question:- I am using multiple warehouse module. Now order split into based on nearer warehouse location.
    Now i want to divide fee amount based on number of split that order.

    Look forward your replay.

    Thanks,
    Sunil

  • Gurpreet

    Hi,

    Thanks a lot. This module is working fine for me. i need to show another filed in total box. Can i add another fields using this module. The extra will have the static value.

    Thanks in advance.

  • ramakrishna

    i am unable to download this , please help

  • ramakrishna

    Hi Manish, i am unable to download the code, the facebook button above does not work, can u help

  • jaga

    Hi Manish,

    This Module is really good, i guess it is not working properly

    In Admin side sales-> order that fees is not display, but grand total display correctly

    Please help

    Advance Thanks
    Jaga.s

    • jaga

      Sorry Manish , This module is working correctly in community version. But not working in enterprise version.

      In enterprise version admin side and front end order display page this module not working properly

      Please help

  • sant

    hi,

    i was trying to get subtotal of cart folder path appcodelocalExcellenceFeeModel at fee.php page to apply my custom business logic using below code but not working

    $totals = Mage::getSingleton(‘checkout/cart’)->getQuote()->getTotals();
    $intTotal = $totals["subtotal"]->getValue();

    or

    $session= Mage::getSingleton(‘checkout/session’);
    $getotal = Mage::helper(‘checkout’)->getQuote()->getGrandTotal();
    $totals = Mage::getSingleton(‘checkout/session’)->getQuote()->getTotals(); //Total object
    $subtotal = $totals["subtotal"]->getValue();

    both are not working. Do you have any solution ?

    • Francesco

      Hi did you find a solution for this? I need also to get dynamically fee amount depending grand total

      • sant

        Hi Francesco ,

        $_orders = Mage::getModel(‘sales/order’)->getCollection()->addFieldToFilter(‘customer_id’,$customer_id);

        $_orderCnt = $_orders->count(); //orders count

        $totals= Mage::getModel(‘checkout/session’)->getQuote()->getTotals();

        $intTotal = $totals["subtotal"]->getValue();

        // echo $intTotal; this will show you total cart value

        • Francesco

          Hi, first thank you for you reply and share :)
          I have a question: the $customer_id variable is important? and how i can get it for not logged user?
          Thank you

          • sant

            Hi Francesco,

            paste below code outside the function

            $totals= Mage::getModel(‘checkout/session’)->getQuote()->getTotals();

            $intTotal = $totals["subtotal"]->getValue();

  • goplastic

    hi, how can i change the fee value?

  • sant

    Hi mansih,
    Coupon code is not working with this module.i have generated coupon code from admin by promotion-> shopping cart price rule-> on subtotal.

    It must be a rule priority problem. You must have too short out this problem.

  • bhaskar

    how to add this extra amount dynamically

  • bhaskar

    how to add an extra cost dynamically an according to input given in field by user

  • James Lang

    why can’t download it, please?

  • james

    hi, i can’t download this module, could you send this module to my mail,please? thanks

  • james

    hi, how set this module, please

  • Horse

    Thanks for this module – honestly it’s a massive help, it’s not often this kind of thing is offered on a plate to eager learners!

    I am currently finding a discrepancy between the fee amount and the grand total – extra tax is being added whether the fee is present or not. Do you know why this may be?

    Many thanks in advance

  • Murat Gedik

    Hi; sorry bad english; I have a problem: My checkout page
    amount =19.90
    fee = 10.00
    delivery price = 5
    but totalt amount = 36.37

    Why is it incorrect total?

  • Geetika Sharma

    I want to create fee as text box or fee fetch value from any text box on create order page then continue same process for addition or deduction . If any one know please help or give me any suggestion

  • Thangadurai

    Hi, This module working good. But when i place the order its not showing the fee summery in email. Please any one know the answer?

  • Muhammad Zahid

    Hi Manish,

    This is not adding a fee amount to the database mean. In the back end its showing amount without fee amount please provide solution.

    Thanks
    Zahid

  • Muhammad Zahid

    Hi Manish thanks for this module but I have a one problem I am getting order total without fee amount please provide some solutions.

    Thanks

  • Omar

    On Cart first time it not shows 0.00 but soon refresh the page it shows the total can u tell me how to fix it ? and why this doing like thanks

  • Uoc Mai

    hi. Thank for this article, that is very useful. One a question, I want to display Fee in invoice order and email, so please help me. Thak.

  • Richard Luckhurst

    Hi Manish

    I am interested in using this module with Magento CE 1.9. I am finding that when I try to display the checkout I am getting an Exception thrown

    exception ‘Mage_Core_Exception’ with message ‘Invalid block type: Excellence_Fee_Block_Checkout_Total’ in /var/www/html/xxxxxxx/app/Mage.php:595
    Stack trace:
    #0 /var/www/html/xxxxxxx/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException(‘Invalid block t…’)
    #1 /var/www/html/xxxxxxx/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance(‘fee/check…’, Array)

    I would appreciate some help on what to look for in fixing this Exception

    Regards

    Richard