Introducing a New AIF Section
You must make your new AddOn dependent on the assistedservicefacades extension.
Context
Procedure
- Locate your new AddOn's extensioninfo.xml file and paste the code below. This adds the required extensions and dependencies.
<extensioninfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="extensioninfo.xsd"> <extension abstractclassprefix="Generated" classprefix="Aifwcms360addon" description="aifwcms360addon extension" managername="Aifwcms360addonManager" managersuperclass="de.hybris.platform.jalo.extension.Extension" name="aifwcms360addon"> <!-- you should add all required extensions to this list, except platform extensions which are automatically required --> <requires-extension name="addonsupport"/> <!-- newly introduced dependency --> <requires-extension name="assistedservicefacades"/> <coremodule generated="true" manager="de.hybris.aifwcms360addon.jalo.Aifwcms360addonManager" packageroot="de.hybris.aifwcms360addon"/> <meta key="classpathgen" value="false"/> </extension> </extensioninfo> - Locate your new AddOn's aifwcms460addon-spring.xml file and introduce a new section, fragment, and a JSP renderer as shown in the code below.
For more information about sections and fragments, see the ASM Additional Information Framework Architecture document.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:annotation-config/> <bean id="aifwcms360addonCoreDataImportedEventListener" parent="abstractCoreDataImportedEventListener"> <property name="supportedChannels"> <list value-type="de.hybris.platform.commerceservices.enums.SiteChannel"> <value>B2C</value> <!-- <value>B2B</value> --> </list> </property> <property name="addonExtensionMetadata"> <bean class="de.hybris.platform.addonsupport.data.AddonExtensionMetadata"> <property name="suffixChannel" value="false"/> <property name="baseExtensionName" value="aifwcms360addon"/> </bean> </property> </bean> <bean id="aifwcms360addonSampleDataEventListener" parent="abstractGenericAddOnSampleDataEventListener" > <property name="extensionName" value="aifwcms360addon" /> </bean> <bean id="wcmsCustomer360DetailsSection" class="de.hybris.platform.assistedservicefacades.customer360.Section"> <property name="title" value="wcms.customer360.heading" /> <property name="id" value="wcmsCustomer360DetailsSection" /> <property name="fragments" ref="wcmsCustomer360Fragments" /> </bean> <bean id="defaultWCMSCustomer360CustomerDetailsSectionMergeDirective" depends-on="customer360Sections" parent="listMergeDirective" > <property name="add" ref="wcmsCustomer360DetailsSection" /> </bean> <util:list id="wcmsCustomer360Fragments" value-type="de.hybris.platform.assistedservicefacades.customer360.Fragment"> <ref bean="wcmsCustomer360Fragment" /> </util:list> <bean id="wcmsCustomer360Fragment" class="de.hybris.platform.assistedservicefacades.customer360.Fragment"> <property name="id" value="wcmsCustomer360Fragment" /> <property name="title" value="wcms.customer360.fragment.title"/> </bean> </beans> - In the aifwcms460addon-spring.xml file, add the mapping for the page responsible for calling the CMS page as shown in the code below.
<bean depends-on="customer360JspProvidersMap" parent="mapMergeDirective"> <property name="key" value="wcmsCustomer360Fragment" /> <property name="value" value="addon:/aifwcms360addon/cms/wcmsCustomer360Page" /> </bean> - Navigate to the aifwcms360addon/acceleratoraddon/web/webroot/WEB-INF/views/responsive/cms/ directory and create a wcmsCustomer360Page.jsp file there, as shown in the code below.
<%@ page trimDirectiveWhitespaces="true"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> <%@ taglib prefix="theme" tagdir="/WEB-INF/tags/shared/theme"%> <script type="text/javascript"> $.ajax({ url: ACC.config.encodedContextPath + "/my-account/customer360", timeout:5000, type: "GET", success: function(data) { $( "#wcmsCustomerContent").html(data); $.colorbox.resize(); }, error: function(xht, textStatus, ex) { if(textStatus === 'timeout') { $( "#wcmsCustomerContent").html("Widget timeout!"); } else { console.error("Failed to get widget data! %s", ex); $( "#wcmsCustomerContent").html("Faild to get widget data!"); } } }); </script> <div id="wcmsCustomerContent">Loading....</div> - Navigate to the aifwcms360addon/resources/aifwcms360addon/import/cockpits/cmscockpit/structure-view/ContentPageTemplate directory and create a ContentPageTemplateWCMS360Template.vm file as shown in the code below.
If there is no structure-view folder, create it manually.
<div> <table width="100%" cellspacing="0" style="margin:0;padding:0;table-layout:auto;border:1px solid #1E4EBF;"> <tbody> <tr> <td colspan="4" class="structureViewSection"> <cockpit code="BodyContent" /> </td> </tr> </tbody> </table> <div style="width:100%; border-top: 2px solid #bbb" class="cmsContentEditor"> <cockpit code="editor" /> </div> </div> - Navigate to the aifwcms360addon/acceleratoraddon/web/webroot/WEB-INF/views/responsive/pages/layout/ directory and create a contentLayoutWCMS360Page.jsp file there as shown in the code below.
If there is no layout folder, create it manually.
<%@ page trimDirectiveWhitespaces="true" %> <%@ taglib prefix="template" tagdir="/WEB-INF/tags/responsive/template" %> <%@ taglib prefix="cms" uri="http://hybris.com/tld/cmstags" %> <cms:pageSlot position="BodyContent" var="feature"> <cms:component component="${feature}" /> </cms:pageSlot> - Navigate to the aifwcms360addon/acceleratoraddon/web/webroot/WEB-INF/messages/ directory and create a localization base.properties file there, as shown in the code below.
wcms.customer360.heading=Example WCMS Component wcms.customer360.fragment.title=Editable WCMS Component
Related Information