Module overview

What is Polavi module?

Polavi application is a system contains a list of module. Each of them provides a different business feature. For example, the Catalog module manages product, category, and price. The discount module manages coupon code … and so on.

When we need a new feature or we need to customize the current feature, we need to create a module. Polavi module is designed to help the developer can add/customize the default platform easier without overwriting core files.

Basically, Polavi module is a group of Middleware, Router, Event and ReactJs template. It is a folder located in the app\Polavi\src\Module folder. If your module comes with some template (ReactJS), then you can store them in /public/theme/front/default/js/dev. We will explain how Polavi template system work later.

List of Polavi core module

  • Catalog – A module manages product, category attribute, and price
  • Customer – A module manages customer
  • Discount – A module manages coupon code for a discount
  • Checkout – A module manages shopping cart, checkout
  • CMS – A module manages static page and widgets
  • Order – A module manages order
  • Setting – A module manages configuration and setting from backend
  • Tax – A module manages the tax
  • User – A module manages backend user
  • Cod – A module provides cash on the delivery payment method
  • Flatrate – A module provides Flat rate shipping method
  • Graphql – A module provides Graphql API

Polavi module structure

This is how Catalog module look like

Module catalog
Directory/fileRemarks
MiddlewareThis folder contains list of middleware. It may have some sub folders depends on how you organize your module
ProductThis is a sub folder of Middleware, It contains list of middlewares to manage product
EditThis folder contains list of middlewares that will be called when we edit a product
GeneralInfoMiddleware.phpThis is an example of Middleware, It loads product general information for editing
InventoryMiddleware.phpThis is an example of Middleware, It loads product inventory information for editing
GridThis folder contains list of middlewares that will be called when we view product list from admin
ViewThis folder contains list of middlewares that will be called when we view product from front end
DeleteThis folder contains list of middlewares that will be called when we delete a product
SaveThis folder contains list of middlewares that will be called when we save a product
ServicesThis folder contains list of services. Check [here](/docs/development/services) for more information.
Type
ProductType.phpThis a GraphQL type for product.We can have a GraphQL type as a service.
CategoryType.phpThis a GraphQL type for category.We can have a GraphQL type as a service.
ProductCollection.phpThis is an example of a service.
CategoryCollection.phpThis is an example of a service.
...
events.phpThis is where you register your observers. Check here for more information.
migration.phpThis is where you define module version and migration executors. Check here for more information.
routes.phpThis is where you register your routes. Check here for more information.
services.phpThis is where you register your services. Check here for more information.

To understand about how to develop a module, please check this document