We need to make some itemtype as catalogunaware when we are getting exceptions while running catalogSynchJob. CatalogVersionSynchJob is ootb job for synching product from staged to online.
For making itemType catalog unaware. Itemtype = “Certification”. This certification is an attribute of Product itemtype
Step 1: Remove catalog version attribute entry from item type-“Certification” in items.xml.
<attribute qualifier="catalogVersion" type="CatalogVersion">
<modifiers read="true" write="true" search="true" optional="false"/>
<persistence type="property"/>
</attribute>
Step 2 :Remove custom properties from item type-“Certification” in core-items.xml
<custom-properties>
<property name="uniqueKeyAttributeQualifier"><value>"pk"</value></property>
<property name="catalogItemType"><value>java.lang.Boolean.TRUE</value></property>
<property name="catalogVersionAttributeQualifier"><value>"catalogVersion"</value></property>
</custom-properties>
Step 3 : Do build by ant clean all and server up.
Step 4 : Do update in HAC.
Step 5 : Sql query to remove attribute when we use Jdbc db
import org.springframework.jdbc.core.JdbcTemplate
JdbcTemplate jdbcTemplate = spring.getBean("jdbcTemplate")
try {
int rows = jdbcTemplate.update("ALTER TABLE products DROP COLUMN {p_catalogversion};")
} catch (Exception e) {
println(String.format("'%s'", e.getMessage()))
}
Step 6 : Run impex in HAC to remove catalogVersion attribute from Attribute descriptor in Certification itemType
REMOVE AttributeDescriptor; qualifier[unique = true]; enclosingType(code)[unique = true]
; catalogVersion ; Certification
Step 7 :Go to backoffice
Click on System->Types
In the editor section, search for Certification and click on ‘Properties’ tab and see if your “catalogversion” is present in the list of attributes. It should not be there because we have removed it. If it’s still present delete it.
Step 8 :Reset Everything
Summary: Sometimes, our project have some itemtype which is catalog aware that should not be catalog aware. Like any itemtype=”Document” which we don’t want as catalog aware.
If any itemtype is catalog aware, it means the same itemType=”document” is present in two places in database that is in staged and online version, both version document will be in different pk. It will use more memory. That time, we need to make itemtype catalog unaware. And this type of attribute is giving error while running full catalogSynchJob.