Advanced Promotions

Installation of Spurtcommerce Advanced Promotions 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.

About Addon :

The Installation of Spurtcommerce Promotions add-on will enable the feature of creation of various promotions for the admin. When the plugin is installed, the multi-Vendor eCommerce site becomes ready for the admin to post promotions and get them displayed for the visitors to view.

Features

  • You can create promotions such as ‘Hot summer offer’ or ‘Christmas sale’, etc.

  • Easily map certain selected products to the promotions that they create.

  • Also, you may map one whole category for the promotions that they create.

  • provide an attractive title for that promotion. E.g., stylish women deal.

  • Define the position of the promotion for displaying it on the home page.

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 "promotions-addOn.zip".

Extract the zip file and copy the content of api 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.

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 spurtcommerce comes packed in a zip, whose name ends in "promotions.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

Note:

  • In addon folder if already a cms folder exists, Inside cms folder paste Widget-list and Widgets-layout folder. In cms routing file(cms.routing.ts) paste the below code.

export const cmsWidgetRoutes = [
    {
      path: 'widgets',
      loadChildren: () => import('./widgets/template/widget-list/widgets.module').then(m => m.WidgetsModule),
      canActivate: [AuthGuard],
      data: { permissionForHeader: 'cms-widgets', root: 'cms' }
    },
  ];

  • In addon folder if cms folder doesn’t exists. Paste the cms folder in addon.

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.

  1. Update Reducer Config

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

 import * as fromWidgetList from 
  '../addon/cms/widgets/core/widget-reducer/widget.reducer'

2. Add the reducer into the below object

 widgetList: fromWidgetList.reducer

3. After adding its looks like below

export const AddOnReducers: ActionReducerMap<State> = {
     widgetList: fromWidgetList.reducer
};

Update State Config

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

Import {WidgetState}  
   ../addon/cms/widgets/core/widget-reducer/widget.state';
  • Add the state into the below object

     widgetList:WidgetState;
  • After adding its looks like below

export interface AddOnAppState {
   widgetList:WidgetState;
}

Step 3 : Change the routing file(cms.routing.ts) Inside the src/theme/default/admin/cms/cms.routing.ts

  • Import below line

import * as CmsRouting from '../../../../../addon/cms/blogs/cms.routing';
  • Add these routes below the cmsRoutes array

cmsRoutes.forEach(data => {
  if (data && data.children) {
    console.log('data is',data.children);
    data.children.push(CmsRouting.cmsWidgetRoutes[0]);
  }
});

Step 4 : Run the application

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

$ npm run large-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

$ npm run large-build

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

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 "promotions.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 fromWidgetListAndProduct from 
 './WidgetAndProduct/core/reducer/widgetListAndProduct.reducer' 

  • Add the reducer into the below object

 widgetListAndProduct: fromWidgetListAndProduct.reducer
  • After adding its looks like below

 export const AddOnReducers: ActionReducerMap<State> = {
                   widgetListAndProduct: fromWidgetListAndProduct.reducer
                                  }

Update State Config

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

 import { WidgetListAndProductState } from   
 './WidgetAndProduct/core/reducer/widgetListAndProduct.state';
  • Add the state into the below object

        widgetListAndProduct:WidgetListAndProductState
  • After adding its looks like below

      
     export interface AddOnAppState {
                             widgetListAndProduct:WidgetListAndProductState
                           }

Update Effect Config

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

 import { WidgetListAndProductEffect } from                                                       
 './WidgetAndProduct/core/effects/widgetListAndProduct.effect';
  • Add the effect into the below object

 WidgetListAndProductEffect
  • After adding its looks like below

export const ADD_ON_EFFECT = [
    WidgetListAndProductEffect
 ];

Update Component Config

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

import { WidgetProductsComponent } from 
'./WidgetAndProduct/template/widget-products/widget-products.component';
  • Add the following components into the below object

 WidgetProductsComponent
  • After adding its looks like below

 export const ADD_ON_COMPONENTS = [
  WidgetProductsComponent
                                   ];

Step 3 : Module Detail

The modules pertaining to widgetlist and widgetproducts 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 WidgetList and WidgetProducts in Spurtcommerce pages.

In the WidgeAndProducts addon having two components.

1.WidgetProductsComponent

2.WidgetListComponent

WidgetProductComponent

Directive 
<app-widgets-products class="top-sell-prd" [productType]="'today deals'">
</app-widgets-prodWidgetProductComponentucts>

In the above directive have one input field

                  productType:String

WidgetListComponent

This is a one page component. You can configure the route for this component. This component only works with widgetId ,because after clicking viewall link in home page then only the user can view widgetlist The route for this component:

Syntax:
				
{
    path: '', component: WidgetListComponent, pathMatch: 'full', data: {
      urls: [
        { title: 'Widget List', url: '/widget-list' },
      ]
    }
  },

Update Default routing file(default.routing.ts) Inside the src/default/default.routing.ts

  • Import below line

  import * as widgetRoutes from 
  'add-ons/WidgetAndProduct/template/widget-list/widget-list.routing';
  • Add the blog routes in below the routes array

routes.forEach(data => { 
                           if (data && data.children) {
                            console.log('data is',data.children);
                            data.children.push(widgetRoutes.widgetRoutes[0]);
                           }
                         });

Step 4 : Run the application

After you have integrated the WidgetList and WidgetProduct 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