hybris使用impEx导入产品主数据的示例脚本

发布时间:2025-12-09 16:49:13 浏览次数:3

SAP官网链接:https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1905/en-US/8bdf595b86691014b902e0974f71491a.html

菜单路径:

Platform,Services,and Utilities->Commerce Platform Module->Commerce Platform Module Features->ImpEx->Working with ImpEx->Importing Products and Orders:


完整代码如下:

## Macro definitions (1)#$catalogVersion=catalogVersion(catalog(id[default='clothescatalog']), version[default='Staged'])[unique=true,default='clothescatalog:Staged']$prices=europe1Prices[translator=de.hybris.platform.europe1.jalo.impex.Europe1PricesTranslator]$baseProduct=baseProduct(code, catalogVersion(catalog(id[default='clothescatalog']), version[default='Staged']));;;;;;;;## Create a category (2)#INSERT_UPDATE Category;code[unique=true];$catalogVersion;name[lang=de];name[lang=en];description[lang=de];description[lang=en];;SampleCategory;clothescatalog:Online;Testkategorie;Sample category;Dies ist eine Testkategorie;This is a sample category;## Create some products (3)#INSERT_UPDATE Product;code[unique=true];name[lang=en]; name[lang=de];unit(code);$catalogVersion; description[lang=en]; description[lang=de]; approvalStatus(code);supercategories(code);sampleproduct1;SampleProduct1;Testprodukt1;pieces;clothescatalog:Online;"This is a sample product";"Dies ist ein Testprodukt";approved;SampleCategory;sampleproduct2;SampleProduct2;Testprodukt2;pieces;clothescatalog:Online;"This is another sample product";"Dies ist ein weiteres Testprodukt";approved;SampleCategory;sampleproduct3;SampleProduct3;Testprodukt3;pieces;clothescatalog:Online;"This is the third sample product";"Dies ist das dritte Testprodukt";approved;SampleCategory## Some pricerows for our products (4)#INSERT_UPDATE Product;code[unique=true];$catalogVersion;$prices;Europe1PriceFactory_PTG(code); ;sampleproduct1;clothescatalog:Online;"1 pieces = 12,00 EUR, 20 pieces = 10,00 EUR";Tax_Full;;sampleproduct2;clothescatalog:Online;"1 pieces = 11,50 EUR, 30 pieces = 0,99 EUR";Tax_Half;;sampleproduct3;clothescatalog:Online;"1 pieces = 651,89 EUR, 10 pieces = 599,99 EUR";Tax_Full;## Some variants of sampleproduct1 including Prices (5)#INSERT_UPDATE Product;code[unique=true]; $baseProduct;$catalogVersion; approvalStatus(code); Europe1PriceFactory_PTG(code); $prices;unit(code[default=pieces]);;sampleproduct1-00;sampleproduct1;clothescatalog:Online;approved;Tax_Full;11,50 EUR N; pieces;;sampleproduct1-01;sampleproduct1;clothescatalog:Online;approved;Tax_Full;11,00 EUR N; pieces;## Defining an Order (6)#INSERT_UPDATE Order;code[unique=true];user(uid);date[dateformat=dd.MM.yyyy HH:mm];currency(isocode);net;deliveryMode(code);paymentMode(code);Discounts(code);calculated;SampleOrder1;demo;17.01.2006 10:58;EUR;false;;advance;;false#% impex.getLastImportedItem().setDeliveryAddress(impex.getLastImportedItem().getUser().getDefaultDeliveryAddress());#% impex.getLastImportedItem().setPaymentAddress(impex.getLastImportedItem().getUser().getDefaultPaymentAddress());## Setting OrderEntries on the Order (7)#INSERT_UPDATE OrderEntry;order(code)[unique=true];product(code,catalogVersion(catalog(id),version))[unique=true];quantity;calculated;unit(code);entryNumber;;;;SampleOrder1;sampleproduct1:clothescatalog:Online;1;false;pieces;0;;;;SampleOrder1;sampleproduct2:clothescatalog:Online;2;false;pieces;1;;;;SampleOrder1;sampleproduct3:clothescatalog:Online;3;false;pieces;2;;;## Calculating the Order (8)#UPDATE Order;code[unique=true];SampleOrder1#% impex.getLastImportedItem().recalculate();```要获取更多Jerry的原创文章,请关注公众号"汪子熙":![公众号截图](https://www.gzzwz.com.cn/uploads/202512/09/4b725404b4bbe1c3.webp)
需要做网站?需要网络推广?欢迎咨询客户经理 13272073477