Prestashop: [1.7.7 beta 2] Order view - Product ID is invalid error message

Created on 2 Sep 2020  ·  12Comments  ·  Source: PrestaShop/PrestaShop

Steps to Reproduce

Steps to reproduce the behavior:

  1. Install 1.7.7 beta 2.
  2. Delete all products.
  3. Go edit KHWLILZLL.
  4. Change price of the product.
  5. Price will change, but error message will be displayed that the product ID is invalid.

Additional information

  • PrestaShop version: 1.7.7 beta 2
  • PHP version: 7.2
1.7.7.0 BO Bug Fixed Nice to have Order PR available Trivial

Most helpful comment

I'm not 100% sure about allowing the modification for several reasons:

  • there is no more way to check the stock for this product since it's not in the catalog any more, so changing the quantity would become quite unreliable
  • changing the price in OrderDetail should be possible, but we need to check what influence it can have on cart computation for totals (which is used to update the order)
  • this also raises questions regarding the potential CartRules that might linked to this product, do they still apply? have they been removed? should they be ignored?

All these questions are only the beginning, but each one will imply complexifying the code a lot for an edge case. I'd say it would be more efficient to prevent the merchant to remove a product that has been assigned to an Order, and use soft delete instead (not sure it exists on product for now). Rather than fixing the problems at the end of the tunnel it might be better to fix it at the beginning.

All 12 comments

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

In 1.7.6.7 this error was already display but differently
Capture d’écran 2020-09-02 à 13 18 59

In 1.7.7.0 beta
Capture d’écran 2020-09-02 à 13 19 15

@PrestaShop/prestashop-product-team could you check this error ? maybe we can change the wording to be clearer ?

@sarahdib What does that error even mean for the merchant, when he cannot do anything about it? :-)

And, I think we should display: "This product no longer exists in catalog" under it's name in the list. What do you think?

@Hlavtox I agree, the wording is not clear for the merchant. I ask the product team to check the wording ;)

You're right, there is a confusion here between the action and the notification displayed as a consequence. If I understand well, the user can edit the price of a recently deleted product inside the order page but there is an unrelated/unclear error displayed.

@marionf, @MatShir, this behavior does not look specified here. Do we wish to let the user modify the price of a product when this item has been deleted? If yes, there should not be any error notification. If no, the user should not be able to perform this action and the error message should explain why.

Your wording looks okay to me, @Hlavtox. I would suggest _You cannot edit the price of a product that no longer exists in your catalog._ localized in Admin.Notifications.Error.

@LouiseBonnard @MatShir

Personally, I would keep the functionality. All the data is in _order_detail_ table. There is no problem for merchant to change price or quantity of the product. We also know the tax group from DB.

If I'm not mistaken, the price is related to the cart / order ? @jolelievre
A merchant might want to change it for a particular order even though the product has been deleted of the catalog
So, yes there shouldn't be any error notification here

I'm not 100% sure about allowing the modification for several reasons:

  • there is no more way to check the stock for this product since it's not in the catalog any more, so changing the quantity would become quite unreliable
  • changing the price in OrderDetail should be possible, but we need to check what influence it can have on cart computation for totals (which is used to update the order)
  • this also raises questions regarding the potential CartRules that might linked to this product, do they still apply? have they been removed? should they be ignored?

All these questions are only the beginning, but each one will imply complexifying the code a lot for an edge case. I'd say it would be more efficient to prevent the merchant to remove a product that has been assigned to an Order, and use soft delete instead (not sure it exists on product for now). Rather than fixing the problems at the end of the tunnel it might be better to fix it at the beginning.

Hi everyone,

I raise this topic again to decide what we can do for this issue. I think introducing the deleted field on Product would be the best solution. So product would be soft deleted when they are associated to an order (maybe a cart as well).

However this implies quite some changes in various part of the code, especially on the FO where deleted products will have to be filtered. This is not a trivial change and doing it in 177 seems a bit risky. Especially since the bug already existed in previous versions so it's not a regression.

So I would suggest fixing this issue in two steps:

  • in 177 we only improve the wording as suggested by @Hlavtox so an error message will raise with You cannot edit the price of a product that no longer exists in your catalog. localized in Admin.Notifications.Error
  • in 178 we introduce the soft delete on product, an product is hard deleted only when it is associated to nothing, and automatically soft deleted when it is associated to a cart/order

What do you guys think?

It suits me fine, thanks @jolelievre! I've just updated your comment with a wording that better matches the software's terminology and with the proper domain.

@LouiseBonnard @jolelievre @eternoendless

Guys, what about taking it from the other end?

I wanted to introduce you an idea, when merchant can add a non existent product to an order. He woud click “add custom item”, enter name, price, tax, quantity, done. Without having to creating this product in catalog section. This is for custom scenarios when customer wants some spare parts or product out of your digital offers, something that does not sell so often.

Would it be possible to just handle the scenario when the product no longer exists?

  • Quantity would not matter, it would not pop anywhere in statistics.
  • Price can be changed, we know original tax.
  • When touching order with nonexistent products, we could delete all discounts from it and tell merchant - set manual discount.

I prefer @jolelievre 's idea since we already have a generic soft delete mechanism on prestashop model objects, let's be consistent, your scenario is interesting but complexifies the code imho :/

Was this page helpful?
0 / 5 - 0 ratings