Extra Fee Shopping Cart Price Rules Magento

Magento has a the feature to create rules in the Shopping Cart.

Under the Promotions tab in your admin panel:

It’s cool but it’s not cool enough. What I wanted to do is to set a surcharge for one payment method. I needed to add a charge in PayaPal method.

So I found the way you can set negative discounts (what means a surcharge) in the cart total price.

Note: we are going to change Magento Core files. Please make a backup of your files before continuing.

1. Go to app/code/core/Mage/Rule/Model/Rule.php

Find the line:

Just add some bars // to comment the code:

2. Now go to: app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php

Look for:

And again comment like this:

3. Translate the discount word.

Go to app/locale/es_ES (I’m using the Spainish translation so maybe yours would be en_US)

Find a file called Mage_Sales.csv. Inside look for the word discount you will find something like:

You can change the value in order to show your own text. For example:

Done! Now you’re free to set negative values in the input field:

Fixed amount discount for whole cart

If you select this option the code above will not work entirely.

Read this comment below to learn how to fix it.

112 Responses to “Extra Fee Shopping Cart Price Rules Magento”

  1. JMLeon March 25, 2010 at 10:38 am #

    Interesting, I’ve been using magento quite a while now and I’ve been unable to make some kind of discounts. Problem with this solution is upgrades, as always.

  2. quicoto March 25, 2010 at 10:40 am #

    Hey JMLeon,

    Thanks for commenting.

    Are you using the 1.4 version?

    The discounts works great in the last version.

    Regards.

  3. CJ March 27, 2010 at 8:14 pm #

    Thank you for that. I used your example to create a custom setup fee for items that are imprinted with customer logos.

    This becomes upgrade proof if you place these changed files under the app/local/folder so as not to overwrite the core code.

    • quicoto March 27, 2010 at 9:41 pm #

      Well thanks to you. I’ll try that about the upgrade 😉

      Regards.

    • Brad S June 6, 2010 at 5:46 pm #

      CJ, if you are doing imprints, can we talk? I am doing silk screen T-shirts & embroidered polos and having a tough time allowing people to meet a minimum order using different sizes, then applying a discount for total quantity.

      In other words, if they order 12 small and 12 medium, how do I give them 24 quantity discount? I have shopping cart rule set up but it is not working correctly for 12 + 12, but works fine for 24. But rule says if quantity total is equal to or greater than 24…

      Why wouldn’t it add 12 + 12?

      Thanks,

      Brad

    • quicoto June 6, 2010 at 10:32 pm #

      It’s really weird Brad.

      I was going to answer you “create a cart rule” but you already did 😕

      • Brad S June 7, 2010 at 5:24 pm #

        I figured it out. If I make the rule under “conditions” and the again under “actions” it works. Maybe I don’t need the rule in “conditions”? I’m a bit confused as to what the difference is.

  4. Lu April 7, 2010 at 6:49 pm #

    Exactly what I have been searching for – thank you!

    My customer needed a fee for cooled products. It’s ridiculous that Magento only supports the discounts. In my opinion a so called “price rule” should be possible in both ways.

    Unfortunately my translation doesn’t work. I updated the app/locale… directories as in your example and the locale files of my template.

    Any idea?

    Thanks again.

    • quicoto April 7, 2010 at 9:11 pm #

      You’re welcome 😉

      Did you cleanned (refresh?) the caché?

      Regards.

      • Lu April 8, 2010 at 12:16 am #

        Yes, I did. Several times.

        There are no additional characters (I know this can cause problems – evil german language), nothing special at all. The correct german word for discount is being used, but that’s it. I checked all the csv-files in both directories, but nothing changes.

        I need a beer. ^^

      • quicoto April 8, 2010 at 12:25 am #

        Maybe you’re changing something wrong. Maybe I was wrong (at least it worked for me in a Magento 1.3 version).

        Are you using the 1.4 version? Could be diferent 😕

      • Lu April 8, 2010 at 2:07 pm #

        Yes, it’s 1.4. I read some rumours, that some of the translation files could be somewhere in the database.

        Anyway, I’ll run some tests now. Thanks again.

  5. oginome April 22, 2010 at 9:31 pm #

    Thx. It really works to allow input the negative discount amount in actions of Shopping Cart Price Rule.

    But after saved the rule, the negative discount amount works for “Fixed amount discount” but fail for the “Fixed amount discount for whole cart”.

    I’ve tested both work for positive discount amount.

    • quicoto April 22, 2010 at 10:50 pm #

      Hey oginome,

      I think I did not test the “Fixed amount discount for whole cart” maybe this cheat will not work for that 😕

      I’ll try to look at it if I have time.

      If you find any solution, please feel free to post it 😉

      Regards.

      • Simone April 28, 2010 at 6:49 pm #

        Hi quicoto!
        Thanks for this guide.
        I’ve the same problem of oginome.
        Any ideas?

        Regards.

      • quicoto April 28, 2010 at 7:17 pm #

        Hi Simone,

        I could not research about it but since Magento doesn’t do this by default I know don’t know if there is any solution 🙁

  6. Neils April 26, 2010 at 10:48 am #

    Hi,

    currently I try to modify the way of catalog rules. I made the changes to the corresponding files for catalog rules and i was able to use negative amounts….but….e.g.

    I have a product ‘A’ with a price (normal) of 30.00. When a special customergroup is logged in the price should be 35.00. So I made a rule which have -5 as discount amount. But it looks like when the price is higher than the normal then always the normal price is shown.

    Is there a way to allow higher prices?

    Thanks,
    Neils

    • quicoto April 26, 2010 at 10:53 am #

      Hi Neils,

      I’m not sure.

      Maybe you should set the normal prize to 35 and add the -5 discount for all non X-Customer-Group.

      Hope it helps.

      Regards.

      • Neils April 26, 2010 at 10:57 am #

        Hi Quicoto,

        yes, this is the last option 😉 But it would be much nicer when i can use the rules, cause when the “extra fee” change, i have to change all related product prices….

        Regards.

  7. Lu April 26, 2010 at 10:55 am #

    Hey,

    I had the same problem, I needed a fixed fee for the whole cart. I’m afraid you have to do some core-hacking here (again), because there is a nice little if, that prevents a negative discount.

    app>code>core>mage>salesrule>model>validator.php

    Gets interesting at the “cart_fixed” case. “if $cartRules[$rule->getId()] > 0)” etc. If you simply change it to “<" your negative discount will work (and nothing else). That's the quick'n'dirty way.

    Now my new problem is, that there's no tax in this fee. And unfortunately most of my products are food with a lower tax, so I can't just put the fee in one amount with the products. If anyone has experience with the tax stuff…

    Regards 😉

    • quicoto April 26, 2010 at 11:04 am #

      Everything in tax and fees is dirty in Magento.

      There is a paid solution (extension) see it here

      I don’t how good it that but maybe it saves time and headaches 🙂

      Regards

      • Lu April 26, 2010 at 11:26 am #

        Thx, I found this extension too. But as far as i know, the field is voluntary?! This won’t work in my case, you shouldn’t have the choice if your salami is being sent chilled or not. 😉

      • quicoto April 26, 2010 at 11:29 am #

        LOL 😛

    • Raúl Blasco February 1, 2012 at 2:02 pm #

      Hello Lu,

      Thanx so much, your dirty solution works great, with a little change it works with positive and negative discounts. Instead of changing ‘>’ by ‘<', I asked it to check whether the value is different than some impossible value in this case, so it will always bypass the check, I know that this is even dirtier jejeje:

      [code]if ($cartRules[$rule->getId()] != 'x')[/code]

      PD:It works for me on 1.6.1.0, hope Magento improves all these in future releases, other apps in the market all ready have this kind of features.

  8. Nicola May 4, 2010 at 5:58 pm #

    Hi, i’m working on an extrafee like this, because i have a category “frost food” that need an extra fee for special container that cost 15€.

    What i did:

    1) in Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php

    i added a new option “Extra fee”:
    [code]
    $fieldset->addField(‘simple_action’, ‘select’, array(
    ‘label’ => Mage::helper(‘salesrule’)->__(‘Apply’),
    ‘name’ => ‘simple_action’,
    ‘options’ => array(
    ‘by_percent’ => Mage::helper(‘salesrule’)->__(‘Percent of product price discount’),
    ‘by_fixed’ => Mage::helper(‘salesrule’)->__(‘Fixed amount discount’),
    ‘cart_fixed’ => Mage::helper(‘salesrule’)->__(‘Fixed amount discount for whole cart’),
    ‘buy_x_get_y’ => Mage::helper(‘salesrule’)->__(‘Buy X get Y free (discount amount is Y)’),
    ‘extra_fee’ => Mage::helper(‘salesrule’)->__(‘Extra fee’),
    ),
    ));[/code]

    2) in Mage/SalesRule/model/Validator.php

    i dadded a new “case ‘extra_fee'”:

    [code]
    case ‘extra_fee’:
    $cartRules = $address->getCartFixedRules();
    if (!isset($cartRules[$rule->getId()])) {
    $cartRules[$rule->getId()] = $rule->getDiscountAmount();
    }
    if ($cartRules[$rule->getId()] > 0) {
    $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
    $discountAmount = -$quoteAmount;
    $baseDiscountAmount = -$quoteAmount;
    //$cartRules[$rule->getId()] -= $baseDiscountAmount;
    $cartRules[$rule->getId()] =0;
    }
    $address->setCartFixedRules($cartRules);
    break;
    [/code]

    3) in Mage/Sales/Model/Quote/Address/Total/Discount.php

    [code]
    if($amount>0)
    {
    $title = Mage::helper(‘sales’)->__(‘Discount’);
    }
    else
    {
    $title = Mage::helper(‘sales’)->__(‘Extra fee’);
    }
    [/code]

    Please note: do not override the files, but copy them under local with the same structure!!!

    This is working well, but what i want to do now is: add an extrafee every (example) 5 item in the basket. Let’s say, if you have only 5 frost food, you need only a container, if you have 10 items, 2 containers, and so on.

    Another problem i have (but this is minor) is that is i have extrafee i can’t have discount or viceversa, because it do the sum and this is not clear to customers.

    Any idea on how to solve? 🙂

    Thank you and sorry for my english!

    Nicola

    • quicoto May 4, 2010 at 6:15 pm #

      Hi Nicola and thank you for you comment.

      I do not understand everything in your code. About the items problem…

      Maybe there is a function that give you the cart items. But seems doesn’t seem to be easy 🙁

      In the other hand there is a condition “Total Item Quantuty is….” maybe you can use that condition in addition to the other one.

      I’m sorry I’m not helping so much.

      Regards

  9. Nicola May 4, 2010 at 9:40 pm #

    Yes, it is what i’m trying to do 😉

    I have a post on the magento community too, hoping someone can help.
    http://www.magentocommerce.com/boards/viewthread/177428/

    Thank you again.

  10. Brad S June 7, 2010 at 5:37 pm #

    Quicoto,
    Is there a way to add a single flat fee to the whole order in the shopping cart? I’m afraid if I change the code as you suggest my hundreds of other price rules won’t work?

    I have a $50 set up fee that I originally added to the configured product but I only need to charge it one time. If they order two or more products, they keep getting hit with another $50.

    • quicoto June 7, 2010 at 10:19 pm #

      The code I posted should not conflict the normal rules. It just remove the imitation for negative discounts.

      If you want to try it out, please make a database and files backup before proceed 😉

  11. nicework June 15, 2010 at 8:33 am #

    Hi Quicoto,

    thanks for posting this, just what ive been looking for.. thx!!.

    Howabout the transactual sales email. i cant remove the – (minus) i the discount/fee line. what have you done, i´ve checked .phtml files, the emails i set up i backend etc, and ive gone blind 🙂

    Also im looking for a solutions for an “extra” discount line in the cart and on sales emails, so both fee and discounts are specified in the cart, as postet by Nicola, if i find the way, ill post it, as this can be quite a problem….

    thanx again!

    • quicoto June 15, 2010 at 8:37 am #

      Oh right, I did not digg into it (yet) but doesn’t look easy 😕

      And… You’re welcome!

      • nicework June 15, 2010 at 5:07 pm #

        Found it. i changed the file /app/design/frontend/blank/default/template/email/order/items.phtml.
        Look for the line, formatPrice(0.00 – $_order->getDiscountAmount()), i changede it to formatPrice(0.00 + $_order->getDiscountAmount()), (Change – to + ). Works for me and my site…

        BTW, this is also the file where you can changes the layout for the last “handle” in the order trans. mails.

        Man, i think im close to finish:-)
        Thx for leading the way….

      • quicoto June 15, 2010 at 8:00 pm #

        Thank to you for the tip!

        Feel free to post any questions or tips in our Forums or sending one 😉

        Regards.

      • nicework June 16, 2010 at 8:22 am #

        NOTE… this ajustment will mess up the “total sales” on the dashboard in Mag. backend….

        Still works for us as we dont use this….

        just so you know…

  12. Welanie August 31, 2010 at 8:53 pm #

    Hi,

    This is a great post thank you. I made it work in no time on the shopping cart price rule but how do I make it work on the catalogue price rule. I need a set up fee adding up to every item and not only to the final price of the shopping cart.

    Thanks

    • quicoto August 31, 2010 at 9:14 pm #

      Hey Welanie,

      I was surfing the magento admin and I don’t see any option to set the rules for items. It is a whole “Shopping Cart” rule 🙁

    • Nicework September 1, 2010 at 8:47 pm #

      Hi Welanie

      I see your problem, however i dont have a solution for this.
      I hope you find your way.

  13. NightWalker September 5, 2010 at 4:39 pm #

    So I’ve made the modifications noted in this post, but magento still tells me I cant have negative numbers in the percentage field, any idea why that may be?

    TIA

    • quicoto September 5, 2010 at 9:59 pm #

      Weird… If you remove the validation it should not validate 😕

      • NightWalker September 6, 2010 at 12:25 am #

        I’ve actually come across the problem of making changes and not having them be reflected in the system.

        Do you know why this could be?

      • quicoto September 6, 2010 at 12:39 pm #

        Do you have the Cache ON ?

      • NightWalker September 6, 2010 at 1:28 pm #

        No, Cache is off right now because I had not finished modifying my store.

      • NightWalker September 6, 2010 at 5:31 pm #

        Ok just followed steps to ensure that cache is flushed, that indexes are up to date and make sure compilation is disabled, I still get the error message.

        Any ideas.

      • quicoto September 6, 2010 at 5:35 pm #

        No idea, sorry :

  14. vasilis September 7, 2010 at 1:14 am #

    Hello
    i use Magento ver. 1.3.2.3 and i have a problem with a shopping cart price rule.
    1.i make a rule name for single client with discount 10% off with some coupon code.
    2.in a first step in checkout page everything is look good (the prices and the discount)
    3. In the last step of checkout page (payment page) the discount is not there
    4. When i’m going to admin area i see this rule name is inactive…..

    Any idea?

    • quicoto September 7, 2010 at 8:18 am #

      hard to say, sorry 😕

  15. lord_fornax September 20, 2010 at 1:37 pm #

    It does’t work for my shop (Manento 1.4.1.1).

    The rule applies fine when a user is logged in (it seems that the last payment option is remembered).

    For a new customer (or a customer who hasn’t logged in, there’s a error message saying the product can’t be put in the shopping cart.

    Looks like the shopping cart promotion does’t work if the payment method is unknown.

    • quicoto September 23, 2010 at 8:17 am #

      Maybe the code just doesn’t work for the newest version 🙁

  16. chanjay October 6, 2011 at 1:11 am #

    Hi,

    This actually works fine with me using Magento version 1.6. However when I use Paypal to checkout then redirected to Paypal account page, it still shows “Discount” and it minus the subtotal (instead of adding).

    Any idea how to manipulate the Paypal stuff?

    Thanks.

    • Rick October 6, 2011 at 8:23 am #

      No idea chanjay 🙁

      Have you looked for an extension ?

      Regards

  17. leo October 19, 2011 at 4:20 am #

    That’s very helpful, however for my case, i need to add a shipping choice for the buyer.

    There maybe a checkbox on the checkout page to allow buyer to pay for insurance or not, is that difficult?

    • leo October 19, 2011 at 4:33 am #

      Find a bug, when checkout and go to paypal page, the fee become discount again, e.g. -10% become the real discount of 10% , i think it needs some additional changes on the paypal module code

    • Rick October 19, 2011 at 8:35 am #

      I think there’s an extension somewhere to add a field to the check out process.

      If you find anything please post it 😉

    • leo October 19, 2011 at 9:26 am #

      I found an extension from AITOC named “Extra fee” (However it needs to paid)

      http://www.aitoc.com/en/magentomods_extra_fee.html

      That allows to customize the fee title/description/percentage/amount and a checkbox in checkout process.

      • Rick October 19, 2011 at 10:30 am #

        Sometimes the time you spend isn’t worth it. The extension may solve your problem fast and easy 🙂

  18. Budi November 14, 2011 at 9:25 am #

    Thanks for your method

    How to set that the fee only occur one time

    Result in me is every item added, the cost occur

    For example, we want to charge only $1 for each purchase (for insurance purpose), but currently if customer add 2 different product, the cost become $2 (We need to keep $1 regardless how many item purchased)

    Strangely the cost only occur once if the quantity for an item is more than 1, for example, if we add 2 pcs item A and 1 pcs item B, the charge becomes USD 2

    Any help is very appreciated

    Thank you

    • Budi November 14, 2011 at 9:42 am #

      The result above is when setting:
      Apply = Fixed amount discount
      Maximum Qty Discount is Applied To = 1
      Discount Qty Step (Buy X) = 0
      Apply to Shipping Amount = No
      Free Shipping = No
      Stop Further Rules Processing = Yes

      I tried to change:
      apply -> Fixed amount discount to whole cart

      Result = the fee is totally gone 🙁

    • Rick November 14, 2011 at 9:49 am #

      The code I posted it doesn’t always work as expected.

      Have you considered using an extension ?

  19. Lnk November 28, 2011 at 10:56 am #

    Hi! The code works for me in magento 1.5.1
    I use this for the extra fee in paypal payment method.
    All is OK but when the store redirects to paypal, this doesn’t add the % and it discounts.

    Any tip ??

    Thanks in advance!

    • Lnk November 28, 2011 at 12:54 pm #

      found the way to make paypal add the discount.

      in app/code/core/Mage/Paypal/Model/Cart.php

      search for all “TOTAL_DISCOUNT” and where there is a “-” change for a “+”.
      It works for me because i don’t have any more discounts actually.

      Hope it helps!

    • Rick November 28, 2011 at 3:41 pm #

      Thanks for the Top Lnk!

      Perhaps you could put that in app/code/local

      It will allow you to upgrade the Magento Core without losing your changes.

      Regards.

    • leo November 29, 2011 at 3:31 am #

      The term for paypal is also discount, and after payment in your orders it’s wrong again and confused about the discount or extra fee.

      So maybe pay for the extension is the best solution..

  20. Tiago December 31, 2011 at 4:48 am #

    This does not work on 1.6.1, the value sent to paypal is positive so you will discount 3.4%, and you will get a notification of possible fraud on that order at magento.

    • Chris April 12, 2012 at 12:33 pm #

      Did anyone find a solution to make this work on Magento 1.6.1?

  21. raul January 5, 2012 at 4:59 pm #

    I solve this problem going to PayPal (my profile).
    There’s an option “Calculation delivery”
    If you set there Percent % and set for example 3%.

    All your clients paid with paypal, when arrive at pay page Paypal have the EXTRA FEE of 3%.

    You have to put a notice in your website to explain this charge as well.

  22. Rova June 4, 2012 at 2:33 pm #

    Hello,
    Someone have a solution to have a shopping cart surcharge negative rule on magento 1.7.0.0 ?
    Thank you

    • Matthew June 26, 2012 at 4:16 am #

      I am looking for the same solution using Magento ver. 1.7.0.1.

      I know there are extensions available. However, I have no idea what else these extensions are doing. Looking forward to somebody having the ability to solve this issue in most recent version.

    • tera July 16, 2012 at 12:35 pm #

      this works on Magento 1.7.0.2
      edit “app/code/core/Mage/Rule/Model/Actions.php” not the “app/code/core/Mage/Rule/Model/Rule.php”

    • Rick July 16, 2012 at 12:37 pm #

      Thanks for the heads up tera! 😉

  23. tera July 16, 2012 at 12:40 pm #

    Great Tip!

    Normally magento shopping cart price rules calculate on Subtotal.
    when using the “Percent of Product Price discount” method.
    i want to calculate it on (Subtotal+Shipping & Handling Charges)
    how can i solve my problem…

    Thank you!

  24. Volodymyr July 24, 2012 at 8:43 am #

    This is awesome. Works with EE. Thanks.

  25. sainompk August 28, 2012 at 11:39 pm #

    In 1.7 no condition found in Rule.php, any idea for 1.7

  26. sainompk August 29, 2012 at 12:10 am #

    🙂 got it : magento 1.7 : go to /app/code/core/Mage/Rule/Model/Abstract.php and edit line No. 94 to 96….

  27. sainompk September 1, 2012 at 10:20 pm #

    But paypal shows as discount :(… useless trick..

  28. sainompk September 1, 2012 at 10:23 pm #

    and also paypal not plus the amount, show discount and negative value…

  29. jur October 30, 2012 at 10:51 am #

    cant use this trick into paypal payment method

  30. Budi November 20, 2012 at 9:52 am #

    HI there,

    Mine is still showing “Discount (Surcharge) : ” How do i completely remove the discount at the front?

    • Rick November 20, 2012 at 9:59 am #

      Hi Budi,

      Have you followed step 3?

      Have you cleared the Magento Cache?

      Try clearing your browser cache as well.

      Let me know if this works.

      Cheers.

  31. Budi November 22, 2012 at 5:08 am #

    I did. I changed it on the 2nd column. The word discount is still appearing during checkout 🙁 I’m using 1.7.0.2

  32. Budi November 22, 2012 at 5:50 am #

    ok, this is weird…i solved it, but i had to change the ‘locale’ to english (united states). I’m using english (united kingdom) how do i fix this with united kingdom? i created en_UK and copied the mage_sales.csv files to that folder but still it’s not showing the ammended text. It’s showing discount. When i change it to united states it will show ‘surcharge’ which is the text i ammended.

    • Rick November 22, 2012 at 10:34 pm #

      That’s a though one Budi.

      I don’t know if it’s suposed to be a en_UK file in there.

      it’s been a while since I played with this things, I’d have to digg about it.

      If you happen to find an answer to your problem, please post the solution!

      Cheers.

  33. Budi November 25, 2012 at 6:10 am #

    if i’m using english (united kingdom) would u know where it will load the mage_sales.csv from?

  34. Boatmagic January 16, 2013 at 6:47 pm #

    I got this code to work in 1.7.0.2, but there is an issue when using it.

    The amount applied (in this case a negative number, which of course is really a increase in the costs) does not work because the taxes calculated in Magento ignore this increase in price.

    Real example from my store:

    item – $279.87
    Extra Fees $27.00 (from this code)
    Shipping – $26.95
    Total – $333.82

    Tax – (10% here) = $27.99 which is incorrect.
    Reason, we don’t have tax on shipping.
    The tax should be $279.87 + $27.00 + 10% = $30.69

    This code however only allows Magento to calculate tax on the item price $279.87 + 10% = $27.99

    Unfortunately this makes the code in Magento useless unless of course you do not charge tax.

    • Boatmagic January 16, 2013 at 6:58 pm #

      After further research, I can say the code is working correctly even though I stated it did not.

      Explanation:

      The discount applied in magento is treated as a non-taxable item.

      279.87+27+26.95=333.82
      333.82-(ship$26.95)=306.87-(extra fees$27.00) = 279.87
      279.87+10%(tax)= $27.99
      27.99+279.87+27+26.95=361.81 which is correct

      Everything is working correctly

    • Rick January 16, 2013 at 7:54 pm #

      Thank you for posting it ! 😉

      Cheers.

  35. Boatmagic January 16, 2013 at 8:33 pm #

    Rick,

    When you put these files in app/local instead of the original magento directories, do you have the create the exact file directory structure in app/local?

    I tried it and it stopped working, I tried putting the changed files in app/local with the exact structure and that doesn’t work either?

    • Rick January 16, 2013 at 9:49 pm #

      Yes, you do need to create the exact same structure. Magento will first check local and if he doesn’t find it will load the core 😉

  36. Boatmagic January 16, 2013 at 8:34 pm #

    Well ok nvm.. I was putting them in locale instead of local…lol

  37. Boatmagic January 16, 2013 at 10:25 pm #

    This doesn’t work when I put the modified files in app/local/. I’ve tried creating the exact directory structure also, and just putting the changed files there and neither seem to work

  38. Mary January 24, 2013 at 3:03 pm #

    I’m using Special promotions pro extension from amasty to set up price rules of different types easily. It a great time saver. Highly recommend http://amasty.com/special-promotions-pro.html

  39. Boatmagic January 31, 2013 at 1:55 am #

    Rick,

    I just noticed that while this code works great, it shows as example (-$3.25) on the invoice emails etc..

    It is confusing to customers seeing -$3.25 when in fact it is an addition instead.
    Any way to make it no show the “-“?

  40. Boatmagic January 31, 2013 at 3:54 pm #

    Rick,

    I read that yesterday but in version 1.7.0.2 I cannot find the file where it has that code?

    This version doesn’t have a /app/design/frontend/blank/default/template/email/order/items.phtml

    It has a /app/design/frontend/base/default/template/email/order/items.phtml and the code is not in their either

    • Rick January 31, 2013 at 4:14 pm #

      Hi,

      The path /app/design/frontend/whatever depends on the theme you’re using.

      If you’re using the default it can be something like: /app/design/frontend/base/default

      You should look for getDiscountAmount in your entire theme and then try to change the code make it look similar to:

  41. Boatmagic January 31, 2013 at 5:55 pm #

    I have looked in every file named items.phtml and that code is not in any of them.

    The original post was made using an old version of magento and a lot of the filenames and codes changed in later versions.

    • Rick January 31, 2013 at 9:22 pm #

      I does not have to necessarily be in a file called “items.phtml”, depends on your theme.

      I’m sorry I can’t be more helpful.

  42. Boatmagic January 31, 2013 at 7:18 pm #

    There is a lot more code that needs to be modified for this feature to work and display properly. I am not a coder by nature so I wouldn’t know where to start to fix all of these in 1.7.0.2. Here are the items that do not display properly.

    1. Sales Order in Admin – Items ordered will show the discount amount as -$.$$ (should not show as “-” when in fact it is an addition). It of course is reading directly from your shopping cart price rules where we put the “-” discount amount for calculations.

    a. Sales Order Totals show the discount as (whatever you changed the name to in original code), mine is set to Extra Fees. This totals block show correctly Extra Fees $.$$

    2. Sales Invoice in Admin – items invoiced show discount as -$.$$

    a. Sales Invoices – invoice totals show wrong again as Extra Fees -$.$$ (should not show a “-” here)

    It would also be safe to say that any of the transactional emails will also be wrong since they just read from Magento code.

    Customers paying attention to this would think you are trying to do something wrong since things say “discount” but are added to the costs and things show as “-discount” but really aren’t.

    Hopefully someone who codes will read this and help fix it..

    • Shathish March 11, 2013 at 11:21 am #

      Install Paypal Fee extension, which will accomplish this task…

  43. Magento Deal of the Day June 23, 2013 at 6:43 pm #

    Nice tips. I wonder can we create rules depends on group of customers? Custom price for selected groups like frequent buyers or contractors.

    • Rick June 24, 2013 at 10:34 am #

      Not sure about that. Perhaps you could create different tax groups depending on the customer group.

  44. MagePsycho January 6, 2014 at 1:28 pm #

    Another approach is to use event observer method which doesn’t not modify or extend any core code.
    The event you need to implement is: sales_quote_collect_totals_before
    And the observer model method looks like:

    REF: http://www.blog.magepsycho.com/change-shipping-price-handling-fee-fly-magento/

  45. midun July 7, 2014 at 2:43 pm #

    Am using magento 1.8.1 and am new to magento. While I am going to give condition for new rule for shopping cart price rule, if I click (+) icon that page automatically redirect into dashboard. Anyone knows how to fix this problem?

  46. Abdul Hakkim July 16, 2014 at 10:44 am #

    Hi guys.
    I need to use negative value for discount field. Hence I found this blog. I am using magento 1.8.1.0 version. My problem is that I couldn’t find

    in app/code/core/Mage/Rule/Model/Rule.php.

    What should I do?

    • Rick July 16, 2014 at 10:34 pm #

      It’s been a while since I did this.

      Have you tried looking into the hole /app/code/core/Mage/Rule folder?

      • javier September 21, 2015 at 6:40 pm #

        If yo read the code at the begining of /app/code/core/Mage/Rule/Rule.php you can read:

        The line you are looking for is in:
        /app/code/core/Mage/Rule/Abstract.php

        But anyway, i can’t do it works in 1.9…..

    • Patricio August 7, 2014 at 8:29 pm #

      Magento 1.8 in app/code/core/Mage/Rule/Model/Abstract.php. line 107

  47. Anonymous February 3, 2015 at 11:07 pm #

    Do not work on 1.6.1, anyone has a solution?

  48. swapnil June 3, 2015 at 2:30 pm #

    Hello,
    I wnat to apply negative discount value for fixed discount amount for whole cart how can I dot it

  49. Nick February 1, 2017 at 10:00 am #

    Any ideas on how to do this in Magento 2?

  50. Shahed September 22, 2017 at 6:49 pm #

    I didn’t find the code in Magento 1.9.3.2
    app/code/core/Mage/Rule/Model/Rule.php

Leave a Reply

Add <code> Some Code </code> by using this tags.