为后台定义自定义应用程序类型

Define custom application type for backoffice

我们正在尝试在最新的 Intershop 7.9 上为 Backoffice 设置自定义应用程序类型,但是当我们尝试 运行 DBIinit 时,我们收到以下错误:

[xx.xxx.webshop.dbinit.data.organization.Channel,xx.xxx.webshop.dbinit.data.organization.ChannelLocalization,ProcessChannel-DBInit] Version:null] com.intershop.beehive.core.pipelet.pipeline.ExecutePipeline [] [Unknown] [scHAqDIFBIAAAAFjuxgo2CwQ] [RbPAqDIFZAUAAAFjuxgo2CwQ] "main" ISH-CORE-2490: Synchronous called pipeline 'CreateSalesChannel-CreateChannelObjects' of application 'CustomShop@Custom-Site (app=xx.CustomBackoffice)' has finished with exception:  com.intershop.beehive.core.internal.pipeline.PipelineCallStackException: com.intershop.beehive.core.capi.pipeline.PipelineExecutionException: Required input parameter 'AppID' missing of pipeline 'ProcessApplication defined in cartridge sld_ch_base' and start node 'Create'!

调用通道准备程序时出现错误。 这是来自 apps.component 文件的相关代码,用于创建后台应用程序类型:

    <instance name="xx.CustomBackoffice.ApplicationTypes" with="AppRegistry"/>

<!-- register the custom B2CBackoffice to the Enterprise Backoffice of your choose -->
<fulfill of="intershop.EnterpriseBackoffice" requirement="namedObject">
    <instance with="NamedObject">
        <fulfill value="ChannelBackofficeApplicationType_52" requirement="name"/>
        <fulfill with="xx.CustomBackoffice" requirement="object"/>
    </instance>
</fulfill>

<!--  declaration of the cartridge list -->
<instance with="CartridgeListProvider" name="xx.CustomBackoffice.Cartridges">

    <!-- Derive from standard webshop if you want to use the same cartridges like standard webshop -->
    <fulfill requirement="parent" with="intershop.B2CBackoffice.Cartridges" />
</instance>

<!--  definition of the application type  -->
<instance with="ApplicationType" name="xx.CustomBackoffice">
    <fulfill requirement="id" value="xx.CustomBackoffice" />
    <fulfill requirement="urlIdentifier" value="a1-shop-bo" />
    <fulfill requirement="cartridgeListProvider" with="xx.CustomBackoffice.Cartridges" />
    <fulfill requirement="namedObject">
        <instance with="NamedObject">
            <fulfill requirement="name" value="ChannelApps_52" />
            <!-- register the AppRegistry containing all storefront applications of this channel -->
            <fulfill requirement="object" with="xx.CustomBackoffice.ApplicationTypes" />
        </instance>
    </fulfill>
    <!-- put additional NamedObjects, that are required by the particular business features -->
    <!-- ... -->
</instance>

<!--  registration of the application type to the AppEngine -->
<fulfill of="AppEngine" with="xx.CustomBackoffice" requirement="app"/>

<fulfill requirement="namedObject" of="xx.CustomBackoffice" with="intershop.EnterpriseBackoffice.RESTAPI"/>

一旦我删除了自定义后台应用程序类型的定义,dbinit 运行s 成功并且创建了前台应用程序类型而没有错误。

任何人都可以看到错误在哪里或者为后台定义自定义应用程序类型的正确方法是什么?

我找到了这个问题,在 apps.component 中定义了 2 个自定义应用程序类型,尤其是这一部分:

<!-- register the custom B2CBackoffice to the Enterprise Backoffice of your choose -->
<fulfill of="intershop.EnterpriseBackoffice" requirement="namedObject">
    <instance with="NamedObject">
        <fulfill value="ChannelBackofficeApplicationType_52" requirement="name"/>
        <fulfill with="xx.CustomBackoffice" requirement="object"/>
    </instance>
</fulfill>

如果我添加第二个 BO 应用程序类型并尝试使用与上面相同的代码向 intershop.EnterpriseBackoffice 注册它(只需将 xx.CustomBackoffice 更改为 xx2.CustomBackoffice):

