我正在研究 SAP Commerce (Hybris) 1811,我正在尝试使用对Product
type 的引用来扩展 type ,该 typeProductSales
将包含产品销售数据并通过 cronjob 填充。
但是,我找不到为所有新产品和现有产品初始化这种新类型的正确方法。即使在系统更新之后,此引用也未初始化(空)。
Product
和之间应该是一对一的关系ProductSales
。
我希望初始化这个引用类型:
- 在系统更新期间对所有尚无参考的现有产品
- 为所有新创建的产品创建一个实例
我的items.xml
定义:
<itemtype code="ProductSales" autocreate="true" generate="true" >
<deployment table="productsales" typecode="15011" />
<attributes>
<attribute qualifier="unitsSold" type="localized:java.lang.Long">
<description>Amount of units sold</description>
<persistence type="property"/>
</attribute>
<attribute qualifier="ordersCount" type="localized:java.lang.Long">
<description>Count of how many orders contained this product</description>
<persistence type="property"/>
</attribute>
</attributes>
</itemtype>
<itemtype code="Product" autocreate="false" generate="false">
...
<attribute qualifier="productSales" type="ProductSales">
<description>Product Sales</description>
<modifiers partof="true" optional="false" initial="true" />
<persistence type="property"/>
</attribute>
...
</itemtype>
我之所以不将数据直接存储在Product
表中,而是作为参考,是因为我不希望在目录同步期间同步这些数据。
为所有产品初始化这种新类型的最佳方法是什么?
感谢您的任何提示。