Links

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 and copy the content of api 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. 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.
Angular
Flutter
React
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.
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.
Extract the store-flutter folder inside the folder go to (store-fluter → add-ons → WidgetsAndProducts folder) and copy the WidgetsAndProducts folder and place the copied folder inside the project folder
Add on location:
projectFolder->lib->add-ons
After placing it it will look like this
projectFolder->lib->add-ons->WidgetsAndProducts
Once you finish these steps continue to the next step
Step 2 : Update the configuration
After extracting the add on zip file for changing the configurations in addons.dart, you have to follow the steps below:
Go to
projectFolder->lib->add-ons->addonsshared.dart
Then inside addonsShared array paste the following content
{"WidgetLists": SpurtWidgetList(), "data": ""},
After placing the above files it will look like this
List addonsShared = [
{"WidgetLists":Spurt WidgetList(), "data": ""},
];
Then give the following imports import 'package:spurtcommerce/addons/WidgetsAndProducts/widgetlists.dart';
Or
There will be a popup for quick fix
Step 3 : Module detail
After executing the above mentioned steps, we have to place these below lines in the core folder to show the question and answer to the user.
WidgetLists Once you finished updating the configuration then in the projectFolder->lib->main.dart file update this line where you seem comfortable with
findMyClass("WidgetLists", {
"list": true
}),
Step 4 : Run the application
After integrating the Rating and Review Module into Spurt Commerce, you can use the following commands to run the application in terminal.
$ flutter run
Or In Run menu select run without debugging In case if throws any exception
$ flutter run –no-sound-null-safety
Once you execute the above command you can view the installed module in Spurt Commerce, within the page in which you have integrated.
Step 5 : Make the build
In order to build, you need to run the following commands. In order to check the application, run the following commands and build the application.
$flutter build
If you want to split the abi then
$flutter build –split-per-abi
For bundle build
$flutter build appbundle
These are the steps that need to be followed to do the front end store setup.
  • Installing an extension
  • Update the configuration
  • 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-addOns.zip". Extract the zip file and copy the content of store-react/addOns into the specified path as given below
Path - addOns/WidgetsAndProducts Add on location:
projectFolder-> addOns
After placing it it will look like this
projectFolder->addOns-> WidgetsAndProducts
Step 2 : Update the configuration
After the installation of the extension, you will have to update certain configurations into the default Spurtcommerce addonsconfig.js files. For this, you need to follow the steps below.
Once you finish the first Step now declare the necessary plugins in the addonconfig.js file
  • Import below line into the addonconfig.js
import SpurtWidgetsAndProducts from './WidgetsAndProducts/Allwidgets'
import SpurtWidgetViewAll from './WidgetsAndProducts/widgetViewAll'
  • Add the SpurtWidgetsAndProducts plugin into the below object
export const AddonsComponent={
SpurtWidgetsAndProducts
SpurtWidgetViewAll
}
Step 3 : Module Detail
The modules pertaining to widgets are listed below. You may use these modules, in any page of Spurtcommerce.
SpurtWidgetsAndProducts Component:
{ConnectPlugin.SpurtWidgetsAndProducts && <ConnectPlugin.SpurtWidgetsAndProducts />}
SpurtWidgetViewAll Component:
{ConnectPlugin.SpurtWidgetViewAll && <ConnectPlugin.SpurtWidgetViewAll widgetId={widget} /> }
Step 4 : Run the application
After you have integrated the SpurtWidgetsAndProducts Module into Spurtcommerce, you can use the following command to run the application.
$ npm run dev
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 build or yarn run build
Then the latest built files can be deployed into the server.