# Copy of Ratings and Review Add-on

**Installation of Spurtcommerce Ratings and Review Add-On**

This document will help you to install Ratings and Review add-on to your spurtcommerce server for single vendor as well as Multi vendor

**you can install this Add-on through following steps**

step 1: [<mark style="color:blue;">Setup an API (Step By Step)</mark>](#setup-an-api-step-by-step) to add extension for admin

step 2: [<mark style="color:blue;">Admin setup</mark>](#admin-setup)

step 3: you can easily install admin storefront with [<mark style="color:blue;">store setup</mark><mark style="color:blue;">**.**</mark> ](#store-setup)spurtcommerce provides 3 admin storefronts, built with [<mark style="color:blue;">Angular,</mark> ](#store-setup)[<mark style="color:blue;">Flutter</mark>](#store-setup) and [<mark style="color:blue;">React.</mark>  ](#store-setup)

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

step 4: [<mark style="color:blue;">Setup an API (Step By Step)</mark> ](#setup-an-api-step-by-step-to-add-extension-for-multi-vendor)to add extension for multi vendor

step 5 :[ <mark style="color:blue;">Multi Vendor front end setup</mark>](#vendor-setup)

step 6: you can easily install vendor storefront with[ <mark style="color:blue;">store setup</mark><mark style="color:blue;">**.**</mark> ](#store-setup-1)spurtcommerce provides 3 vendor storefronts, built with [<mark style="color:blue;">Angular,</mark>](#store-setup-1) [<mark style="color:blue;">Flutter</mark> ](#store-setup-1)and [<mark style="color:blue;">React.</mark>  ](#store-setup-1)

**About Addon :**

The installation of Spurtcommerce Rating and Review Plugin helps to display the aggregate rating and review for products in the store. When this plugin is installed, the eCommerce site becomes ready for the Customers to post review about the product that they have purchased from the eCommerce store.

**Features:**

* The Customer can provide a star rating.&#x20;
* The Customer can also add a comment along with the star rating.&#x20;
* Vendors and Admin can moderate the reviews.&#x20;
* Display of Reviews on the Storefront.
* &#x20;Display of number of 5 stars, 4 stars, 3 stars, 2 stars and 1s star ratings&#x20;
* Display of aggregate/overall rating.

### [<mark style="color:blue;">Setup an API (Step By Step)</mark>](#setup-an-api-step-by-step)

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

* Installing an extension&#x20;
* Run the application&#x20;
* 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 "<mark style="color:green;">**ratingandreview-addOn.zip**</mark>". Extract the zip file, open api folder and open addon folder within that and copy the content of addon folder into the specified path.

&#x20;                              **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**&#x20;

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.

### [<mark style="color:blue;">Admin Setup</mark>](#admin-setup)

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

* Installing an extension
* &#x20;Update the configuration&#x20;
* Module Detail&#x20;
* Run the application&#x20;
* 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 "<mark style="color:green;">**ratingand review-addOn.zip**</mark>".&#x20;

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

&#x20;                                                                **Path -  admin/add-ons**&#x20;

**Note:**

{% hint style="info" %}

```
Note:
```

```
In addon folder if already a cms folder exists.
```

```
Inside cms folder paste Rating and Review folder.
```

```
In cms routing file(cms.routing.ts) paste the below code.
```

{% endhint %}

```
export const ratingRoutes = [
 {
   path: 'rating_review',
   loadChildren: () => import('../cms/RatingAndReview/template/rating_review.module').then(m => m.RatingReviewModule),
   canActivate: [AuthGuard],
   data: { permissionForHeader: 'catalog-rating-review', root: 'catalog' }
 },
];
```

{% hint style="info" %}

```
In addon folder if  cms folder doesn’t exists.
```

```
Paste the cms folder in addon.
```

{% endhint %}

**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.

&#x20;**Update Reducer Config**

1\)     Import below line into the <mark style="color:green;">**add-ons/add-ons-reducer.ts**</mark>

```
          import * as fromRatingReview from
'../add-ons/cms/RatingAndReview/core/ratingReview-reducer/ratingReview.reducer'

```

2\)     Add the reducer into the below object

&#x20;                      **ratingReview: fromRatingReview\.reducer,**

3\)     After adding its looks like below

&#x20;**export const AddOnReducers: ActionReducerMap\<State> = {**

&#x20;                         **ratingReview: fromRatingReview\.reducer,**

<br>

**};**

&#x20;**Update State Config**

1\)      Import below line into the <mark style="color:green;">**add-ons/add-ons-state.ts**</mark>

```
import { RatingReviewState } from
 '../add-ons/cms/RatingAndReview/core/ratingReview-reducer/ratingReview.state'

```

2\)     Add the state into the below object

