Developer forum
E-mail notifications
Negative productprices when using discount
To illustrate this problem we created an similar situation in an test environment with an new and empty dynamicweb solution. We also created a few products here and put a discount on them. The discount is 15 crowns. As visible on this webpage you'll see that some products will keep an positive price (because the original price is higher then 15 crowns) and products with a price lower then 15 crowns are suddenly getting an negative price. Is this a bug? Or is there anything else we can do to resolve this issue?
Replies
No - not a bug, but not desired behavior in this case - I can see that. Some use discounts to add "negative" prices on the orders, so we cannot change the behavior.
All our included discounts are discount providers, and you can easily make your own version of them. You can download our source code from http://developer.dynamicweb-cms.com/downloads/source-code.aspx and change behavior to never return a price lower than 0. Compile them and upload to solution and you can start creating discounts based on your own version.
This would work for now. But is it an idea to create an option somewhere in DW to enable/disable the usage of negatieve prices?
Here in Holland there isn't a single shop (as far as I know) where negative prices are possible. We intend to keep the custom code to a minimum, so this feature would help us very much.
What is the status of this request? Can you give me any information if and when this option will be added? It seems we're running into problems with negative orders prices more and more..
Kind regards,
Rob
It is in the backlog for DW8, but not planned yet.
I cannot promise it at a specific time right now. It has backlog number TFS7147.
Hi Nicolai,
I supose that the solution for this request is the configuration option 'Allow negative total order price' already added in the new solutions.
If I don't allow negative values the cart tags for total prices should be zero even if the total order price calculations are negative.
Following this we found a related problem on cart templates if the total order price calculations are negative. It seems that the output price tags on templates are always returned with negative values however the order price on Database is correctly with zero.
The prices should be returned zero in case of negative calculation when we don't have the 'Allow negative total order price' checked.
We dont't want to have extra logic in frontend templates once it depends on configuration option.
Dynamicweb bug?
var order = Dynamicweb.eCommerce.Orders.Order.GetOrderByID(str_cartId);
string orderAPIPrice = order.PriceBeforeFees.Price.ToString(); // return negative prices
string orderPrice = GetString("Ecom:Order.PriceWithoutFees.PriceWithoutVATFormatted"); // return negative prices
Best Regards,
Pedro Alfaiate
Hi Pedro
This is by design. The calculation has to match up, otherwise bad things will happen. 10-20 = -10 it cannot be 0. There are a number of checks that would fail if this was set to 0 and some integrations also expects the proper calculation. We could set the template tags to 0 but some customers, other than yours, need to be able to display the right calculation in the frontend, eventhough they process the payment as 0. So a simple conditional in your order template should be easy stuff and the only solution.
BR Nicolai
Hi Nicolai.
Did you implement TFS7147 ?
Hi Mikkel
Yes, in 8.4. Default behavior is that an order total cannot be < 0 - if you want it to be, you can enable negative order prices in MC, See dump.
BR Nicolai
Hi Nicolai.
Then i think there is a bug. Because i can get a negaive price. I have 1 standard discount provioder and one custom - the custom one makes the price go below 0.
This is related to http://developer.dynamicweb.com/forum/development/discount-providers.aspx?PID=48 - Because i can't get the final price with other discount's included i will in some situations give more discount than the order price is and this makes the order negative.
The check is made when the order is saved. So you might see a negative prive when you are still in your discount, but you cannot go throgh checkout with a negative price.
NP
You must be logged in to post in the forum