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>


7 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
  3. No es lo que estaba buscando ahora mismo, pero el post me ha llamado bastante la atención ya que te cuenta cosas interesantes que pueden ser útiles, encima se nota que le has puesto mucho esfuerzo ¡felicidades

    ReplyDelete
  4. Que buen blog tenéis, me encanta leer todos vuestros artículos es de los mejores blog. Además son super útiles y claros.

    ReplyDelete
  5. Es un blog muy interesante, me ha gustado mucho leerlo, ya que puede ser algo de gran utilidad para poner en práctica.

    ReplyDelete