Prestashop: When I add an existing product in the order's BO

Created on 1 Jul 2020  路  10Comments  路  Source: PrestaShop/PrestaShop

Wanted behaviors

1) When I add a product already present in the order from the back office, the addition is blocked by displaying the following error message (EM): "Your product is already present in your order.".

If Product A at 10 euro
And I add product A again
Then blocks the addition and displays the error message

2) When the order has several invoices, it is possible to add an already existing product in the order if they are related to a different invoice.
There is only one possible price per product even if they are from different invoices. Therefore, if a product is added with a different price in another invoice, the price will be updated on the first invoice. To avoid confusion, a pop-up window will be displayed before the addition to confirm that the action may have an impact on the other order.

If Product A at 10 euro in invoice 1
And I add product A in a second invoice with the specific price of 5 euro in the invoice 2
Then Product A of invoice 1 will be at 5 euro after validation of the popup.

If Product A at 10 euro in invoice 1 and 2
And I edit the product A in the invoice with the specific of 5 euro in the invoice 1
Then Product A of the invoice 2 will be at 5 euro after validation of the popup

If Product A at 10 euro in invoice 1 and 2
And I edit the product A with the specific of 5 euro in the invoice 2
Then Product A of invoice 1 will be at 5 euro after validation of the popup

If Product A at 10 euro in invoice 1
And I add Product A in the invoice 1
Then the addition is blocked by displaying the corresponding error message (EM) describe in the first case above.

Wording

First error message:

  • one when the user add when there is no invoice: _This product is already in your order, please edit the quantity instead._
  • one when the user add when there are some invoices: _This product is already in this invoice #number, please edit the quantity instead._

Second modal message:
title = _Edit the price_ in _Admin.Actions_
confirm_message = _Are you sure you want to edit this product price? It will be applied to all invoices of this order._ in _Admin.Orderscustomers.Notification_
confirm_button_label = _Continue_ in _Admin.Actions_
close_button_label = _Cancel_ in _Admin.Actions_

Bug Fixed Minor Order Wording 鉁旓笍

Most helpful comment

Hit @MatShir,

yes it's doable. It will be more understandable.

All 10 comments

Thanks for opening this issue! We will help you to keep its state consistent

Suggestion for the forbidden wording Something like "Your product is already present in your order/invoice. You can edit its quantity directly." so the user knows he should edit the existing product

@jolelievre Why should he? Couldn't it just add 1 piece and be quiet? 馃槑

It's not that simple, the problem is we face numerous problems related to this feature: "I add 2, 3, 60 times the same product in my order and I set whatever price I want on each one, and I expect everything to work without issue because it's an easy task anyway" But it's not easy actually 馃槄

The main issue is not necessarily to have several times the same product but to allow multiple prices in an order, it brings several issues:

  • the cart associated to the order can only have one relation to a product via product_cart table so it breaks the synchronization between the cart and the order (order has multiple OrderDetails for same product, cart only has one relation) Even though the total quantity of OrderDetail is equal to the cart quantity the problem is that each OrderDetail can have a different price
  • the cart rules are based on the cart products so messing with the sync between cart and order causes calculation bugs, because it expects a product to have ONE price, not multiple ones
  • you can define some different prices for a product this is based on a SpecificPrice linked to the product/combination and the cart, but you can have only ONE instance of said specific price per product

For all these reasons we decided to FORCE a unique price per product on an order. Once this decision was set the simpler way to do this is to prevent adding several times the same product, if you need more of this product you can just edit its quantity, then you can edit its price without problem since there's only one. This simplifies the UX and order details.

BUT this was without considering the multi-invoice feature in the order, I'm not sure exactly what is the purpose of this feature because I would think one order has only one invoice. But a merchant can have an order which already has a generated invoice and he wants to add a product that was missing, thus this additional product should be associated to a different invoice and you decide to create a new one when you add the new product.

So in the case of multi invoice we authorize to add the product in the new invoice even though it was already present in the previous one. But we don't allow to change its price for the reasons already mentioned earlier. That said the merchant can still need to change the product price for whatever reason but in that case the price will be updated in all products to keep the consistency. The modification is authorized but can be risky if you're not aware of its implication so we display a popin to warn the merchant that this will change the product price in the whole order.

That's the long explanation of why we ended up with this new feature, I hope it clarifies the problem a bit better @Hlavtox 馃槈

First error message:
_This product is already in your order, please edit the quantity instead._

Second modal message:
title = _Edit the price_ in _Admin.Actions_
confirm_message = _Are you sure you want to edit this product price? It will be applied to all invoices of this order._ in _Admin.Orderscustomers.Notification_
confirm_button_label = _Continue_ in _Admin.Actions_
close_button_label = _Cancel_ in _Admin.Actions_

@LouiseBonnard @MatShir

@jolelievre Understood, very tricky situation indeed.

I am not using Prestashop's invoicing system, but it happens very often, that multiple invoices are set to one order. For example, when customer orders something and part of stuff is in stock, the rest on order and he wants the first part now, until the rest arrives. Or when it's already invoiced and you can no longer change it.

For the first error message @jolelievre do you think we could have 2 errors:

  • one when the user add when there is no invoice (_This product is already in your order, please edit the quantity instead._)
  • one when the user add when there are some invoices (_This product is already in the invoice #number, please edit the quantity instead._)
    @Junebyun @jolelievre WDYT?

Hit @MatShir,

yes it's doable. It will be more understandable.

For the first error message @jolelievre do you think we could have 2 errors:

  • one when the user add when there is no invoice (_This product is already in your order, please edit the quantity instead._)
  • one when the user add when there are some invoices (_This product is already in the invoice #number, please edit the quantity instead._)
    @Junebyun @jolelievre WDYT?

Yes, sounds more accurate!

I removed this issue of the kanban to keep only the EPIC: https://github.com/PrestaShop/PrestaShop/issues/20161 as the same PR fixes all the issues, this way we keep a better readability of the kanban

Was this page helpful?
0 / 5 - 0 ratings