1. Create your own business process model.
<itemtype code="ContactUsProcess" extends=" StoreFrontCustomerProcess"
jaloclass="de.hybris.platform. commerceservices.jalo.process. ContactUsProcess"
autocreate="true" generate="true">
<attributes>
<attribute qualifier="information" type="StringCollection">
<persistence type="property" />
</attribute>
<attribute qualifier="industry" type="StringCollection">
<persistence type="property" />
</attribute>
<attribute qualifier="firstName" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="lastName" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="customerEmail" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="phone" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="languageType" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="title" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="companyName" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="line1" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="line2" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="city" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="region" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="postalCode" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="country" type="java.lang.String">
<persistence type="property" />
</attribute>
<attribute qualifier="comment" type="java.lang.String">
<persistence type="property" />
</attribute>
</attributes>
</itemtype>
2. Create Event Class. refer ContactUsEvent.java in zip file. (* don't forget to create bean in *spring.xml)
3. Create Event Lister class. refer ContactUsEventListener.java in zip file. (* don't forget to create bean in *spring.xml)
4. Create Context class. refer ContactUSEmailContext.java in zip file. (* don't forget to create bean in *spring.xml)
5. Create process xml. refer contactUSProcess.xml in zip file.
6. Create bean as follows in *core-spring.xml.
<bean id=" contactUsProcessDefinitionReso urce"
class="de.hybris.platform. processengine.definition. ProcessDefinitionResource">
<property name="resource"
value="classpath:/canselcore/ processes/contactUSProcess. xml" />
</bean>
7. Create bean as follows in *core-spring.xml to use your own email template. (This is used in contactUSProcess.xml)
<bean id="generateContactUsEmail" parent=" abstractGenerateEmailAction">
<property name="frontendTemplateName" value="ContactUSEmailTemplate" />
</bean>
8. Create Email Template as follows.
# Email page Template
INSERT_UPDATE EmailPageTemplate;$contentCV[ unique=true];uid[unique=true]; name;active; frontendTemplateName;subject( code);htmlTemplate(code); restrictedPageTypes(code)
;;ContactUSEmailTemplate; Contact us Email Template;true;contactUSEmail; cansel_Email_contactUS_ Subject;cansel_Email_ contactUS_Body;EmailPage
# Templates for CMS Cockpit Page Edit
UPDATE EmailPageTemplate;$contentCV[ unique=true];uid[unique=true]; velocityTemplate[translator= de.hybris.platform. commerceservices.impex.impl. FileLoaderValueTranslator]
;;ContactUSEmailTemplate;$ jarResourceCms/structure-view/ structure_ subscriptionExpiredEmailTempla te.vm
INSERT_UPDATE ContentSlotForTemplate;$ contentCV[unique=true];uid[ unique=true];position[unique= true];pageTemplate(uid,$ contentCV)[unique=true][ default=' ContactUSEmailTemplate']; contentSlot(uid,$contentCV)[ unique=true];allowOverwrite
;;SiteLogo- ContactUSEmailTemplate; SiteLogo;;SiteLogoSlot;true
;;TopContent- ContactUSEmailTemplate; TopContent;;EmailTopSlot;true
;;BottomContent- ContactUSEmailTemplate; BottomContent;; EmailBottomSlot;true
# Email Pages
INSERT_UPDATE EmailPage;$contentCV[unique= true];uid[unique=true];name; masterTemplate(uid,$contentCV) ;defaultPage;approvalStatus( code)[default='approved']
;;contactUSEmail;Contact Us Email;ContactUSEmailTemplate; true
# Email velocity templates
INSERT_UPDATE RendererTemplate;code[unique= true];contextClass; rendererType(code)[default=' velocity']
;cansel_Email_contactUS_ Subject;$emailPackageName. ContactUSEmailContext
;cansel_Email_contactUS_Body;$ emailPackageName. ContactUSEmailContext
9.
Under email-content_en.impex. update the cansel_Email_contactUS_Subject
& cansel_Email_contactUS_Body with appropriate template script.
# CMS components and Email velocity templates
UPDATE RendererTemplate;code[unique= true];description[lang=$lang]; templateScript[lang=$lang, translator=de.hybris.platform. commerceservices.impex.impl. FileLoaderValueTranslator]
;cansel_Email_contactUS_ Subject;"Contact Us Subject";$emailResource/email- contactUSEmailSubject.vm
;cansel_Email_contactUS_Body;" Contact Us Body";$emailResource/email- contactUSEmailBody.vm
10. Please refer email-contactUSEmailSubject.vm & email-contactUSEmailBody.vm in zip file.
11. Trigger the event from any service class. For instance, You can refer DefaultContactUsService.java in zip file.
You can dowload the zip file from the following link.
No comments:
Post a Comment