Common Product Add-on

Installation of Spurtcommerce common product for Vendor Products Add-On

you can install this Add-on through following steps

step 1: Setup an API (Step By Step) to add extension for admin

step 2: Admin setup

step 3: you can easily install admin storefront with store setup. spurtcommerce provides 3 admin storefronts, built with Angular, Flutter and React.

Along with the above steps you need to further follow these steps below to install this Add-on for Multi-vendor platform

step 4: Setup an API (Step By Step) to add extension for multi vendor

step 5 : Multi Vendor front end setup

step 6: you can easily install vendor storefront with store setup. spurtcommerce provides 3 vendor storefronts, built with Angular, Flutter and React.

About Addon :

The installation of Common Product addon will allow the Admin to convert a particular product, either their own or any vendor's as a common product, which means any vendor on the portal can sell the same product, by just updating the price at which they want to sell the product and the quantity they have of that product.

Features

  • Make any product from your entire product list, a common product, by just enabing the toggle.

  • You can make admin products as well as Vendor products, the common product that will be available for all the vendors to sell on the online portal.

  • The vendor can sell any product that is available on the list of common products, by simply updating the price and the quantity that they have.

  • The Product detail page of a common product, will display the common products, along with the vendor's name and their price.

  • The product detail page will show the list of all the vendors that are selling the same product.

For setting up the API, you need to execute the following steps:

  • Installing an extension

  • Run the application

  • Make the build

Step 1 : Installing an extension

These are the steps that need to be executed for installation of the extension.

Usually spurcommerce comes packed in a zip, whose name ends in "commonproduct-addOn.zip". Extract the zip file, open api folder and open addon folder within that and copy the content of addon folder into the specified path.

Path - <PROJECT_ROOT>/addon

Step 2 : Run the application

After you have completed the installation of the above mentioned steps, you can run the application and also view the changes.

$ npm start serve

Once you execute the above command, add-on file will get integrated into the backend API.

Step 3 : Make the build

These are the steps that need to be followed for generating the build.

To run the below command

$ npm run build

Then latest built files can be deployed into the server.

Admin Setup

These are the steps that need to be followed to do the front end admin setup.

  • Installing an extension

  • Update the configuration

  • Module Detail

  • Run the application

  • Make the build

Step 1 : Installing an extension

These are the steps that need to be executed for installation of the extension.

Usually spurcommerce comes packed in a zip, whose name ends in "commonproducts.addOn.zip".

Extract the zip file and copy the content of admin/add-ons folder into the specified path

Path - admin/add-ons

Step 2 : Update the configuration

After the installation of the extension, you will have to update certain configurations into the default Spurtcommerce config files. For this, you need to follow the steps below.

Update Reducer Config

  1. Import below line into the add-ons/add-ons-reducer.ts

 import * as fromCommonCatalog from 
 '../add-ons/marketplace/common-product/core/common-catalog/reducer/common-catalog.reducer';

Add the reducer into the below object

commonCatalog:fromCommonCatalog.reducer,

After adding its looks like below

export const AddOnReducers: ActionReducerMap<State> = {

commonCatalog: fromCommonCatalog.reducer

};

Update State Config

Import below line into the add-ons/add-ons-state.ts

import { commonCatalogState } from
 '../add-ons/marketplace/common-product/core/common-catalog/reducer/common-catalog.state'

Add the state into the below object

commonCatalog: commonCatalogState

3) After adding its looks like below

export interface AddOnAppState {

commonCatalog: commonCatalogState

}

Step 3 : Change the routing file(catalog.routing.ts)

Inside the src/theme/default/admin/marketplace/components/manage-products/manage-products.routing.ts

  1. Import below line

   import * as marketplaceRouting from 
   '../../../../../../../add-ons/marketplace/marketplace.routing';
  1. Add these routes below the cmsRoutes array

        manageProductsRoute.forEach(data => {
  if (data) {
manageProductsRoute.
push(marketplaceRouting.commonCatalogRoutes[0]);
              }
});

Add this line to keep the header tab

src/theme/default/admin/marketplace/components/header/header.component.html

Below line no:46

 <li>
                        <a href="#" [routerLink]="['/vendors/manage-products/common_catalog']" [routerLinkActive]="'active'">
                              common products
                        </a>
                    </li>

Step 4 : Run the application

After you have completed the installation of the above mentioned steps, you can run the application and also view the changes.

 npm run large-serve

Once you execute the above command, add-on file will get integrated into the backend API.

Step 5: Make the build

These are the steps that need to be followed for generating the build.

To run the below command

 npm run large-build

Then latest built files can be deployed into the server.

These are the steps that need to be followed to do the front end vendor setup.

● Installing an extension

● Update the configuration

● Module Detail

● Run the application

● Make the build

Step 1 : Installing an extension

Usually spurcommerce comes packed in a zip, whose name ends in "common-product-addOn.zip".

Extract the zip file and copy the content of vendor/add-ons folder into the specified path

Path - vendor/add-ons

Step 2 : Update the configuration

After the installation of the extension, you will have to update certain configurations into the default Spurtcommerce config files. For this, you need to follow the steps below.

Update Reducer Config

1) Import below line into the add-ons/add-ons-reducer.ts

  import *as fromCommonProduct from 
  '../add-ons/CommonProduct/core/reducer/CommonProducts.reducer'

2) Add the reducer into the below object

         commonProducts:fromCommonProduct.reducer,
             

3) After adding its looks like below

export const AddOnReducers: ActionReducerMap<State> = {

commonProducts:fromCommonProduct.reducer,

};

Update State Config add-ons/add-ons-state.ts

