Implement OrderReturn Feature In Broadleaf - ST 2024
Implement OrderReturn Feature In Broadleaf
Recently we came across the requirement where we need to implement order return module on broadleaf framework as broadleaf community edition doesn’t provide it out of the box.
Order Return functionality implementation :
Step : 1 - Create new custom entity for Order Return
Step : 2 - Order Return functionality implementation
Step : 1 - Create new custom entity for Order Return functionality using below steps :
First, create the new class named OrderReturn.
Create required fields as mentioned in diagram for above created entity.
Build your project after following above steps.
Now OrderReturn table will be created in your database.
- Set below properties in development properties file(path : site/src/main/resources/runtime-properties/development.properties)
blPU.hibernate.hbm2ddl.auto=update
blEventPU.hibernate.hbm2ddl.auto=update
blSecurePU.hibernate.hbm2ddl.auto=update
blEventPU.hibernate.hbm2ddl.auto=update
- Create new entity in broadleafcommerce.
Step : 2 - Order Return functionality implementation :
You need to create required interfaces, classes, HTML files, and entity. Below are the steps to create it.
Create new orderReturn.html file.
Edit orderHistory.html file in a way that you can redirect to orderReturn form.
Create required classes and interfaces to handle behavior/state of the Order Return functionality.
Create a new controller to handle all the request/response for order return functionality.
- For example, when the user submits the Order Return form then pass filled information into the controller and then persist it. After then send an email to the user.
Now add below lines in applicationContext.xml file to scan your package.
<context:component-scan base-package="com.st.broadleaf.ordereturn"/> <context:component-scan base-package="com.st.broadleaf.controller.OrderReturn"/>
Now add below lines in applicationContext-entity.xml file to load your bean class.
<bean id="com.st.broadleaf.controller.OrderReturn" class="com.st.broadleaf.ordereturn.OrderReturnImpl" scope="prototype"/>
- Implement order return in broadleafcommerce.
- Your Broadleafcommerce project structure should look like below after implementing Order Return functionality.
core
src/main/java
com.st.broadleaf.ordereturn
OrderRerurn(Interface)
OrderReturnImpl(class)
ChangeOrderStatus(class)
CustomOrderStatus(class)
OrderReturnForm(class)
com.st.broadleaf.dao.ordereturn
OrderRetuenDao(Interface)
OrderReturnDaoImpl(class)
com.st.broadleaf.service.ordereturn
OrderReturnService(Interface)
OrderReturnSeriviceImpl(class)
site
Java Resources
src/main/java
com.st.broadleaf.controller.ordereturn
- OrderReturnController(class)
For Your Business Requirements
2 - 4 October 2024
Hall: 10, Booth: #B8 Brussels, Belgium