Commerce

Manage Personalized Attributes for the Order Items

What is a Personalized Attribute?

An attribute describes a characteristic of an object. Attributes are called specifications in WebSphere Commerce. Specifications are used to distinguish one product from another. Height, color, weight and size are examples of an attribute or specification. An Attribute created from personalized dictionary that buyers use to define the specifications that they want a product to have on DEMAND.

 

How it is different from a normal Attribute?

Normal Attribute: It is used to define the product specification which is defined during the design of the data model and catalog structure only.

Personalized Attribute: It is used to define the product specification which is defined from Personalized Dictionary.These attributes are directly linked to the specific order items after buyer adds the product item to the cart/order

Personalized Dictionary: An attribute is added to Personalized dictionary from Commerce back-end tool called Accelerator.

 

Why Personalized Attribute?

  • If buyers cannot find a product matching their needs in the catalog, they can select attributes from the personalized dictionary to precisely define the product specifications. A free-form attribute field is available so the buyer can propose a specification not available in the dictionary.
  • Avoid overhead of creation of Custom tables to handle new attributes.
  • Avoid creation and handling of EJB’s for the Custom tables in the application container.

 

How to manage an attribute in the Personalized dictionary?

We can manage personalized attributes using Backend Accelerator tool.

Accelerator provides a GUI to manage ( add/modify/delete) personalized attributes that can be linked with Order Items.

a) Adding an attribute to the personalized dictionary

Procedure:

Step 1: Start WebSphere Commerce Accelerator:

Access the following Web address in your browser:

https://host_name:8000/accelerator
where host_name is the fully-qualified WebSphere Commerce Web server host name. The host name may be a          virtual host name on the Web server

Ensure you have started WebSphere Commerce within the WebSphere Commerce development environment.

Access the following Web address in your browser:
https:// host_name/webapp/wcs/tools/servlet/ToolsLogon?XMLFile=common.mcLogon
where host_name is the fully-qualified WebSphere Commerce development environment Web server host name. The host name may be a virtual host name on the Web server.
Login to Commerce Accelerator with Admin Credentials

Step 2: Select your <Custom-Store> and click on “OK” button

Step 3: Select “Personalized Attributes” under “Sales” tab

Step 4: Next Click on “New” Button in the right pane

Step 5:

Type the name for the new attribute in the Name field

Type a complete description of the attribute in the Description text box field.

Select the appropriate data type from the Type list.

If additional security is required for the attribute, select Yes under the phrase Should this attribute be encrypted?

Click OK. A confirmation message displays.

Step 6: Click OK in the dialog box to return to the Personalized Attributes list.

b) Changing an existing personalized attribute
Procedure
  1.  Open the WebSphere Commerce Accelerator.
  2. Click Sales Personalized Attributes. The Personalized Attribute list displays. If you do not see this menu, then your logon ID does not have the appropriate authority to perform this task. Contact your Site Administrator.
  3. Select the check box for the attribute that you want to change.
  4. Click Change. The Change Personalized Attribute form displays.
  5. Make the necessary changes to the Description Type or encryption parameters.
  6. Clicking OK displays a confirmation message.
  7. Click OK in the dialog box to return to the Personalized Attributes list.

 

c)  Deleting an attribute from the personalized dictionary

Procedure
  1. Open the WebSphere Commerce Accelerator.
  2. Click Sales Personalized Attributes The Personalized Attribute list displays. If you do not see this menu, then your logon ID does not have the appropriate authority to perform this task. Contact your Site Administrator.
  3. Select the check box for the attribute that you want to delete.
  4. Click Delete.

Results

The Personalized Attribute list displays with the deleted attribute no longer shown.

How Personalized attributes are utilized in the Code?

Interface command to utilize the personalized attribute:

ExtendOrderItemProcessCmd

Implemented class to utilize the personalized attribute:

ExtendOrderItemProcessCmdImpl

Add the below code snippet to your task command to invoke the above commands

Place the below code snippet to your task command to insert/update values for an attribute.
Code snippet to Add/Update Additional Info value for an Order Item:: ExtendOrderItemProcessCmdImpl

ExtendOrderItemProcessCmd ExtendOrderItemProcessCmd = (ExtendOrderItemProcessCmd)
 CommandFactory.createCommand("com..commerce.orderitems.commands.ExtendOrderItemProcessCmd",getStoreId());
 ExtendOrderItemProcessCmd.setCommandContext(getCommandContext());
 ExtendOrderItemProcessCmd.setOrderItemId("order_item_id");