<!-- register the custom B2CBackoffice to the Enterprise Backoffice of your choose -->
<fulfill of="intershop.EnterpriseBackoffice" requirement="namedObject">
    <instance with="NamedObject">
        <fulfill value="ChannelBackofficeApplicationType_52" requirement="name"/>
        <fulfill with="xx2.CustomBackoffice" requirement="object"/>
    </instance>
</fulfill>

上面显示的错误是 运行ning DBinit 给出的。因此,如果有人知道如何为后台定义和注册 2 个自定义应用程序类型(xx.CustomBackoffice 和 xx2.CustomBackoffice)?

据我所知,有一个 cartridgeListProvider 参考:

<fulfill requirement="cartridgeListProvider" with="a1.ShopBackoffice.Cartridges" />

指向 a1.ShopBackoffice.Cartridges 但我无法在您的代码片段中找到匹配的实例化名称。相反,我只看到 xx.CustomBackoffice.Cartridges.

此处的示例应该有效:

<!-- ************************************************************************************ -->
<!-- *           Application Type "custom.B2BBackoffice"                      * -->
<!-- ************************************************************************************ -->
<instance name="custom.B2BBackoffice.ApplicationTypes" with="AppRegistry"/>


<fulfill of="intershop.EnterpriseBackoffice" requirement="namedObject">
    <instance with="NamedObject">
        <fulfill value="customChannelBackofficeApplicationType_52" requirement="name"/>
        <fulfill with="custom.B2BBackoffice" requirement="object"/>
    </instance>
</fulfill>

<instance with="CartridgeListProvider" name="custom.B2BBackoffice.Cartridges">
    <fulfill value="ish_app_bo_common" requirement="selectedCartridge"/>
    <fulfill value="ish_app_bo_stock" requirement="selectedCartridge"/>
    <fulfill value="ish_app_bo_user" requirement="selectedCartridge"/>
    <fulfill value="sld_ch_consumer_plugin" requirement="selectedCartridge"/>
    <fulfill with="intershop.EnterpriseBackoffice.Cartridges" requirement="parent"/>
</instance>

<instance with="ApplicationType" name="custom.B2BBackoffice">
    <fulfill value="custom.B2BBackoffice" requirement="id"/>
    <fulfill value="b2b" requirement="urlIdentifier"/>
    <fulfill with="custom.B2BBackoffice.Cartridges" requirement="cartridgeListProvider"/>

    <fulfill requirement="namedObject">
        <instance with="NamedObject">
            <fulfill requirement="name" value="ChannelApps_52" />
            <fulfill requirement="object" with="custom.B2BBackoffice.ApplicationTypes" />
        </instance>
    </fulfill>
</instance>

<fulfill requirement="namedObject" of="intershop.EnterpriseBackoffice">
    <instance with="NamedObject">
        <fulfill requirement="name" value="ChannelApps_52" />
        <fulfill requirement="object" with="custom.B2BBackoffice.ApplicationTypes" />
    </instance>
 </fulfill>

<fulfill of="AppEngine" with="custom.B2BBackoffice" requirement="app"/>

<fulfill requirement="namedObject" of="custom.B2BBackoffice" with="intershop.EnterpriseBackoffice.RESTAPI"/>

可以使用如下语句在数据库中完成对实际站点的分配:

UPDATE application SET appid = 'custom.B2BBackoffice' WHERE urlidentifier IN ('IshB2B', 'IshB2B-xxxb2b');

显然有一种方法可以为 BO 定义两种应用程序类型并将它们分配给不同的渠道。 这是一种解决方法,但它确实有效...

您必须在apps.component中定义两个BO应用类型,并将它们分配给两个通道,例如:

<fulfill requirement="app" with="channel1.Web" of="channel1.Backoffice.ApplicationTypes"/>
<fulfill requirement="app" with="channel1.Web" of="channel2.Backoffice.ApplicationTypes"/>

<fulfill requirement="app" with="channel2.Web" of="channel1.Backoffice.ApplicationTypes"/>
<fulfill requirement="app" with="channel2.Web" of="channel2.Backoffice.ApplicationTypes"/>

并添加 post 执行 SQL 的 DBinit 准备程序以将通道 1 BO 应用程序更新为 channel1.Backoffice(因为使用 DBIinit 通道 1 将被分配给 channel2.Backoffice):

UPDATE application SET appid = 'channel1.Backoffice' WHERE urlidentifier IN ('channel1', 'channel1-organization-channel1');