[ECOMMERCE-523] invalid (old) data in jcr breaks app in combination with ecommerceProductLinkField Created: 06/May/22 Updated: 16/Aug/22 Resolved: 28/Jun/22 |
|
| Status: | Closed |
| Project: | E-commerce |
| Component/s: | ui |
| Affects Version/s: | 1.3.3 |
| Fix Version/s: | 1.3.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Tobias Kerschbaum | Assignee: | Thuy To |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | VN-Analysis, VN-Implementation, VN-Testing | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 7d 3h 50m | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Epic Link: | AuthorX Support | ||||||||
| Sprint: | AuthX 12 | ||||||||
| Story Points: | 3 | ||||||||
| Team: | |||||||||
| Description |
| Comments |
| Comment by Thuy To [ 17/May/22 ] |
|
Hi tobias.kerschbaum , I think this is not a bug because you are using type ecommerceProductLinkField and try to put a value that its format is incorrect in JCR. From ecommerce version 1.3, we have stored the value in JCR formatted by json like {"definitionName":"commercetools","connectionName":"magnolia-services-media-demo","categoryId":"4d7a73d2-f3bd-475b-9dbe-74888a265d69","productId":"87a4d184-3635-4edc-8ba5-022e7b197b5a"} If you want to store a value in jCR like commercetools/magnolia-services-media-demo/bd43e83b-f0ca-46fd-9ebc-f5deae14b646. then you can use $type: categoryChooserField which was introduced in v1.2.
|
| Comment by Christopher Zimmermann [ 20/May/22 ] |
|
Our existing customers and partners want to migrate to the new ecommerceProductLinkField for all of the improvements that it brings. And we want them to migrate to it as well. When we change the product to use a new data format, then we should also provide a migration of the content to be compatible with the new UI.
|
| Comment by Thuy To [ 25/May/22 ] |
|
Workaround: 1/ Modify the dialog with ecommerceProductLinkField type which is introduced in v1.3 2/Modify both yaml and ftl in templates components + In the yaml file: Adding a model class like this modelClass: info.magnolia.ecommerce.app.field.ecommercechooser.EcommerceChooserBeanModel + In the ftl file: Replace: [#assign product = ecomfn.getProductById(content.product)] To: [#assign ecommerceChooserBean = model.getEcommerceChooserBean("productDetail")!] [#if ecommerceChooserBean?has_content] [#assign product = ecomfn.getProductById(ecommerceChooserBean.definitionName, ecommerceChooserBean.connectionName, ecommerceChooserBean.productId)!] [#if product?has_content] ......... [/#if] [/#if] 3/ Using another key different from the old one stored in JCR to avoid throwing exception on browser.
Development notes: We can handle to read the old structures in JCR for new product picker types to make sure the content is compatible with the new UI. In another case, maybe providing the scripts for data migration.
|
| Comment by Dominik Maslanka [ 01/Jun/22 ] |
|
Hi, I received this migration script from tobias.kerschbaum import info.magnolia.context.MgnlContext // Variables Session session = MgnlContext.getJCRSession(workspaceToCheck); processNode(rootNode); println "Save session" // Processing a node //Process the current node //Check whether it has sub nodes } "Old structure only has the product id and not the category id but the new structure needs both. So (to migrate) the only possibility was to hardcode set one product. So we still have to go through all inspirations but at least we are able to do it in the UI and not in JCR" |
| Comment by Christopher Zimmermann [ 28/Jun/22 ] |
|
thuy.to could you please describe the solution? Is it a migration... or is it some extended compatibility... or something else? ie.. what has been implemented in the scope of this ticket? |
| Comment by Thuy To [ 28/Jun/22 ] |
|
Hi czimmermann We have handled in code to read the old structures in JCR for new product picker types to make sure the content is compatible with the new UI. So we don't need to use the scripts for migration. |
| Comment by Christopher Zimmermann [ 28/Jun/22 ] |
|
Thank you. |