on 09-16-2021 4:50 AM
I want to import a CSV via the cloud hot folder.
There are few values that are coming in CSV which we have in the Impex header but are not present in the model. Based on that header values we need to do some calculations and save it to an attribute.
For example -
StockLevel -> available = stockA + StockB - ( Stock x + Stock Y + Stock z)
another requirement/example:
product:- code;Mcode;Scode;Fcode;ProductType -> We need to save 1 of the code based on product type and ignore all other codes
You can use Translators to achieve what you need. (Reference: https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/2105/en-US/4ce7b82cbc574456ac197393f88e...
You can combine the values with a separator (e.g. #) then in translator split them with the separator and use according to your needs. SpecialValueTranslator interface may suit more to your need.
I found an example in OOTB code for stock. The class de.hybris.platform.acceleratorservices.dataimport.batch.stock.StockTranslator implements SpecialValueTranslator and uses ":" as separator. First part is available amount and the second part is for warehouse. In ImpEx header it's used as the following (in the file /bin/modules/core-accelerator/acceleratorservices/resources/acceleratorservices/integration/hot-folder-spring.xml😞
UPDATE Product;code[unique=true];@stock[translator=de.hybris.platform.acceleratorservices.dataimport.batch.stock.StockTranslator,adapter=stockImportAdapter];$catalogVersion
As you can see, stock is not a direct attribute of product. But with the help of translator, you can update StockLevel for the product also. You can get more insight by investigating the StockTranslator and other OOTB translators.
Hope this helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
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.