import { commonProductsState } from
'../add-ons/CommonProduct/core/reducer/CommonProducts.state';

1) Add the state into the below object

 commonProducts:commonProductsState,

2) After adding its looks like below

export interface AddOnAppState {

commonProductst:commonProductsState,

}

Update Effect Config

1) Import below line into the add-ons/add-ons.effect.ts

           import { commonProductsEffect } from 
           "./CommonProduct/core/effects/CommonProducts.effect";

2) Add the effect into the below object

  commonProductsEffect

3) After adding its looks like below

export const ADD_ON_EFFECT = [

commonProductsEffect

];

Update Component Config

import { CommonProductComponent } from
 "./CommonProduct/template/common-product/common-product.component";
 

1) Add the following components into the below object

 CommonProductComponent                                 

2) After adding its looks like below

export const ADD_ON_COMPONENTS = [

CommonProductComponent

]

Step 3 : Module Detail

Routing

In src/app/default/pages/component/calalog/manage-product/manage-product.module

1) Import below line

 import { CommonProductComponent } from 
 '../../../../../../../add-ons/CommonProduct/template/common-product/common-product.component';

2) Add these routes below the Routes array

{
           path: 'common-product',
           component: CommonProductComponent,
           data: {
               title: 'Common Product',
               urls: [{ title: 'Home', url: '/dashboard' }, { title: 'Products', url: '/common/product' }, { title: 'common product' }]
           }
         },         

Add this line to keep the header tab

src/app/default/pages/component/catalog/layout/products.component.html

Below line no:20

<a href="#" [routerLink]="['/catalog/manage-products/common-product']" class="">Common Products</a>

Step 4 : Run the application

After you have integrated the ProductVariant Module into Spurtcommerce, you can use the following command to run the application.

 ng serve

Once you execute the above command you can view the installed module in Spurtcommerce, within the page in which you have integrated.

Step 5 : Make the build

To run the below command

  ng build - -prod

Then the latest built files can be deployed into the server.

These are the steps that need to be followed to do the front end store setup.

  • Installing an extension

  • Update the configuration

  • Module Detail

  • Run the application

  • Make the build

Step 1 : Installing an extension

Note

Make sure your application is running on the device or simulator, or it will not show up in the list.

These are the steps that need to be executed for installation of the extension.

Usually spurcommerce comes packed in a zip, whose name ends in "commonproducts.addOn.zip".

Extract the zip file and copy the content of store-angular/add-ons folder into the specified path

Path - store-angular/add-ons

Step 2 : Update the configuration

After the installation of the extension, you will have to update certain configurations into the default Spurtcommerce config files. For this, you need to follow the steps below.

Update Reducer Config

  • Import below line into the add-ons/add-ons-reducer.ts

import * as fromCommonProducts from 
  './CommonProducts/core/reducer/common-products.reducer';  

  • Add the reducer into the below object

commonProducts: fromCommonProducts.reducer,

  • After adding its looks like below

export const AddOnReducers: ActionReducerMap<State> = {

commonProducts: fromCommonProducts.reducer,

}

Update State Config

  • Import below line into the add-ons/add-ons-state.ts

   import { commonProductsState } from       
       './CommonProduct/core/reducer/CommonProducts.state';
  • Add the state into the below object

commonProducts:commonProductState

  • After adding its looks like below

export interface AddOnAppState {

commonProducts:commonProductState

}

Update Effect Config

  • Import below line into the add-ons/add-ons.effect.ts

 import { CommonProductEffect } from              
  './CommonProducts/core/effects/common-products.effect';

  • Add the effect into the below object

commonProductsEffect

  • After adding its looks like below

export const ADD_ON_EFFECT = [ commonProductsEffect ];

Update Component Config

  • Import below line into the add-ons/add-ons.shared.component

      import { ViewProductsComponent } from 
      './CommonProducts/template/view-products/view-products.component';
     import { CommonproductsComponent } from 
     './CommonProducts/template/common-products/common-products.component';

     
  • Add the following components into the below object

ViewProductsComponent,

CommonproductsComponent

  • After adding its looks like below

export const ADD_ON_COMPONENTS = [

ViewProductsComponent,

CommonproductsComponent

];

Step 3 : Component Detail

The modules pertaining to viewproducts and commonproducts are listed below. You may use these modules, in any page of Spurtcommerce.

Also, you can find the steps below to use the modules in ViewProducts and CommonProducts in Spurtcommerce pages.

In the CommonProducts addon having two components.

  1. ViewProductsComponent

  2. CommonproductsComponent

ViewProductsComponent

Directive

<app-spurt-view-products [productId]="(productDetail.productDetails$ | async)?.productId" [productSlug]="(productDetail.productDetails$|async)?.productSlug"></app-spurt-view-products>

In the above directive have one input field

ProductId:number;

Productslug:any;

CommonProductsComponent

This is a one page component. You can configure the route for this component.

This component only works with productslug,because after clicking sellers in productdetail page it redirects to the commonproducts component.

Syntax:
  {
 path: 'common-products/:id',
 component: CommonproductsComponent,
 pathMatch: 'full',
    data: {
          urls: [
          { title: 'Products', url: '/products' },
          { title: 'Product detail', url: '' }
                                                        ] } }

Step 4 : Run the application

After you have integrated the Common Product Module into Spurtcommerce, you can use the following command to run the application.

ng serve

Once you execute the above command you can view the installed module in Spurtcommerce, within the page in which you have integrated.

Step 5 : Make the build

To run the below command

ng build –prod

Then the latest built files can be deployed into the server.

Last updated