&#x20;                **ratingReview: RatingReviewState,**

3\)   After adding its looks like below

&#x20;**export interface AddOnAppState {**

&#x20;                         **ratingReview: RatingReviewState,**

<br>

**}**

**Step 3 : Change the routing file(cms.routing.ts)**

Inside the <mark style="color:green;">**src/theme/default/admin/cms/components/manage-content/manage.content.routing.ts**</mark>

1\)Import below line

```
import * as cmsRouting from '../../../../../../../add-ons/cms/cms.routing';

```

Add these routes  below the catalogRoutes array

```
manageContentRoutes.forEach(data => {
   if (data) {
   manageContentRoutes.push(cmsRouting.ratingRoutes[0]);
   }
   });

```

2\) For setting up the tab add this line in

<mark style="color:green;">**src/theme/default/admin/cms/components/header/header.component.html**</mark>&#x20;

<mark style="color:green;">**Below line no:35**</mark>

```
<li [appHideIfUnauthorized]="'catalog-rating-review'" >
                           <a href="javascript:void(0)" [routerLink]="['/cms/manage-content/rating_review']" [routerLinkActive]="'active'">
                           Ratings and Review
                           </a>
                           </li>

```

**Step 4 : Run the application**

After you have integrated the Rating and Review 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.

### [<mark style="color:blue;">store setup</mark>](#store-setup-1)

{% tabs %}
{% tab title="Angular" %}
These are the steps that need to be followed to do the front end store setup.

* Installing an extension&#x20;
* Update the configuration&#x20;
* Module Detail&#x20;
* Run the application&#x20;
* 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 "ratingand review-addOn.zip".

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

&#x20;                      **Path - store-angular/add-ons**&#x20;

**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 <mark style="color:green;">**add-ons/add-ons-reducer.ts**</mark>

```
import * as fromRatingReview from 
'./RatingAndReview/core/reducer/ratingReview.reducer';


```

Add the reducer into the below object

**ratingReview: fromRatingReview\.reducer,**

After adding its looks like below

```
export const AddOnReducers: ActionReducerMap<State> = {
                    	ratingReview: fromRatingReview.reducer
       	}
```

**Update State Config**

Import below line into the <mark style="color:green;">**add-ons/add-ons-state.ts**</mark>

```
import { RatingReviewState } from 
            	  './RatingAndReview/core/reducer/ratingReview.state';

```

Add the state into the below object

ratingReview: RatingReviewState;

After adding its looks like below

```
export interface AddOnAppState {
ratingReview: RatingReviewState;
}
```

**update effect config**

Import below line into the <mark style="color:green;">**add-ons/add-ons.effect.ts**</mark>

```
	import {RatingReviewEffect} from 
	'./RatingAndReview/core/effects/ratingReview.effect';

```

Add the effect into the below object

```
RatingReviewEffect
```

After adding its looks like below

**export const ADD\_ON\_EFFECT = \[ RatingReviewEffect, ];**

**Update Component Config**

Import below line into the <mark style="color:green;">**add-ons/add-ons.shared.component.ts**</mark>

```
import {RatingComponent} from './RatingAndReview/template/rating/rating.component';
import { ReviewControlsComponent } from './RatingAndReview/template/review-controls/review-controls.component';
import {ReviewComponent} from './RatingAndReview/template/review/review.component';

```

1. Add the following components into the below object

```
RatingComponent
ReviewControlsComponent
ReviewComponent
```

After adding its looks like below

export const ADD\_ON\_COMPONENTS = \[ RatingComponent, ReviewControlsComponent, ReviewComponent ];

**Step 3 : Module Detail**

The modules pertaining to ratings and reviews 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 Ratings and Reviews in Spurtcommerce pages.

In the rating and review addon having three components.

1. RatingComponent
2. ReviewControlsComponent
3. ReviewComponent

RatingComponent

Directive

```
<app-spurt-star-rating [rating]=”<rating>” [productId]="productId" [isDetail]="true/false"></app-spurt-star-rating>

```

**ReviewControlsComponent**

&#x20;  Directive

```
  	<app-spurt-review-controls [productSlug]="id"></app-spurt-review-controls>

```

<br>

In the above directive have one input fields

**Review component**

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

&#x20;                    This component only works with orderProductID.

