You can work with cost center data for a user’s profile through the CommerceProfileTools
class. Cost centers are assigned to either a user or an organization (or sub-organization). A cost center consists of an identifier and a description.
There are two ways in which cost centers can be added, edited, or deleted within a profile:
Set up web forms that allow users to manipulate the cost centers within their own profiles
The site administrator can use the ATG Control Center to maintain cost center information
The methods of CommerceProfileTools
allow you to add, modify, and delete of cost centers from a profile.
Set up HTML forms for users to make changes to the cost centers within their own profile is done using the CommerceProfileFormHandler
class. The following table describes the properties of the CommerceProfileFormHandler
class:
Property | Description |
---|---|
| Stores the identifier, or name, of a new cost center to be added to the repository. |
| Stores the description of a new cost center to be added. |
| Stores the identifier of a cost center that is to be modified. |
| Stores the description that will be the new value for the description of the cost center identified by |
| Stores the identifier of the cost center to remove. |
| Boolean value that stores whether or not the given cost center should become the user’s default cost center. |
| Stores the name of the JSP the user is to be taken to after successfully adding a cost center. |
| Stores the name of the JSP the user is to be taken to after an error occurs while attempting to add a cost center. |
| Stores the name of the JSP the user is to be taken to after successfully editing a cost center. |
| Stores the name of the JSP the user is to be taken to after an error occurs while attempting to edit a cost center. |
| Stores the name of the JSP the user is to be taken to after successfully removing a cost center. |
| Stores the name of the JSP the user is to be taken to after an error occurs while attempting to remove a cost center. |
The adding, editing and removing cost centers can be done by calling handleAddCostCenter
, handleEditCostCenter
, and handleRemoveCostCenter
.
The following JSP example creates a form that allows a user to add a cost center:
<h1>Add Cost Center</h1> <dsp:form action="done.jsp" method="post"> <dsp:input bean="ProfileFormHandler.AddCostCenterSuccessURL" value="success.jsp" type="hidden"/> <dsp:input bean="ProfileFormHandler.AddCostCenterErrorURL" value="error.jsp" type="hidden"/> Name: <dsp:input bean="ProfileFormHandler.AddCostCenterIdentifier" type="text"/><P> Description: <dsp:input bean="ProfileFormHandler.AddCostCenterDescription" type="text"/><P> <dsp:input bean="ProfileFormHandler.DefaultCostCenter" value="true" type="checkbox"/> Make default<P> <dsp:input bean="ProfileFormHandler.AddCostCenter" value="Add Cost Center" type="submit"/><P> </dsp:form>
The following JSP example creates a form that allows a user to edit a cost center:
<h1>Edit Cost Center</h1> <dsp:form action="done.jsp" method="post"> <dsp:input bean="ProfileFormHandler.EditCostCenterSuccessURL" value="success.jsp" type="hidden"/> <dsp:input bean="ProfileFormHandler.EditCostCenterErrorURL" value="error.jsp" type="hidden"/> Name: <dsp:input bean="ProfileFormHandler.EditCostCenterIdentifier" type="text"/><P> New Description: <dsp:input bean="ProfileFormHandler.EditCostCenterDescription" type="text"/><P> <dsp:input bean="ProfileFormHandler.DefaultCostCenter" value="true" type="checkbox"/> Make default<P> <dsp:input bean="ProfileFormHandler.EditCostCenter" value="Edit Cost Center" type="submit"/><P> </dsp:form>
The following JSP example creates a form that allows a user to remove a cost center:
<h1>Remove Cost Center</h1> <dsp:form action="done.jsp" method="post"> <dsp:input bean="ProfileFormHandler.RemoveCostCenterSuccessURL" value="success.jsp" type="hidden"/> <dsp:input bean="ProfileFormHandler.RemoveCostCenterErrorURL" value="error.jsp" type="hidden"/> Name: <dsp:input bean="ProfileFormHandler.RemoveCostCenterIdentifier" type="text"/><P> <dsp:input bean="ProfileFormHandler.RemoveCostCenter" value="Remove Cost Center" type="submit"/><P> </dsp:form>