TypedProperty extendOrderItemsReqProperties = new TypedProperty();
 extendOrderItemsReqProperties.put("OI_Additional_Info_1", "OI_TestValue2");

ExtendOrderItemProcessCmd.setRequestProperties(extendOrderItemsReqProperties);
 ExtendOrderItemProcessCmd.execute();

 

Verify below tables which will be affected during managing Personalized attribute in Accelerator.

  1. PATTRIBUTE
Column Descriptions:
Name Type Description
PATTRIBUTE_ID BIGINT NOT NULL The internal reference number of the Attribute.
NAME VARCHAR (254) NOT NULL A description of the Attribute. For example, length, width, color, or monogram.
ATTRTYPE_ID CHAR (16) NOT NULL Indicates the data type for this Attribute. For example, integer or string.
ACCESSBEANNAME VARCHAR (254) Name of the access bean to process this Attribute.
SEQUENCE INTEGER Reserved for IBM internal use.
ENCRYPTFLAG INTEGER NOT NULL DEFAULT 0 Set to 1 if encryption is required for the personalized attribute value. Default is 0.
OPTCOUNTER SMALLINT The optimistic concurrency control counter for the table.

2) PATTRDESC

Column Descriptions:
Name Type Description
PATTRIBUTE_ID BIGINT NOT NULL The identifier of the personalization attribute.
LANGUAGE_ID INTEGER NOT NULL Language this description pertains to. For a list of language components, see the LANGUAGE table.
DESCRIPTION VARCHAR (1024) A brief description of the personalization attribute.
OPTCOUNTER SMALLINT The optimistic concurrency control counter for the table.

3) PATTRPROD

Column Descriptions:
Name Type Description
PATTRIBUTE_ID BIGINT NOT NULL The internal reference number of the personalization attribute.
CATENTRY_ID BIGINT NOT NULL The internal reference number of the CatalogEntry.
OPTCOUNTER SMALLINT The optimistic concurrency control counter for the table.

4) PATTRVALUE

Column Descriptions:
Name Type Description
PATTRVALUE_ID BIGINT NOT NULL The internal reference number of the personalized attribute value.
PATTRIBUTE_ID BIGINT NOT NULL The internal reference number of the personalized attribute.
ATTRTYPE_ID CHAR (16) NOT NULL The data type of the Attribute. For example, STRING, INTEGER, FLOAT, DATETIME, FREEFORM, or BIGINT.
OPERATOR_ID INTEGER NOT NULL The internal reference number of the Operator. The Operator determines the relationship between the Name and Value. For example, equal; not equal; or greater than;.
TERMCOND_ID BIGINT The internal reference number of the TermAndCondition for this value. Only one of the columnsORDERITEMS_IDTERMCOND_IDRFQPROD_ID, or RFQRSPPROD_ID must be specified.
QTYUNIT_ID CHAR (16) The internal reference number of the QTYUNIT.
INTEGERVALUE INTEGER Contains the value if the data type of the Attribute is set to INTEGER.
FLOATVALUE DOUBLE Contains the value if the data type of the Attribute is set to FLOAT.
STRINGVALUE VARCHAR (254) Contains the value if the Attribute data type is set to STRING.
DATEVALUE TIMESTAMP Contains the value if the data type of the Attribute is set to DATETIME.
BIGINTVALUE BIGINT Contains the value if the data type of the Attribute is set to DOUBLE.
SEQUENCE INTEGER Reserved for IBM internal use.
ENCRYPTFLAG INTEGER NOT NULL DEFAULT 0 Set to 1 if personalized attribute value is encrypted. The default is 0.
ORDERITEMS_ID BIGINT The order item that this personalized attribute value describes.
MANDATORY INTEGER NOT NULL DEFAULT 0 Indicates whether the personalization attribute is mandatory or not.
ATTACHMENT_ID BIGINT The internal reference number of the Attachment.
CHANGEABLE INTEGER NOT NULL DEFAULT 0 Indicates whether the personalization attribute is changeable or not.
RFQPROD_ID BIGINT The RFQ Product that this personalized attribute value describes.
RFQRSPPROD_ID BIGINT The RFQ Response Product that this personalized attribute value describes.
CORRELATIONGROUP BIGINT Any personalization attribute values that are part of the same group will have the sameCORRELATIONGROUP values.
OPTCOUNTER SMALLINT The optimistic concurrency control counter for the table.

 Note: The columns which are in Bold format contains the data of personalized attributes.

About The Author

Leave a Reply

*