on 2018 May 14 9:47 AM
Hi ,
I implemented PriceRow excel import functionality using excelImport action, wrote custom translators and validators, however when I wanted to import "productId" or "Product" for PriceRow, these attributes aren't supported as they are having write="false"
In OOTB excel import/export classes isSupported() Method they are checking the attributeDescriptorModel.getWritable() for which "productId" & "product" will always return false.
How to import/export these through excel ?
Also when I tried exporting PriceRow the columns in the exported excel are mismatching.
for e.g in Customer column I'm getting prices and vice versa.
Thanks.
Request clarification before answering.
Hi,
Which class has isSupported() method? You can always try to override this method and change the condition.
Regards,
Lukasz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for immediate response.
ExcelExportRenderer.Because of that I guess in the export wizard I'm not able to see productId attribute.
Also productId is of type String , so OOTB ExcelJavaTypeTranslator should handle this, But for this attribute since write=false. I guess its not handling.Is my understanding correct?
Hi,
Not able to see productId row. Attaching the sheet for reference.
But from your comment, I manually added the productId row in the template and then I'm able to import excel.
Cheers.
Thanks.
In excel you don't have control over cell value, so you cannot prohibit user to change values which are not writable. So I suppose that was the reason. Nevertheless it seems that this restriction can cause some problems, so I'll check whether it will be possible to change it in OOTB implementation.
Regards,
Lukasz
Hi,
Overrided the OOTB class isSupported() Method for Pricerow type & now it exports that specific column.
However if we unhide the typesystem sheet "productId " isn't populated. If I generate & download excel template , typssystem sheet doesnt contain "productId"
I guess in class DefaultExcelTemplateService populateTypeSystemSheet() method ,in this method too same condition is checked.
Thanks.
You're absolutely right. DefaultExcelTemplateService has protected populateTypeSystemSheet method with the following condition: .filter(attribute -> BooleanUtils.isTrue(attribute.getReadable()) && BooleanUtils.isTrue(attribute.getWritable())) You need to change the condition in this place as well.
Regards,
Lukasz
Hi Lukasz,
As the itemtype is PriceRow, I need a combination of productId & price to be unique.
So I overwritten the OOTB JavaTypeTranslator class importValue() method to return unique=true for productId & price attributes.
for productId in impex header unique=true is appended, but for price it isn't appended because in OOTB DefaultImpexConverter , prepareHeaderAttribute() method they are checking this condition
!PriceRowModel.PRICE.equalsIgnoreCase(headerAttribute.getName() because of which price is not unique.
so productId is only unique and I Cant upload multiple rows with same id
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.