It would be nice if this module would support percentage discounts.

I'll upload a patch here.

Cheers !

Comments

scott m. sanders’s picture

It does already. Example:
- Operation: Multiply
- Value: -.05 (5%)

andreiashu’s picture

Status: Active » Fixed

I was coming back just to report the same thing :)
Thanks Scott.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

joachim’s picture

Status: Closed (fixed) » Active

It does, but the wording of the UI is very unclear:

"The value to be added to or multiplied. Remember to use negative numbers to lower the order total."

Surely the "value to be added to or multiplied" is the actual product price?
And the value and operation we specify here alters it?

So if I say: add, and -20, then the action is:
New price = old price - 20

And if I say: multiple, and 0.8, then the action is:
New price = old price * 0.8 // which is a 20% discount

If my understanding as outlined above is correct, then the text should read something like:

"The value to be add or multiply by. Remember to use negative numbers to lower the order total by a fixed amount, and a number less than one to apply a percentage discount."

joachim’s picture

Category: feature » bug
Status: Active » Needs review
StatusFileSize
new848 bytes
joachim’s picture

Status: Needs review » Needs work

To get a 20% discount you need to do: multiply by -0.2

which just goes to show that documentation for these things is essential, as I got it totally wrong in my patch ;)

babbage’s picture

What's more, that's complete rubbish... mathematically, multiplying by -0.2 would result in the store owner paying the buyer 20% of the original list price. If Ubercart is going to use words like "multiply" which have a widely used mathematical meaning, then it needs to use them correctly!

joachim’s picture

Priority: Normal » Critical

What it actually means is:

- Add: a fixed amount to add to the price. So you put in -20 to give a discount of £20.
- Multiply: calculate the amount to add to the price, relative to the price. So you enter -0.2, that multiplies price £P by -0.2, which gets you -0.2P, and that is then added to P. So the result is 0.8 of the original price.

It's a rather convoluted way of describing how to apply a discount; most people would either want to say 0.2 (to mean knock off 20%) or 0.8 (the new price is 0.8 of the original).

This needs better labelling right now, as it's unusable without it -- hence bumping this up to critical.

In the longer term, the logic should be rewritten so the UI works the way humans think ;)

jazzitup’s picture

Wouldn't it be better to improve the input format to:

-20% (same as current multiply: -0.2)
-10,5% (same as -10.5%, same as current multiply: -0.105)

It would be better to replace commas automatically, so users could use only their numeric keypads during input.

By using this method you could remove those ugly "Add" and "Multiply" radio buttons. Another discount module has implemented the same feature and I find it much more intuitive and user friendly. The character "%" would define current "multiply" logic.

joachim’s picture

Yup, that would make a lot more sense!

joachim’s picture

Title: Support percent discounts » improve UI for percent discounts

Better title.