Part of Symfony migration project
Type: page
Functional specs of the page : https://github.com/PrestaShop/prestashop-specs/blob/master/back-office/catalog/catalog-price-rules.md
Todo:
@AdminSecurity annotations when eligible and @DemoRestricted annotations when eligible_legacy_link and _legacy_parameters provided and explained[ ] JS being used on the page can be used as enabled extensions and use a PageMap for selectors
[ ] The new controller actions comply with our naming convention
[ ] All Handlers must have an Interface
[ ] The created SF service names comply with our naming convention
*Eligible = easy to isolate and unit tests provide values (for example testing getters/setters is useless)
Don't forget to hide the "Recommended Modules" button
Hello @matks , it seems that this issue has been done, can we close it ?
@zuk3975 Can you check https://github.com/PrestaShop/PrestaShop/pull/13716 and confirm only condition group is missing for this page ?
@zuk3975 Can you check #13716 and confirm only condition group is missing for this page ?
Create/edit form is migrated and working as expected.
Condition group settings are missing.
OK, I have a tough question for you guys 馃槵 @PrestaShop/prestashop-product-team
_So if you did not notice, the "condition groups" and "conditions" list below is not a real list._
If you add items in the list, they are not saved until you hit the "save" button.
You can delete any item, but cannot edit items.
You can delete items, but they are not really deleted until you hit the "save" button. If you refresh before hitting the save button, you lose your changes.
This "only save on submit" behavior, implemented in legacy page, make things a lot harder to do (and migrate) 馃槄
So I was considering ... shall we change this ? I'm asking if I can make "condition groups" and "conditions" lists below a real list.
By "real list" I mean:
So the 2 parts of this page (the "catalog price rule" form above and the "conditions" below) would be 100% separated.
The only downside of this change is that you cannot add conditions when you are creating a new catalog price rule. You must hit the SAVE button once, then you are moved into "edition" mode ; and in this mode you can start adding conditions.
This "real list" behavior is a lot easier to implement because, instead of "trying to remember all the changes user did until finally the SAVE button is hit so I can save them" logic, you have 3 small logics:
However please note that, from a data point of view, a HTML point of view and a technical behavior point of view, this would be a Breaking Change
Before, although overly complex and quite hard to decypher, everything in the page was a big form and every piece of logic related to "saving data into database" was happening on the "submit" button. So if a module wanted to customize this logic it had only 1 logic to modify.
If we do this change, the catalog price rule (the form above) will be one piece of logic, the conditions list will be another. Module wishing to modify the whole logic will have to modify multiple parts of the code instead of a single one. However (I hope) these multiple parts will be small and understandable parts (while, today, it's one big piece of code that I needed 24 hours to finally understand)
I won't talk for the tech part, but for the interface and functional part, the legacy page is really not satisfying as it is currently. So I'm clearly in favor of introducing a breaking change if he can improve the global UX on this page.
My only worry is about the first save needed after completing the generic catalog price rule form. We need to make it quite clear that it's not a definitive save, that the merchant will have another action to perform afterwards to finish the configuration of his rule.
What happens if he stops configuring it after the first save ? It means that the rule will be applied on the whole catalog and not on specific groups of products ? It might be a bit dangerous.
What happens if he stops configuring it after the first save ? It means that the rule will be applied on the whole catalog and not on specific groups of products ? It might be a bit dangerous.
You are right, this is the pain point.
It's exactly the same issue with Product page and combinations. In current Product page, it was tried to avoid this by creating "ghost products" (so you can start adding combinations without hitting "save") but it created the "ghosts products" issue.
I can keep the current behavior which avoids this problem. On technical side, it's more complicated but not much. The real tech issue is that the logic used to implement this behavior is very unusual so it's hard to understand, both for us and module developers, and it's very hard to customize (for module developers). So writing the code is fine, making it easy to understand, use and maintain is the pain point.
ping @matks let me know when you are available to discuss about it ;)
Most helpful comment
I can keep the current behavior which avoids this problem. On technical side, it's more complicated but not much. The real tech issue is that the logic used to implement this behavior is very unusual so it's hard to understand, both for us and module developers, and it's very hard to customize (for module developers). So writing the code is fine, making it easy to understand, use and maintain is the pain point.