on 11-26-2020 10:09 AM
Hi All,
Is it possible to do type casting when exporting through impex export?
for example I have CustomProductModel that extends OOTB ProductModel, in that CustomProductModel I have myAttribute field.
From it's variantProductModel, can I get myAttribute field? If I want to get CustomProductModel's code from variantProductModel we could write an impex like this since code is also part of OOTB ProductModel :
INSERT_UPDATE variantProduct;code[unique=true];baseProduct(code);
writing
INSERT_UPDATE variantProduct;code[unique=true];baseProduct(myAttribute)
won't work because baseProduct of variantProductModel is registered as OOTB ProductModel, which doesn't have myAttribute field.
In java we could get myAttribute by casting baseProduct to CustomProductModel :
String myAttribute = ((CustomProductModel) variantProductModel.getBaseProduct()).getMyAttribute();
So, is it possible to cast type of baseProduct in impex so it could read myAttribute?
So actually this is possible, all you have to do is write down the model name first before the attribute name :
INSERT_UPDATE variantProduct;code[unique=true];baseProduct(CustomProduct.myAttribute)
If myAttribute is a model, and I want to get its code, then I can write it like this :
INSERT_UPDATE variantProduct;code[unique=true];baseProduct(CustomProduct.myAttribute(code))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
3 | |
1 | |
1 | |
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.