The UnitOfMeasureDroplet provides the fractional breakdown for specific units of measure and can be used to determine if a product or SKU accepts fractional quantities. It can also aid the page coder. Depending on the configuration of a unit of measure, it indicates if it can be sold in fractional quantities or not. If it can, the configuration can provide a list of beans with values and labels for a unit of measure or an incremental value. These can be used, for example, to create a widget. For detailed information on the UnitOfMeasureDroplet, refer to the Guide to Setting Up a Store.

The following example describes how to create a new yard unit of measure:

  1. Add the following to the unitOfMeasure property in the product and the SKU item descriptors of the customCatalog repository:

    <option resource="UnitOfMeasureYards" value="yards" code="5006"/>

  2. To retrieve the fractional unit information for a specific product or SKU, create a new UnitOfMeasure.properties file, for example, YardUnitOfMeasure.properties. In this example, the fractional unit type is options, allowing us to set the measurements.

    $class=atg.commerce.units.UnitsOfMeasure

    type=options
    options= \
      0.25=oneQuarter, \
      0.5=oneHalf, \
      0.75=threeQuarters

  3. Add the YardUnitOfMeasure to the UnitsOfMeasureServiceMap in the UnitOfMeasureManager.

    ## ServiceMap of unitOfMeasure to UnitOfMeasure
    unitsOfMeasure= \
      pounds=PoundsUnitOfMeasure, \
      kilograms=KilogramsUnitOfMeasure, \
      gallons=GallonsUnitOfMeasure, \
      liters=LitersUnitOfMeasure, \
      yards=YardsUnitOfMeasure

The UnitOfMeasureDroplet calls the UnitOfMeasureManager, which looks up the product or SKU, identifies if the fractionalQuantitiesAllowed property is set to true, and retrieves the unitOfMeasure property. The value of the property is passed back to the UnitOfMeasureDroplet.


Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices