Wednesday, October 9, 2013

Creating Assets in management center and displaying in front end.


Steps in CMC:
1. Go to Assets menu and select the appropriate stores.
2. Create a file, make sure to give a exten (.pdf, jpg), even in the name.
3. Go to Attachment selection inside Asset Menu, Create a attachment, the name given in attachment, can be used in the front end for links.
4. Go to Catalog menu and select a store and create a category inside master catalog categories and reference the attachments created in step 3.

Extended CategoryDataBean:
public void populate() throws Exception{
Enumeration categoriesEnum=CatalogGroupCache.findByIdentifierAndStore(this.getCatIdentifier(),this.getCommandContext().getStoreId());
if (categoriesEnum.hasMoreElements()) {
CachedCatalogGroupAccessBean cgpCached= (CachedCatalogGroupAccessBean) categoriesEnum.nextElement();
catGroupId=cgpCached.getCatalogGroupReferenceNumber();
}
super.setCategoryId(catGroupId);
super.populate(); }

JSP Code:

<wcbase:useBean id="documentsCategory" classname="com.custom.commerce.catalog.beans.EXTCategoryDataBean" >
<c:set property="catIdentifier" value="documents" target="${documentsCategory}" />
</wcbase:useBean>

<c:set var="allAttachemnts" value="${mediaDownloadsCategory.allAttachments}" />
<c:if test="${!empty allAttachemnts}">
<c:forEach items="${allAttachemnts}" var="attachmentDB" varStatus="status">
<c:forEach items="${attachmentDB.attachmentAssets}" var="attachmentAssets" varStatus="status">
<c:if test="${fn:indexOf(attachmentAssets.attachmentAssetPath,'PDF_') > 0 }">
<a href="${hostPath}${attachmentAssets.objectPath}${attachmentAssets.attachmentAssetPath}"><c:out value="${attachmentDB.fileName}"/></a>
</c:if>
<c:if test="${fn:indexOf(attachmentAssets.attachmentAssetPath,'DOCUMENT_') > 0 }">
<div class="image"><img border="0" src="${hostPath}${attachmentAssets.objectPath}${attachmentAssets.attachmentAssetPath}"/></div>
</c:if>
</c:forEach>
</br>
</c:forEach>
</c:if>


Content Assets upload settings in wc-server.xml: Can change the number of files and the interval.

<ManagedFileUpdateEARConfiguration display="false">
        <ContentManagedFileEARUpdate Implementation="com.ibm.commerce.filepublish.util.ContentManagedFileEARUpdateImpl"/>
        <ContentManagedFileHandler Implementation="com.ibm.commerce.filepublish.util.ContentManagedFileHandlerImpl"/>
        <ProductionServerInformation applicationName="WC_demo"/>
        <ModuleInformation moduleName="Stores.war"/>
        <EvaluationCriteria minNumOfFilesForUpdate="4" minSecFromLastUpload="300"/>
    </ManagedFileUpdateEARConfiguration>


3 comments:

  1. Make sure you use internet explorer for Asset Tool.

    ReplyDelete
  2. Binary.com searching for talented and motivated front end developers who are looking for a chance to excel. front end developers

    ReplyDelete