&#x20;                    Because after placing the order only the user can give the rating.

&#x20;                    Whatever application module you can configure this route. For eg

<mark style="color:green;">**src/default/pages/account/account.module.ts**</mark> import line;

```
import { ReviewComponent } from '../../../../add-ons/RatingAndReview/template/review/review.component';
```

<br>

&#x20;      Config this route in <mark style="color:green;">**src/default/pages/account/account.module.ts**</mark> inside route array add this following object

<br>

```
	{
path: 'review/:id',
component: ReviewComponent,
data: {
breadcrumb: 'Review',
urls: [
{ title: 'Account' },
{ title: 'Order History' },
{ title: 'Order Details' },
{ title: 'Review this product' }
]
}
},
 

     

     
 

```

```
Param <:ID> is refer to the orderProductID
```

**Step 4 : Run the application**

After you have integrated the Rating and Review 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.
{% endtab %}

{% tab title="Flutter" %}
These are the steps that need to be followed to do the front end store setup.

* Installing an extension&#x20;
* Update the configuration&#x20;
* Module Detail&#x20;
* Run the Application&#x20;
* 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 → RatingAndReview folder) and copy the RatingAndReview folder  and place the copied folder&#x20;

inside the project folder

**Add on location:**

<mark style="color:green;">**projectFolder->lib->add-ons**</mark>

**After placing it it will look like this**&#x20;

<mark style="color:green;">**projectFolder->lib->add-ons->RatingAndReview**</mark>

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 <mark style="color:green;">**addons.dart**</mark>, you have to follow the steps below:

**Go to**

&#x20;<mark style="color:green;">**projectFolder->lib->add-ons->addonsshared.dart**</mark>

Then inside addonsShared array paste the following content

```
{"Rating": SpurtReviews(), "data":""},

```

{"ProductReview":SpurtProductRating(),"data":""},<br>

After placing the above files it will look like this

**List addonsShared = \[ {"Rating": SpurtReviews(), "data":""},**&#x20;

**{"ProductReview":SpurtProductRating(),"data":""},**

**];**

Then give the following imports

**import 'package:spurtcommerce/add\_on/ratingsandreviews/ratings\_reviews.dart';**

Or&#x20;

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 rating and review to the user.

**Detail rating and review**

&#x20;Once you finished updating the configuration then in the

&#x20;<mark style="color:green;">**projectFolder->lib->core->modules->detail->details.dart**</mark> file update this line where you seem comfortable with paste this near 2554 line or below

Use this line for view the rating

<br>

&#x20;**findMyClass('Rating', { "productSlug": req\["slug"],"rating":details\["rating"],"id": productId}),**

**Post your rating and feedback**

Use this line for post your rating and feedback

&#x20;If you want to post your rating and feedback for your ordered products add the below line where you feel free in <mark style="color:green;">**projectFolder->lib->core->modules->order->components->orderdetails.dart**</mark>&#x20;

findMyClass("ProductReview", {"orderdetail": orderDeatil}),

After insert the line restart your application and post your ordered products rating and feedback

**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&#x20;

$ flutter run –no-sound-null-safety&#x20;

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**&#x20;

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
```

{% endtab %}

{% tab title="React" %}
These are the steps that need to be followed to do the front end store setup.

* Installing an extension&#x20;
* Update the configuration&#x20;
* Run the application&#x20;
* 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 "ratingand review-addOn.zip". Extract the zip file and copy the content of store-react/addOns folder into the specified path as given below

**Path - addOns/RatingAndReview**

**Add on location:**&#x20;

&#x20;                                        *projectFolder-> addOns*&#x20;

**After placing it it will look like this**&#x20;

&#x20;                         *projectFolder->addOns-> RatingAndReview*

**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  SpurtRatingAndReview from './RatingAndReview/ReviewRating'

```

Add the ReviewRation plugin into the below object

**export const AddonsComponent={**

**SpurtRatingAndReview**

&#x20;**}**

<br>

Add the following component into the below AddonsComponent object:

&#x20;                                 <br>

\`SpurtRatingAndReview\`

\`SpurtPartialReviews\`

&#x20;           \`SpurtRatingAndReviewFeedback\`

<br>

<br>

```
Import  SpurtRatingAndReview from './RatingAndReview/ReviewRating'   
```

<pre><code><strong>  import  SpurtPartialReviews from './RatingAndReview/PartialReview'    
</strong>     
</code></pre>

```
import SpurtRatingAndReviewFeedback from './RatingAndReview/RatingAndReviewFeedback'      
```

**After adding its looks like below:**

export  const AddonsComponent={

SpurtRatingAndReview ,

SpurtPartialReviews,

&#x20;                      SpurtRatingAndReviewFeedback

&#x20;}

<br>

**Step 3 : Module Detail**

<br>

The modules pertaining to ratings and reviews plugin are listed below. You may use these modules, you must send the product to use this module in any page of Spurtcommerce. &#x20;

&#x20;        &#x20;

**SpurtRatingAndReview Component:**

<br>

<mark style="color:green;">{ConnectPlugin.SpurtRatingAndReview &&\<ConnectPlugin.SpurtRatingAndReview product={product} />}</mark>

&#x20;**SpurtPartialReviews Component:**

<br>

<mark style="color:green;">{ConnectPlugin. SpurtPartialReviews &&\<ConnectPlugin. SpurtPartialReviews  Productslug={Productslug} />}</mark>

<br>

&#x20;**SpurtRatingAndReviewFeedback Component:**

<mark style="color:green;">**{ConnectPlugin. SpurtRatingAndReviewFeedback &&\<ConnectPlugin. SpurtRatingAndReviewFeedback  orderId={orderId} />}**</mark><br>

**Step 4 : Run the application**

After you have integrated the RatingandReview 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.
{% endtab %}
{% endtabs %}

[<mark style="color:blue;">Setup an API (Step By Step) to add extension for Multi vendor</mark>](#setup-an-api-step-by-step-1)

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

* Installing an extension&#x20;
* Run the application&#x20;
* 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 <mark style="color:green;">**"vendorratingandreview-addOn.zip".**</mark>

Extract the zip file and copy the content of api folder into the specified path            &#x20;

&#x20;                                  **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.

### [<mark style="color:blue;">Multi Vendor frontend Setup</mark>](#vendor-setup)

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

* Installing an extension&#x20;
* Update the configuration&#x20;
* Module Detail&#x20;
* Run the application&#x20;
* Make the build

**Step 1 : Installing an extension**

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

&#x20;

&#x20;        Usually spurcommerce comes packed in a zip, whose name ends in "vendorratingandreview-addOn.zip".

&#x20;        Extract the zip file and copy the content vendor/add-ons folder into the specified path

&#x20;                 **Path - vendor/add-ons**&#x20;

**Step 2 : Update the configuration&#x20;**<mark style="color:green;">**add-ons/add-ons-reducer.ts**</mark>

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 <mark style="color:green;">**add-ons/add-ons-reducer.ts**</mark>

```
   	import * as fromRatingReview from
    '../add-ons/RatingAndReview/core/reducer/RatingReview.reducer';
```

Add the reducer into the below object

&#x20;                      ratingReview: fromRatingReview\.reducer,

After adding its looks like below

**export const AddOnReducers: ActionReducerMap\<State> = {**

&#x20;          **ratingReview: fromRatingReview\.reducer,**

&#x20;           **};**

**Update State Config add-ons/add-ons-reducer.ts**

Import below line into the <mark style="color:green;">**add-ons/add-ons-state.ts**</mark>

```

import { RatingReviewState } from 
'../add-ons/RatingAndReview/core/reducer/RatingReview.state'


```

Add the state into the below object

&#x20;                                   ratingReview: RatingReviewState,

After adding its looks like below

**export interface AddOnAppState {**

&#x20;           **ratingReview: RatingReviewState,**

**}**

&#x20;**Update Effect Config**

1\)    Import below line into the <mark style="color:green;">**add-ons/add-ons.effect.ts**</mark>

```
  import { RatingReviewEffect } from  
  '../add-ons/RatingAndReview/core/effects/RatingReview.effect';

```

2\)    Add the effect into the below object

&#x20;                       RatingReviewEffect

3\)    After adding its looks like below

&#x20;           export const ADD\_ON\_EFFECT = \[

&#x20;           RatingReviewEffect,

&#x20;     &#x20;

];

Update Component Config

&#x20;

4\) Import below line into the <mark style="color:green;">**add-ons/add-ons.shared.component.ts**</mark>

```
import { RatingreviewComponent } from "./RatingAndReview/template/ratingreview/ratingreview.component";

```

Add the following components into the below object

**RatingreviewComponent**

After adding its looks like below

**export const ADD\_ON\_COMPONENTS = \[**

**RatingreviewComponent**

**];**

\ <br>

\ <br>

&#x20;**Step 3 : Module Detail**

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

&#x20;Also, you can find the steps below to use the modules in Ratings and Reviews in Spurtcommerce pages.

In the rating and review addon having one component.

1\)    RatingreviewComponent

&#x20;       &#x20;

&#x20;  Add the below steps to configure routing&#x20;

&#x20;     In <mark style="color:green;">**src/app/default/pages/cms/manage-content/manage-content.module.ts**</mark>

&#x20;      &#x20;

1. &#x20;Import below line

&#x20;                                       &#x20;

```
import { RatingreviewComponent } from '../../../../../../../add-ons/RatingAndReview/template/ratingreview/ratingreview.component';

 
```

2\)  Add these routes below the Routes and childrens

&#x20;array

```
        {
       path: 'rating-review',
       component: RatingreviewComponent,
       data: {
           title: 'Rating  and Review',
           urls: [{ title: 'Home' , url: '/dashboard'}, { title: 'CMS', url: '/cms/manage-content' },{ title: 'Manage content', url: 'cms/manage-content' }, { title: 'Rating and Review' }]
       }
   },

```

&#x20;For setting up the tab add this line in

<mark style="color:green;">**src/app/default/pages/cms/layout/products.component.html**</mark>

<mark style="color:green;">**Below line no: 37**</mark>

```
    <a href="javascript:void(0)" [routerLink]="['/cms/manage-content/rating-review']" class="">Rating and Review</a>
                                 
```

**Step 4 : Run the application**

After you have integrated the Rating and Review 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.

&#x20;                                   &#x20;

### [<mark style="color:blue;">Store Setup</mark>](#store-setup-1)

{% tabs %}
{% tab title="Angular" %}
These are the steps that need to be followed to do the front end store setup.

* Installing an extension&#x20;
* Update the configuration&#x20;
* Module Detail&#x20;
* Run the application&#x20;
* 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 "ratingand review-addOn.zip".

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

&#x20;                      **Path - store-angular/add-ons**&#x20;

**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 <mark style="color:green;">**add-ons/add-ons-reducer.ts**</mark>

```

	import * as fromVendorRatingReview from 
	'./VendorRatingAndReview/core/reducer/vendorRatingReview.reducer';


```

**Add the reducer into the below object**

vendorRatingReview: fromVendorRatingReview\.reducer,

**After adding its looks like below**

```
export const AddOnReducers: ActionReducerMap<State> = {
                    	ratingReview: fromRatingReview.reducer
       	}
```

**Update State Config**

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

```
     import { RatingReviewState as VendorRatingReviewState} from 
     './VendorRatingAndReview/core/reducer/vendorRatingReview.state';


```

**Add the state into the below object**

vendorRatingReview: VendorRatingReviewState,

After adding its looks like below

```
export interface AddOnAppState {
ratingReview: RatingReviewState;
}
```

**update effect config**

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

```
	  	import {VendorRatingReviewEffect} from 
	'./VendorRatingAndReview/core/effects/vendorRatingReview.effect';


```

Add the effect into the below object

&#x20;   **VendorRatingReviewEffect,**

After adding its looks like below

**export const ADD\_ON\_EFFECT = \[ RatingReviewEffect, ];**

**Update Component Config**

Import below line into the <mark style="color:green;">**add-ons/add-ons.shared.component.ts**</mark>

```
   import {VendorReviewControlsComponent} from 
   './VendorRatingAndReview/template/vendor-review-controls/vendor-review-controls.component';



```

1. Add the following components into the below object

&#x20; **VendorReviewControlsComponent,**

**After adding its looks like below**

export const ADD\_ON\_COMPONENTS = \[

&#x20;                                                  VendorReviewControlsComponent,

&#x20;                                         ];

<br>

**Step 3 : Module Detail**

The modules pertaining to vendor-rating and review are listed below. You may use these modules, in any page of Spurtcommerce.

&#x20;

Also, you can find the steps below to use the modules in Vendor-rating and review  in Spurtcommerce pages.

&#x20;

&#x20;

&#x20;                             In the vendorRatingAndReviews addon having one components.

&#x20;

1\) VendorReviewControlsComponent,   &#x20;

&#x20;  &#x20;

VendorReviewControlsComponent

&#x20;        Directive

```
<app-spurt-vendor-review-controls[vendorId]=”vendorId”></app-spurt-vendor-review-controls>
```

&#x20;      &#x20;

&#x20;

&#x20; In the above directive have one input field

&#x20;                       &#x20;

&#x20;                  vendorId:numeric

**Step 4 : Run the application**

After you have integrated the Rating and Review 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.

{% endtab %}

{% tab title="Flutter" %}
These are the steps that need to be followed to do the front end store setup.

* Installing an extension&#x20;
* Update the configuration&#x20;
* Module Detail&#x20;
* Run the Application&#x20;
* Make the build

**Step 1 : Installing an extension**

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

Extract the <mark style="color:green;">**ratingandreview-addon.zip**</mark> file and place the extracted files inside the add\_on folder inside the project folder

**Add on location:**

<mark style="color:green;">**projectFolder->lib->add-ons**</mark>

**After placing it it will look like this**&#x20;

<mark style="color:green;">**projectFolder->lib->add-ons->RatingAndReview**</mark>

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 <mark style="color:green;">**addons.dart**</mark>, you have to follow the steps below:

**Go to**

&#x20;<mark style="color:green;">**projectFolder->lib->add-ons->addonsshared.dart**</mark>

Then inside addonsShared array paste the following content

```
{"Rating": SpurtReviews(), "data":""},

```

{"ProductReview":SpurtProductRating(),"data":""},

<br>

After placing the above files it will look like this

**List addonsShared = \[ {"Rating": SpurtReviews(), "data":""}, {"ProductReview":SpurtProductRating(),"data":""},**

**];**

Then give the following imports

**import 'package:spurtcommerce/add\_on/ratingsandreviews/ratings\_reviews.dart';**

Or&#x20;

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 rating and review to the user.

**Detail rating and review**

&#x20;Once you finished updating the configuration then in the

&#x20;<mark style="color:green;">**projectFolder->lib->core->modules->detail->details.dart**</mark> file update this line where you seem comfortable with paste this near 2554 line or below

Use this line for view the rating

<br>

&#x20;**findMyClass('Rating', { "productSlug": req\["slug"],"rating":details\["rating"],"id": productId}),**

**Post your rating and feedback**

Use this line for post your rating and feedback

&#x20;If you want to post your rating and feedback for your ordered products add the below line where you feel free in

&#x20;<mark style="color:green;">**projectFolder->lib->core->modules->order->components->orderdetails.dart**</mark>&#x20;

**findMyClass("ProductReview", {"orderdetail": orderDeatil}),**

After insert the line restart your application and post your ordered products rating and feedback<br>

**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&#x20;

$ flutter run –no-sound-null-safety&#x20;

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&#x20;

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
```

{% endtab %}

{% tab title="React" %}
These are the steps that need to be followed to do the front end store setup.

* Installing an extension&#x20;
* Update the configuration&#x20;
* Run the application&#x20;
* 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 "ratingand review-addOn.zip". Extract the zip file and copy the content of store folder into the specified path as given below

Move *RatingAndReview* folder from *addOns/RatingAndReview* to&#x20;

&#x20;                                **Path - \<PROJECT\_ROOT>/addOns**

**Add on location:**&#x20;

&#x20;                                        *projectFolder-> addOns*&#x20;

**After placing it it will look like this**&#x20;

&#x20;                         *projectFolder->addOns-> RatingAndReview*

**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  SpurtVendorRatingReviews from
 './VendorRatingAndReview/VendorRatingReviews'

```

<pre><code>import SpurtvendorRatingAndReviewCount from './VendorRatingAndReview/vendorRatingAndReviewCount'
<strong>
</strong></code></pre>

&#x20;   2\. Add the VendorRatingReviews into the below object

**export const AddonsComponent={**

**SpurtVendorRatingReviews,**

&#x20;                        **SpurtvendorRatingAndReviewCount**

**}**

**Step 3 : Module Detail**

\
The modules pertaining to VendorRating are listed below. You may use these modules, in any page of Spurtcommerce.&#x20;

**SpurtVendorRatingReviews Component:**     &#x20;

**{ConnectPlugin.SpurtVendorRatingReviews&&**

**\<ConnectPlugin.SpurtVendorRatingReviews vendorId={vendorId} />}**

**SpurtvendorRatingAndReviewCount Component:**

**{ConnectPlugin.SpurtvendorRatingAndReviewCount && (**

&#x20;                       **\<ConnectPlugin.SpurtvendorRatingAndReviewCount**

&#x20;                         **vendorId={data.vendorId}**

&#x20;                       **/>**

&#x20;                     **)}**

<br>

**Step 4 : Run the application**

After you have integrated the RatingandReview 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.

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spurtcommerce.com/addons/group-1/page-1/copy-of-ratings-and-review-add-on.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
