=====================[PART 1 (Setup)]==========================
Step 1: Goto folder where your hybris file downloaded
Step 2: Extract 'CXCOMM190500P_0-70004140.zip' using 7zip and use option 'Extract Files'
and provide path as 'C:\HybrisUC'
- >Unzipp and Place 'b2c_developer' shared by trainer in c:\HybrisUC\installer\recipes
Step 3: Open command prompt as admin
Step 4: Navigate to c:\HybrisUC\installer
Step 5: install.bat -r b2c_developer -A initAdminPassword=admin@123
Step 6: Navigate to c:\HybrisUC\hybris\bin\platform
- > cd c:\HybrisUC\hybris\bin\platform
Step 7: **Create a module called 'yourstanmay'
- > Go to c:\HybrisUC\hybris\bin\platform and execute 'setantenv.bat'
- > ant modulegen
- > template? No need provide input , just press enter
- > name? yourstanmay
- > package?my.yourstanmay
**Above command generates 7 extensions here c:\HybrisUC\hybris\bin\custom\yourstanmay
yourstanmaycore
yourstanmaybackoffice
yourstanmaytest
yourstanmayfulfilmentprocess
yourstanmayfacades
yourstanmaystorefront
yourstanmayinitialdata
Step 8: To make above extensions to be part of next build [ant all] we need enter these extension
names in a file'localextensions.xml'
Goto c:\HybrisUC\hybris\config to edit 'localextensions.xml'
Comment or Remove following entries:
<extension name='yacceleratorbackoffice' />
<extension name='yacceleratorinitialdata' />
<extension name='yacceleratorfulfilmentprocess' />
<extension name='yacceleratorstorefront' />
Write your 'yourstanmay' extensions at the bottom of the file within 'extensions' closing tag
<!-- yourstanmay Specific Extensions -->
<extension name='yourstanmayfulfilmentprocess'/>
<extension name='yourstanmaycore'/>
<extension name='yourstanmayinitialdata'/>
<extension name='yourstanmayfacades'/>
<extension name='yourstanmaybackoffice'/>
<extension name='yourstanmaystorefront'/>
Note : Please do not include 'yourstanmaytest' in the above list
Save the file
Step 9: Go to command prompt and trigger the following command
- > ant all initialize
(**It will take time keep patience)
Step 10: **Import the Setup in Spring Tool Suit
(i)Run Spring tool as Administration
(ii)Create a new WorkSpace HybrisUC
(iii)Install ACN hybris Plugins (optional-: If Plugins install already then ignore this step)
->Go to file where your spring application is Setup
->Download the plugins and Extract it (link mention above)
->Go to plugins folder and past the 3 plugins which you have downloaded.
->Restart the Spring Tools.
(iv) Click on file- >import- >ACN hybris- >import ACN Hybris Platform
(v) click on Browse
and choose c:\HybrisUC\hybris\bin\platform
click on Finish
Step 11: - >hybrisserver.bat
(login to hac- >platform- >extension and search your extension )
(Note-: If you get Wrapper Stop error then run the below command
-> license.bat -temp CPS_SQL )
**In CMD Press Cntrl+c then y to Close the server
===============================================================
========================[Part 2 (Data Modeling)]==========================================
Step 12: In spring tool go to yourstanmaycore/resource/yourstanmaycore-items.xml
Step 13: <!-- ****************Collectiontype***************************** -->
<collectiontype code="skillList" elementtype="java.lang.String" autocreate="true" generate="false" type="list"/>
<!-- *************************************************************************** -->
<!-- *************************Enum***************************** -->
<enumtype code="projectEnum" generate="true" autocreate="true" dynamic="true" >
<description >project </description >
<value code="HandM"/>
<value code="FS"/>
<value code="PRD"/>
<value code="CMT"/>
<value code="Digital"/>
<value code="Bench"/>
</enumtype >
<!-- *************************************************************************** -->
<!-- *************************Relations***************************** -->
<relations >
<!-- One to Many Relationship b/w training and trainee -->
<relation code="TrainingTraineeRelation" localized="false" autocreate="true" generate="true" >
<sourceElement qualifier="training" type="Training" cardinality="one" ordered="false" >
<modifiers read="true" write="true" search="true" optional="true"/>
</sourceElement >
<targetElement qualifier="trainee" type="Trainee" cardinality="many" ordered="false" >
<modifiers read="true" write="true" search="true" optional="true"/>
</targetElement >
</relation >
</relations >
<!-- *************************************************************************** -->
<!-- **********************Creating type group************************************ -->
<typegroup name="Accenture" >
<!-- Creating Training item -->
<itemtype code="Training" extends="Product" autocreate="true" generate="true" >
<description >Training </description >
<deployment table="Training" typecode="20000" />
<attributes >
<attribute qualifier="title" type="java.lang.String" >
<persistence type="property" />
</attribute >
<attribute qualifier="lct" type="java.lang.Boolean" >
<modifiers optional="false" />
<persistence type="property" />
</attribute >
<attribute qualifier="duration" type="java.lang.Integer" >
<modifiers optional="false" />
<persistence type="property" />
</attribute >
</attributes >
</itemtype >
<!-- Creating Trainee item -->
<itemtype code="Trainee" autocreate="true" generate="true" >
<description >Trainee </description >
<deployment table="Trainee" typecode="20001" />
<attributes >
<attribute qualifier="project" type="projectEnum" >
<modifiers optional="false" />
<persistence type="property" />
</attribute >
<attribute qualifier="skill" type="skillList" >
<modifiers optional="true" />
<persistence type="property" />
</attribute >
<attribute qualifier="doj" type="java.util.date" >
<modifiers optional="true" />
<persistence type="property" />
</attribute >
<attribute qualifier="experience" type="java.lang.Integer" >
<modifiers optional="true" />
<persistence type="dynamic" attributeHandler="TraineeExperience" />
</attribute >
</attributes >
</itemtype >
</typegroup >
<!-- *************************************************************************************************** -->
============================================[Part 3 (localization)]======================================
Step 14: Goto yourstanmaycore/resource/localization/yourstanmaycore-locales_en.properties
#Training
type.Training.title.name=Title
type.Training.lct.name=LCT
type.Training.duration.name=Duration
#Trainee
type.Trainee.project.name=Project
type.Trainee.skill.name=Skills
type.Trainee.doj.name=DOJ
type.Trainee.experience.name=Experience
================================================================================================================
=========================================[Part 4 (config.xml)]============================================
Step 15: Goto yourstanmaybackoffice/resource/yourstanmaybackoffice-backoffice-config.xml
<!-- yourstanmay Customization -->
<context component="explorer-tree" merge-by="module" >
<n:explorer-tree
xmlns:n="http://www.hybris.com/cockpitng/config/explorertree" >
<n:navigation-node id="Youstanmay" >
<n:type-node id="Training" code="Training" />
<n:type-node id="Trainee" code="Trainee" />
</n:navigation-node >
</n:explorer-tree >
</context >
<context component="create-wizard" type="Training" >
<wz:flow id="Training" xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config" title="create.title(ctx.TYPE_CODE)" >
<wz:handler handlerId="customDoneHandler" handlerBean="productMediaComposedFlowActionHandler" >
<wz:additionalParams key="handler:savePicture" value="mediaReferenceCreateHandler" />
<wz:additionalParams key="savePicture:mediaProperty" value="newProduct.picture" />
<wz:additionalParams key="savePicture:saveParentObject" value="true" />
<wz:additionalParams key="savePicture:mediaContentProperty" value="createProductPicture" />
<wz:additionalParams key="savePicture:mediaCodeExpression" value="newProduct.code+'_picture'" />
<wz:additionalParams key="savePicture:catalogVersionProperty" value="newProduct.catalogVersion" />
<wz:additionalParams key="savePicture:throwExceptionsOnError" value="true" />
<wz:additionalParams key="handler:saveThumbnail" value="mediaReferenceCreateHandler" />
<wz:additionalParams key="saveThumbnail:mediaProperty" value="newProduct.thumbnail" />
<wz:additionalParams key="saveThumbnail:saveParentObject" value="true" />
<wz:additionalParams key="saveThumbnail:mediaContentProperty" value="createProductThumbnail" />
<wz:additionalParams key="saveThumbnail:mediaCodeExpression" value="newProduct.code+'_thumbnail'" />
<wz:additionalParams key="saveThumbnail:catalogVersionProperty" value="newProduct.catalogVersion" />
<wz:additionalParams key="saveThumbnail:throwExceptionsOnError" value="true" />
<wz:additionalParams key="handler:saveLogos" value="multiMediaReferenceCreateHandler" />
<wz:additionalParams key="saveLogos:mediaProperty" value="newProduct.logo" />
<wz:additionalParams key="saveLogos:saveParentObject" value="true" />
<wz:additionalParams key="saveLogos:mediaContentProperty" value="createProductLogos" />
<wz:additionalParams key="saveLogos:mediaCodeExpression" value="newProduct.code+'_logo#'" />
<wz:additionalParams key="saveLogos:catalogVersionProperty" value="newProduct.catalogVersion" />
<wz:additionalParams key="saveLogos:throwExceptionsOnError" value="true" />
<wz:additionalParams key="saveLogos:append" value="true" />
</wz:handler >
<wz:prepare id="productPrepare" >
<wz:initialize property="newProduct" type="ctx.TYPE_CODE"/>
<wz:assign property="newProduct.code" value="ctx.code"/>
<wz:assign property="newProduct.code" value="ctx?.actionContext?.code"/>
<wz:assign property="newProduct.catalogVersion" value="ctx.catalogVersion"/>
<wz:assign property="newProduct.catalogVersion" value="ctx?.actionContext?.catalogVersion"/>
<wz:assign property="newProduct.supercategories" value="T(com.hybris.cockpitng.util.ListJoiner).join(newProduct.supercategories, ctx?.actionContext?.supercategories)"/>
</wz:prepare >
<wz:step id="step1" label="create.product.essential.label" sublabel="create.product.essential.sublabel" >
<wz:content id="step1.content" >
<wz:property-list root="newProduct" >
<wz:property qualifier="code" type="java.lang.String"/>
<wz:property qualifier="approvalStatus"/>
<wz:property qualifier="catalogVersion"/>
</wz:property-list >
</wz:content >
<wz:navigation id="step1.navigation" >
<wz:cancel >
<wz:revert property="newProduct.picture" />
<wz:revert property="newProduct.thumbnail" />
<wz:revert property="newProduct.logo" />
<wz:revert property="newProduct" />
</wz:cancel >
<wz:next visible="!#empty(newProduct.code) and newProduct.catalogVersion != null"/>
<wz:custom visible="!#empty(newProduct.code) and newProduct.catalogVersion != null" label="com.hybris.cockpitng.widgets.configurableflow.flow.done"
composedHandler="customDoneHandler" >
<wz:save property="newProduct"/>
</wz:custom >
</wz:navigation >
</wz:step >
<wz:step id="step2" label="create.product.descriptions.label"
sublabel="create.product.descriptions.sublabel" >
<wz:content id="step2.content" >
<wz:property-list root="newProduct" >
<wz:property qualifier="name" type="java.lang.String"/>
<wz:property editor="com.hybris.cockpitng.editor.localized(com.hybris.cockpitng.editor.wysiwyg)"
qualifier="description" type="java.lang.String"/>
<wz:property qualifier="title" type="java.lang.String"/>
<wz:property qualifier="lct" type="java.lang.Boolean"/>
<wz:property qualifier="duration" type="java.lang.Integer" />
</wz:property-list >
</wz:content >
<wz:navigation id="step2.navigation" >
<wz:cancel >
<wz:revert property="newProduct.picture" />
<wz:revert property="newProduct.thumbnail" />
<wz:revert property="newProduct.logo" />
<wz:revert property="newProduct" />
</wz:cancel >
<wz:back/>
<wz:next/>
<wz:custom label="com.hybris.cockpitng.widgets.configurableflow.flow.done" composedHandler="customDoneHandler" >
<wz:save property="newProduct"/>
</wz:custom >
</wz:navigation >
</wz:step >
<wz:step id="step3" label="create.product.categories.label" sublabel="create.product.categories.sublabel" >
<wz:info label="create.product.categories.info.label" position="top"/>
<wz:content id="step3.content" >
<wz:property qualifier="newProduct.supercategories"/>
</wz:content >
<wz:navigation id="step3.navigation" >
<wz:cancel >
<wz:revert property="newProduct.picture" />
<wz:revert property="newProduct.thumbnail" />
<wz:revert property="newProduct.logo" />
<wz:revert property="newProduct" />
</wz:cancel >
<wz:back/>
<wz:next/>
<wz:custom label="com.hybris.cockpitng.widgets.configurableflow.flow.done" composedHandler="customDoneHandler" >
<wz:save property="newProduct"/>
</wz:custom >
</wz:navigation >
</wz:step >
<wz:step id="step4" label="create.product.media.label" sublabel="create.product.media.sublabel" >
<wz:info label="create.product.media.info.label" position="top"/>
<wz:content id="step4.content" >
<wz:property qualifier="newProduct.picture" validate="false"/>
<wz:property qualifier="createProductPicture" type="com.hybris.cockpitng.editor.defaultfileupload.FileUploadResult" editor="com.hybris.cockpitng.editor.dndfileupload" validate="false" >
<wz:editor-parameter >
<wz:name >accept </wz:name >
<wz:value >image/* </wz:value >
</wz:editor-parameter >
<wz:editor-parameter >
<wz:name >singleLineMode </wz:name >
<wz:value >true </wz:value >
</wz:editor-parameter >
</wz:property >
<wz:property qualifier="newProduct.thumbnail" validate="false"/>
<wz:property qualifier="createProductThumbnail" type="com.hybris.cockpitng.editor.defaultfileupload.FileUploadResult" editor="com.hybris.cockpitng.editor.dndfileupload" validate="false" >
<wz:editor-parameter >
<wz:name >accept </wz:name >
<wz:value >image/* </wz:value >
</wz:editor-parameter >
<wz:editor-parameter >
<wz:name >singleLineMode </wz:name >
<wz:value >true </wz:value >
</wz:editor-parameter >
</wz:property >
<wz:property qualifier="newProduct.logo" validate="false"/>
<wz:property qualifier="createProductLogos" type="java.util.Collection" editor="com.hybris.cockpitng.editor.multidndfileupload" validate="false" >
<wz:editor-parameter >
<wz:name >accept </wz:name >
<wz:value >image/* </wz:value >
</wz:editor-parameter >
<wz:editor-parameter >
<wz:name >singleLineMode </wz:name >
<wz:value >true </wz:value >
</wz:editor-parameter >
</wz:property >
</wz:content >
<wz:navigation id="step4.navigation" >
<wz:cancel >
<wz:revert property="newProduct.picture" />
<wz:revert property="newProduct.thumbnail" />
<wz:revert property="newProduct.logo" />
<wz:revert property="newProduct" />
</wz:cancel >
<wz:back/>
<wz:custom label="com.hybris.cockpitng.widgets.configurableflow.flow.done" composedHandler="customDoneHandler" >
<wz:save property="newProduct"/>
</wz:custom >
</wz:navigation >
</wz:step >
</wz:flow >
</context >
<!-- <context type="Training" component="listview" >
<list:list-view
xmlns:list="http://www.hybris.com/cockpitng/component/listView" >
<list:column qualifier="title" />
<list:column qualifier="lct" />
<list:column qualifier="duration" />
</list:list-view >
</context > -->
<context type="Trainee" component="listview" >
<list:list-view
xmlns:list="http://www.hybris.com/cockpitng/component/listView" >
<list:column qualifier="project" />
<list:column qualifier="skill" />
<list:column qualifier="doj" />
<list:column qualifier="experience" />
</list:list-view >
</context >
/* ==================================================================================================================================== */
===============================================[Part 5 Dynamic Attribute]================================================
=========================================================================================================================
Step 16: Go to yourstanmaycore/src/
- >create new package "my.yourstanmay.core.attributes"
- >create a new class "TraineeExperienceHandler"
******************************************************************************************
package my.yourstanmay.core.attributes;
import de.hybris.platform.servicelayer.model.attribute.AbstractDynamicAttributeHandler;
import java.util.Calendar;
import java.util.Date;
import my.yourstanmay.core.model.TraineeModel;
/**
* author : tanmay.chowdhury
*/
public class TraineeExperienceHandler extends AbstractDynamicAttributeHandler <Integer, TraineeModel >
{
@Override
public Integer get(final TraineeModel model)
{
int TraineeExperience = 0;
try
{
final Date traineeRegisteredDate = model.getDoj();
final Calendar cal = Calendar.getInstance();
cal.setTime(traineeRegisteredDate);
final int registeredYear = cal.get(Calendar.YEAR);
final int currentYear = Calendar.getInstance().get(Calendar.YEAR);
TraineeExperience = currentYear - registeredYear;
}
catch (final Exception e)
{
e.printStackTrace();
}
return TraineeExperience;
}
}
*************************************************************************************************
Step 17: Go to "yourstanmaycore/resource/yourstanmaycore-spring.xml"
<bean id="TraineeExperience"
class="my.yourstanmay.core.attributes.TraineeExperienceHandler"/>
Step 18: Go to Comand prompt
- >ant all
Step 19: Run Server and open hac
- > In hac go to platform/update and click on update
**It will take few minute to update
- > Open backoffice and check your model
===============================================================================================================================
Impex
# ImpEx for Importing Products
$productCatalog=trainingProductCatalog
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
$supercategories=supercategories(code, $catalogVersion)
$approved=approvalstatus(code)[default='approved']
$lang=en
# Insert Book
INSERT_UPDATE training;code[unique=true];name[lang=$lang];$supercategories;$approved;$catalogVersion;Title;LCT;Duration;
;7942944779;Tanmay;;;;Hybris;true;12;
------------------------------------------------------------------------------------
# ImpEx for Importing classification attributes
$productCatalog=trainingProductCatalog
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
$clAttrModifiers=system='trgclassification',version='1.0',translator=de.hybris.platform.catalog.jalo.classification.impex.ClassificationAttributeTranslator,lang=en
# Insert attribute values
UPDATE training;code[unique=true];@cost[$clAttrModifiers];@mode[$clAttrModifiers];
;7942944779;122100;Blended
=========================================================================
=============================================================================================================================