15

One of our clients has asked for the ability for its order entry personnel to submit orders with a negative order total. The application already allows negative line items, which works fine as long as the rest of the order makes a positive Grand Total.

It seems that Magento tries very hard to not have a negative order total. Looking at the collected totals shows that Magento will apply a gift card for the inverse amount. If I disable the gift card, then it applies Store Credit (even if credit does not exist). I suspect this is just a quirk (and possibly a red herring).

Can anyone help pinpoint where Magento forces 0 as its maximum Grand Total amount, and how we might go about fulfilling the request? I don't want to simply force-set the total, as I want Magento to calculate everything normally, just with the allowance of a negative Grand Total.

The spirit of the question is the technical feasibility, but once that is addressed, I'm interested in any 'gotchas' or thoughts that might dissuade the use of negative order totals from a non-technical standpoint.

  • 1
    Can you tell us why you want this? – benmarks Jan 14 '15 at 16:56
  • @benmarks - As I know you know, sometimes 'that's what the client wants' trumps logic and reason. They want to give their sales folks (using a custom-built order form) full freedom on order creation and prices (which already works, even for negatively-priced line items - as long as the order total is above 0. This is just taking it a step further to allow the entire order to be negative if desired). Thanks for any help you can provide! – Morgon Jan 15 '15 at 14:39
  • Can you give a real world example where this would be useful? – James Anelay - TheExtensionLab Jan 15 '15 at 20:58
  • How are you going to deal with credit memos? – Maikel Koek Jan 16 '15 at 16:13
  • @MaikelKoek - The client doesn't really do credit memos as it is, so I don't think that would have any impact. – Morgon Jan 16 '15 at 19:44
4

This seems like a very risky decision. If you implemented it you would need to override too much of the core, making the site extremely difficult to upgrade and support.

Performing a search in the Magento core for max(0 returns results in the following areas:

  • Enterprise_CustomerBalance_Model_Observer::creditmemoDataImport()
  • Enterprise_GiftCard_Model_Catalog_Product_Price_Giftcard::getFinalPrice()
  • Mage_Bundle_Model_Product_Price::getFinalPrice()
  • Mage_Catalog_Model_Product_Type_Price::getFinalPrice()
  • Mage_Catalog_Model_Product_Type_Configurable_Price::getFinalPrice()
  • Mage_Catalog_Model_Product_Type_Grouped_Price::getFinalPrice()
  • Mage_CatalogRule_Helper_Data::calcPriceRule()
  • Mage_Downloadable_Model_Product_Price::getFinalPrice()
  • Mage_SalesRule_Model_Validator::process()
  • Mage_Tax_Block_Sales_Order_Tax::_initSubtotal()
  • Mage_Tax_Model_Sales_Total_Quote_Tax (multiple uses)

And many more in templates in the adminhtml and frontend areas. You may need to rewrite many of these models to achieve the desired functionality.

You may want to consider the alternatives below:

  • Give the sales people logins to the Magento admin area and allow them to create orders from there - full control over item pricing etc
  • Use store credit if the customer should be getting credit back (I assume this is what an order with negative total would be for?)

If you provide a scenario where an order would end with a negative total, and also the reasoning behind it then the community will be able to give you a better answer. It's hard to solve a problem like this until you understand the business value behind the decision.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.