Tutorials > Management Center > Add new fields in the Catalogs tool

< Previous | Next >


Part 2: Adding a language-sensitive property in the Catalogs tool

In this lesson, you add care instructions for a product to the Warranty tab. You test the change by viewing the care instruction in the Catalogs tool.


Procedure

  1. Add detailed Care Instruction information to one of the following files:

    Option Description
    CatalogPropertyPane.lzx

    1. Switch to the Java EE perspective.

    2. In the Enterprise Explorer view, expand LOBTools > WebContent > WEB-INF > src > lzx > commerce > catalog > propertiesViews.

    3. Open the CatalogPropertyPane.lzx file.

    4. Locate the following code:

      <class name="catWarrantyPane" extends="wcfPropertyPane">
      <wcfPropertyGroup open="true" groupTitle="${extCatalogResources.productWarranty_GroupTitleForWarranty.string}">
      <wcfPropertyCombobox promptText="${extCatalogResources.productWarranty_WarrantyTermPrompt.string}" width="200"  propertyName="x_warterm"/>
      <wcfPropertyCombobox promptText="${extCatalogResources.productWarranty_WarrantyTypePrompt.string}" width="200"  propertyName="x_wartype"/>
      </wcfPropertyGroup>
      
      </class>
      

    5. Add the following code before the </class> tag:

      <wcfPropertyGroup open="true" name="CareInstrID" groupTitle="${extCatalogResources.productWarranty_GroupTitleForOthers.string}">
      <wcfPropertyInputMultiLineText objectPath="CatalogEntryDescription" propertyName="xdesc_careinstruction" promptText="${extCatalogResources.productWarranty_OtherPrompt.string}"/>
      </wcfPropertyGroup>
      

    6. Save the changes.
    CatalogPropertyPane.def

    1. Switch to the Java EE perspective.

    2. In the Enterprise Explorer view, expand LOBTools > WebContent > config > commerce > catalog > propertiesViews.

    3. Open the CatalogPropertyPane.def file.

    4. Locate the following code:

      <PropertyPane definitionName="catWarrantyPane">
         
      <PropertyGroup open="true"
              groupTitle="${extCatalogResources.productWarranty_GroupTitleForWarranty}">
             
      <PropertyCombobox
                  promptText="${extCatalogResources.productWarranty_WarrantyTermPrompt}"
                  width="200"  propertyName="x_warterm"/>
             
      <PropertyCombobox 
                  promptText="${extCatalogResources.productWarranty_WarrantyTypePrompt}"
                  width="200"  propertyName="x_wartype"/>
         
      </PropertyGroup>
      </PropertyPane>
      

    5. Add the following code before the </PropertyPane> tag:

      <PropertyGroup open="true" name="CareInstrID"
          groupTitle="${extCatalogResources.productWarranty_GroupTitleForOthers}">
         
      <PropertyInputMultiLineText objectPath="CatalogEntryDescription"
              propertyName="xdesc_careinstruction"
              promptText="${extCatalogResources.productWarranty_OtherPrompt}"/>
      </PropertyGroup>
      

    6. Save the changes.

    This new code creates a multi-line text editor to contain care instruction information. By default, the values stored in the XCAREINSTRUCTION table are displayed. The values are editable and the values persist to the database.

    Where:

    objectPath

    The path required to navigate from the reference object to its child object. The objectPath locates a child Management Center object relative to the current object. If the property applies to the current object, then you do not need to specify an objectPath. The care instruction applies to the CatalogEntry\CatalogEntryDescription, therefore specify the objectPath as CatalogEntryDescription.

    To enable the data service layer to populate data in the attribute element of the CatalogEntryDescription noun the XCAREINSTRUCTION table has a foreign key to the CATENTDESC table. See Customize the WebSphere Commerce schema for more information.

    propertyName

    The propertyName for the CareInstruction attribute is "xdesc_careinstruction". The propertyName was defined when you customized the persistence layer and Business Object Manager. The naming convention is:

    • x_ represents the userdata found at the root of the object.

    • xdesc_ represents the user data that is part of changeable attribute part.

    • careinstruction is the "logicalPropertyName" in wc-business-object-mediator.xml file.

  2. Right-click the LOBTools project and select Build Open Laszlo Project.

  3. Verify the customization.

    1. Start the WebSphere Commerce Server.

    2. In the Web browser, enter the URL: https://localhost:8000/lobtools.

    3. Log on to the Management Center as a user that has the Category Manager role.

    4. Click Catalogs.

    5. Select the ConsumerDirect store.

    6. In the explorer tree, expand ConsumerDirect > Furniture > Lounge Chairs.

    7. Right-click the White Fabric Roll Arm Chaise product and select Open.

    8. Click the Warranty tab.

    9. Browse product's care instruction information.

    10. Change the value, then click Save and Close.

    11. Log out of the Management Center.

    12. Log in and verify that the text you changed was saved.

< Previous | Next >


+

Search Tips   |   Advanced Search