1

Looking into my Magento database inside the sales_flat_order table, I find - since the day I updated from the 1.4 to the 1.5 version - the values of discount_amount being negative (e.g. -5 EUR for a 5 EUR coupon code).

Before that date (in the database), all the discount_amount values are positive (e.g. 5 EUR for a 5 EUR coupon code).

Now I'm puzzled. Does Magento by standard store positive or negative values into the sales_flat_order table?

I assume that there should be a positive number in that field and the negative number has been introduced in error. However gaining some clarification through feedback by others would be great.

Additional notes:

  • The database design itself allows to store both negative and positive values in that column.
  • In the admin, orders with both a positive or negative discount_amount (and base_discount_amount) do behave exactly the same with the only difference having the number displayed as negative or positive. But negative numbers magically get multiplied by -1 in the calculation.

1 Answer 1

2

The discount amounts on the complete order are stored with negative amounts, but are stored positively against each item that they effect.

  • Negative sales_flat_order
  • Positive sales_flat_order_item

The negative values is stored against the table sales_flat_quote_address and then copied across to the table sales_flat_order

1
  • Thanks a lot for the info, this really gives me a better understanding!
    – hakre
    Apr 30, 2014 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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