【问题标题】:Hybris where IMPEX order is defined?定义 IMPEX 订单的 Hybris?
【发布时间】:2021-07-07 08:29:14
【问题描述】:

我想知道在哪里可以看到定义的 impex 导入顺序,我发现每个扩展都有自己的 extensionNameSystemSetup.java,我可以在其中看到一些方法,例如:

@SystemSetup(type = SystemSetup.Type.PROJECT, process = SystemSetup.Process.ALL)
public void createProjectData(final SystemSetupContext context)
{
    final List<ImportData> importData = new ArrayList<ImportData>();

    final ImportData electronicsImportData = new ImportData();
    electronicsImportData.setProductCatalogName(ELECTRONICS);
    electronicsImportData.setContentCatalogNames(Arrays.asList(ELECTRONICS));
    electronicsImportData.setStoreNames(Arrays.asList(ELECTRONICS));
    importData.add(electronicsImportData);

    getCoreDataImportService().execute(this, context, importData);
    getEventService().publishEvent(new CoreDataImportedEvent(context, importData));

    getSampleDataImportService().execute(this, context, importData);
    getEventService().publishEvent(new SampleDataImportedEvent(context, importData));
}

但是,我看不到 impex 的确切顺序是在哪里定义的。 Hybris 在初始化过程中如何知道必须先导入 Products,然后才能导入产品的价格?

【问题讨论】:

    标签: hybris impex


    【解决方案1】:

    在commerceservices 扩展中有Service -->Abstract 类AbstractDataImportService。 该类再次由 SampleDataImportService 和 CoreDataImportService 服务扩展。

    SampleDataImportService 负责根据 localextension.xml 执行所选商店扩展(如电子、电动工具)的样本数据。 并在这个类中维护了执行层次结构。

    代码 sn-p 如下。

    @Override
    protected void importProductCatalog(final String extensionName, final String productCatalogName)
    {
        // Load Units
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/classifications-units.impex", extensionName,
                        productCatalogName), false);
    
        // Load Categories
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/categories.impex", extensionName,
                        productCatalogName), false);
    
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/categories-classifications.impex",
                        extensionName, productCatalogName), false);
    
        // Load Suppliers
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/suppliers.impex", extensionName,
                        productCatalogName), false);
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/suppliers-media.impex", extensionName,
                        productCatalogName), false);
    
        // Load medias for Categories as Suppliers loads some new Categories
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/categories-media.impex", extensionName,
                        productCatalogName), false);
    
        // Load Products
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products.impex", extensionName,
                        productCatalogName), false);
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-media.impex", extensionName,
                        productCatalogName), false);
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-classifications.impex", extensionName,
                        productCatalogName), false);
    
        // Load Products Relations
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-relations.impex", extensionName,
                        productCatalogName), false);
    
        // Load Products Fixes
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-fixup.impex", extensionName,
                        productCatalogName), false);
    
        // Load Prices
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-prices.impex", extensionName,
                        productCatalogName), false);
    
        // Load Stock Levels
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-stocklevels.impex", extensionName,
                        productCatalogName), false);
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-pos-stocklevels.impex", extensionName,
                        productCatalogName), false);
    
        // Load Taxes
        getSetupImpexService().importImpexFile(
                String.format("/%s/import/sampledata/productCatalogs/%sProductCatalog/products-tax.impex", extensionName,
                        productCatalogName), false);
    
        // Load Multi-Dimensial Products
        importMultiDProductCatalog(extensionName, productCatalogName);
    
    }
    

    【讨论】:

      猜你喜欢
      • 2017-05-06
      • 2021-05-25
      • 1970-01-01
      • 1970-01-01
      • 2012-09-24
      • 1970-01-01
      • 1970-01-01
      • 2015-11-03
      • 2019-09-14
      相关资源
      最近更新 更多