‎2018 Dec 05 11:04 AM - edited ‎2024 Feb 03 5:14 PM
How do we define item relationships in raw, canonical and target extension files.
For example I have product to product recipe relationship and I have defined it as follows:
in raw-extension.xml:
<item>
<type>VariantProduct</type>
<description>Raw representation of variant product</description>
<attributes>
<attribute>
<name>PRODUCT_RECIPE</name>
</attribute>
</attributes>
</item>
<item>
<type>ProductRecipe</type>
<description>Raw representation of Product recipe</description>
<attributes>
<attribute>
<name>RECIPE_CODE</name>
</attribute>
</attributes>
</item>
<item>
<type>CanonicalVariantProduct</type>
<attributes>
<attribute>
<name>PRODUCT_RECIPE</name>
<transformations>
<transformation>
<rawSource>VariantProduct</rawSource>
<expression>PRODUCT_RECIPE</expression>
</transformation>
</transformations>
</attribute>
</attributes>
</item>
in canonical-extension.xml:
<item>
<type>CanonicalVariantProduct</type>
<description>Canonical representation of product</description>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>PRODUCT_CODE</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>true</primaryKey>
</model>
</attribute>
<attribute>
<name>PRODUCT_RECIPE</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>CanonicalProductRecipe</type>
<primaryKey>false</primaryKey>
</model>
</attribute>
</attributes>
</item>
<item>
<type>CanonicalProductRecipe</type>
<description>Canonical representation of Product recipe</description>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>RECIPE_CODE</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>true</primaryKey>
</model>
</attribute>
</attributes>
</item>
in target-extension.xml:
<item>
<type>VariantProduct</type>
<exportCode>VariantProduct</exportCode>
<description>Hybris Platform representation of variant product</description>
<updatable>true</updatable>
<canonicalItemSource>CanonicalVariantProduct</canonicalItemSource>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>PRODUCT_CODE</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>PRODUCT_CODE</transformationExpression>
<exportCode>code[unique=true]</exportCode>
</attribute>
<attribute>
<name>PRODUCT_RECIPE</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>PRODUCT_RECIPE</transformationExpression>
<exportCode>productRecipe</exportCode>
<mandatoryInHeader>false</mandatoryInHeader>
</attribute>
</attributes>
</item>
<item>
<type>productRecipe</type>
<exportCode>ProductRecipe</exportCode>
<description>Hybris Platform representation of product recipe</description>
<updatable>true</updatable>
<canonicalItemSource>CanonicalProductRecipe</canonicalItemSource>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>RECIPE_CODE</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>RECIPE_CODE</transformationExpression>
<exportCode>recipeCode[unique=true]</exportCode>
<mandatoryInHeader>false</mandatoryInHeader>
</attribute>
</attributes>
</item>
above code is not complete, I have just pasted required code.
Can someone help me understand whats wrong with my code.
I am getting following error when I publish it into hybris commerce 6.8:
pk has wrong format
Request clarification before answering.
Kaushik,
nothing is obviously wrong with the models you pasted. Would you mind pasting the stack trace, if there one, or exact error message as received from the ECP, if you received an error response from ECP for an item.
It's possible the problem is not in the model but in the data you're publishing. For example, make sure the attributes marked as primaryKey contain values. Null is not acceptable for primary keys.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 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.