Tutorial: Customizing Web 2.0 and Web services to support personalization > < Previous | Next >

 

Prepare the database for new engraving attributes

In this step, you will create engraving attributes. These attributes are defined in the PATTRIBUTE table. This table allows you to create custom personalization attributes for products. Each personalization attribute has an attribute type. Determine the unique member identifier of your store Before creating the new engraving attributes columns, determine the member identifier for your store. To determine the member identifier:

  1. Start the test environment.

  2. Open a browser and type the following URL: http://localhost/webapp/wcs/admin/servlet/db.jsp

  3. In the input box, enter the following SQL statement
    select MEMBER_ID from STOREENT where IDENTIFIER =
    'Madisons2';
    
    Make note of the value.

Create the engraving rows in the Pattribute table To save engraving attributes for each orderItem to the PATTRVALUE table, first create the attribute types inside of the PATTRIBUTE table. To create the Text, Size and Font attributes inside the PATTRIBUTE table:

  1. In the input box, enter the following SQL statement
    INSERT INTO PATTRIBUTE(PATTRIBUTE_ID, ATTRTYPE_ID, NAME,
    ENCRYPTFLAG, ACCESSBEANNAME)
            SELECT counter+1,'STRING','engravingText',
            0,'com.ibm.commerce.utf.objects.PAttrStringValueAccessBean'
    from keys where tablename='pattribute'; 
            update keys set counter=counter+1 where tablename=
    'pattribute'; 
    
    INSERT INTO PATTRIBUTE(PATTRIBUTE_ID, ATTRTYPE_ID, NAME,
    ENCRYPTFLAG, ACCESSBEANNAME)
      SELECT counter+1,'STRING','engravingFont',
      0,'com.ibm.commerce.utf.objects.PAttrStringValueAccessBean'
    from keys where tablename='pattribute'; 
            update keys set counter=counter+1 where tablename=
    'pattribute'; 
    
    INSERT INTO PATTRIBUTE(PATTRIBUTE_ID, ATTRTYPE_ID, NAME,
    ENCRYPTFLAG, ACCESSBEANNAME)
      SELECT counter+1,'STRING','engravingSize',
      0,'com.ibm.commerce.utf.objects.PAttrStringValueAccessBean'
    from keys where tablename='pattribute'; 
            update keys set counter=counter+1 where tablename=
    'pattribute'; 
    
    SELECT PATTRIBUTE_ID FROM PATTRIBUTE WHERE NAME='engravingText' OR
    NAME='engravingFont' 
            OR NAME='engravingSize';
    

  2. Note the three new Pattribute_id values.

Determine which catalog items will be engraveable You must determine which items in your catalog will have engraving options, In this example, the wine glasses for the Web 2.0, Madison2 store are the only engraveable items. To determine which items will have engraving options:

  1. In the input box, enter the following SQL statement
    select catentry.catentry_id, catentdesc.name,
    catentdesc.shortdescription from catentry, catentdesc 
            where catentry.member_id=
    Member_id and catentry.catenttype_id='ItemBean' 
            and catentry.catentry_id = catentdesc.catentry_id and
    catentdesc.language_id=-1;
    
    Where: Member_id is the member identifier that you recorded above.

  2. Under the Name column find the following catalog entries: Villagois Wineglasses and Hawthorne Wineglasses.

  3. Note the catentry_id values.

Determine the unique identifier of your store You must associate all of the catentry_id with each pattribute_id inside of the PATTRPROD table Each catalog item now must be associated the pattribute, for example you want to keep track that your wine glass with catentry_id 10022 can have all three pattribute values, text, size and font:

  1. In the input box, enter the following SQL statement
            INSERT INTO PATTRPROD(PATTRIBUTE_ID, CATENTRY_ID) VALUES ('
    Pattribute_id_text','
    Catentry_id_Villagois');
          INSERT INTO PATTRPROD(PATTRIBUTE_ID, CATENTRY_ID)
    VALUES ('
    Pattribute_id_size','
    Catentry_id_Villagois');
          INSERT INTO PATTRPROD(PATTRIBUTE_ID, CATENTRY_ID)
    VALUES ('
    Pattribute_id_font','
    Catentry_id_Villagois');
          INSERT INTO PATTRPROD(PATTRIBUTE_ID, CATENTRY_ID)
    VALUES ('
    Pattribute_id_text','
    Catentry_id_Hawthorne');
          INSERT INTO PATTRPROD(PATTRIBUTE_ID, CATENTRY_ID)
    VALUES ('
    Pattribute_id_size','
    Catentry_id_Hawthorne');
          INSERT INTO PATTRPROD(PATTRIBUTE_ID, CATENTRY_ID)
    VALUES ('
    Pattribute_id_font','
    Catentry_id_Hawthorne');
    
    Where:

    Pattribute_id_text, Pattribute_id_size and Pattribute_id_font

    Are the three Pattribute_id values.

    Catentry_id

    Is a value that you recorded in the preceding step.

< Previous | Next >