Tutorials > Content management > Create a content-managed resource > Integrate the new resource
Update NavCatCatalogCreateContent.jsp
This WebSphere Commerce Accelerator JSP will be modified to include new fields for the new extended catalog information.
Procedure
- In the Enterprise Explorer view, navigate to CommerceAccelerator > WebContent > tools > catalog.
- Find and double-click NavCatCatalogCreateContent.jsp in the list of JSP files to open the file in the editor.
- Add HTML form elements to capture the extended information. Insert this into the file before the </TABLE> tag.
<TR> <TD> <LABEL for="CatalogFrontImage"> <%=UIUtil.toHTML((String)rbCategory.get("NavCatCatalogCreate_Frontimage"))%> </LABEL> </TD> </TR> <TR><TD> <INPUT SIZE=60 MAXLENGTH=254 ONBLUR=updateLanguageInfo() ID="CatalogFrontImage" NAME=CatalogFrontImage VALUE=""> </TD> </TR> <TR> <TD> <LABEL for="CatalogBackImage"> <%=UIUtil.toHTML((String)rbCategory.get("NavCatCatalogCreate_Backimage"))%> </LABEL> </TD> </TR> <TR> <TD> <INPUT SIZE=60 MAXLENGTH=254 ONBLUR=updateLanguageInfo() ID="CatalogBackImage" NAME=CatalogBackImage VALUE=""> </TD> </TR> <TR> <TD> <LABEL for="CatalogSideImage"> <%=UIUtil.toHTML((String)rbCategory.get("NavCatCatalogCreate_Sideimage"))%> </LABEL> </TD> </TR> <TR> <TD> <INPUT SIZE=60 MAXLENGTH=254 ONBLUR=updateLanguageInfo() ID="CatalogSideImage" NAME=CatalogSideImage VALUE=""> </TD> </TR> <TR><TD><LABEL for="CatalogTopImage"><%=UIUtil.toHTML((String)rbCategory.get("NavCatCatalogCreate_Topimage"))%></LABEL></TD></TR> <TR><TD><INPUT SIZE=60 MAXLENGTH=254 ONBLUR=updateLanguageInfo() ID="CatalogTopImage" NAME=CatalogTopImage VALUE=""></TD></TR>
- Add the page following page import to the JSP file:
<%@ page import = "com.mycompany.catalog.objects.ExtendedCatalogDescriptionAccessBean"%>
- Modify some existing JavaScript functions. Add the code in italics to the following functions:
////////////////////////////////////////////////////////////////////////////////////// // descriptionObject(languageId) // // @param languageId - the language of this description object // // - this defines the description object for the specified language ////////////////////////////////////////////////////////////////////////////////////// function descriptionObject(languageId) { this.languageId = languageId; this.name = ""; this.shortDescription = ""; this.longDescription = ""; this.thumbnail = ""; this.fullimage = ""; this.frontimage = ""; this.backimage = ""; this.sideimage = ""; this.topimage = ""; } ////////////////////////////////////////////////////////////////////////////////////// // selectLanguage() // // - this function saves the values when a language is selected ////////////////////////////////////////////////////////////////////////////////////// function selectLanguage() { var i = languageSelect.selectedIndex; if (i == 0) { CatalogCode.disabled = false; CatalogDesc.disabled = false; CategoryName.value = vLanguages[i].name; CategoryShortDesc.value = vLanguages[i].shortDescription; CategoryLongDesc.value = vLanguages[i].longDescription; CategoryThumbNail.value = vLanguages[i].thumbnail; CategoryFullImage.value = vLanguages[i].fullimage; CatalogFrontImage.value = vLanguages[i].frontimage; CatalogBackImage.value = vLanguages[i].backimage; CatalogSideImage.value = vLanguages[i].sideimage; CatalogTopImage.value = vLanguages[i].topimage; } else { if (trim(CatalogCode.value) == "") { alertDialog("<%= UIUtil.toJavaScript((String)rbCategory.get("NavCatCatalogCreate_ErrorDefaultLangFirst"))%>"); languageSelect.selectedIndex = 0; } else { CatalogCode.disabled = true; CatalogDesc.disabled = true; CategoryName.value = vLanguages[i].name; CategoryShortDesc.value = vLanguages[i].shortDescription; CategoryLongDesc.value = vLanguages[i].longDescription; CategoryThumbNail.value = vLanguages[i].thumbnail; CategoryFullImage.value = vLanguages[i].fullimage; CatalogFrontImage.value = vLanguages[i].frontimage; CatalogBackImage.value = vLanguages[i].backimage; CatalogSideImage.value = vLanguages[i].sideimage; CatalogTopImage.value = vLanguages[i].topimage; } } } ////////////////////////////////////////////////////////////////////////////////////// // updateLanguageInfo() // // - this function updates the information upon language change ////////////////////////////////////////////////////////////////////////////////////// function updateLanguageInfo() { var i = languageSelect.selectedIndex; vLanguages[i].name = CategoryName.value; vLanguages[i].shortDescription = CategoryShortDesc.value; vLanguages[i].longDescription = CategoryLongDesc.value; vLanguages[i].thumbnail = CategoryThumbNail.value; vLanguages[i].fullimage = CategoryFullImage.value; vLanguages[i].frontimage = CatalogFrontImage.value; vLanguages[i].backimage = CatalogBackImage.value; vLanguages[i].sideimage = CatalogSideImage.value; vLanguages[i].topimage = CatalogTopImage.value; }
- Save the file.