Extending the ProductInventoryRecord Object

You might want to extend the ProductInventoryRecord object to store additional fields. For example, you might want to show a special message when the inventory of a particular product drops below its threshold value. There are multiple steps to this process.

See Inventory for Developers.

  1. Extend the ProductInventoryRecord object.
    1. Select Administration > Site Development > System Object Types.
    2. Select ProductInventoryRecord and click the Attribute Definitions tab.
    3. Add the new object attribute.
  2. Add a new message to the components.properties resource file.
  3. Modify availability.isml to analyze and react to the Threshold value.
    <isif condition="${availabilityStatus == dw.catalog.ProductAvailabilityModel.AVAILABILITY_STATUS_IN_STOCK}"> 
    <span class="isinstock"> ${Resource.msg('components.common-details.005','components',null)}<br/> 
      <isif condition="${inventoryRecord != null && inventoryRecord.stockLevel.available}">
        <isif condition="${inventoryRecord.stockLevel.value <= inventoryRecord.Threshold. value }">
          ${StringUtils. format(Resource.msg('components.custom.001','components',null)) } 
          <isif condition="${inventoryRecord.ATS.available && inventoryRecord.ATS.value >
     inventoryRecord.stockLevel.value}"> ${StringUtils.format(Resource.msg( 'components.common-details.008','components',null))}