# Related Products Add-on

**About Add-on**

The Installation of Spurtcommerce Related Product Addon will enable the feature of adding related products to any product (either admin products or vendor products). When the plugin is installed, the multi-Vendor eCommerce site becomes ready for the admin to related products to a admin or vendor product and get them displayed for the visitors to view different related products in the product detail page.

**Features:**

• In the 'Add Product' form, the admin can add related products to a particular product (either admin products or vendor products).&#x20;

• They can select the products from the list of products available in the drop down. On selecting a particular product, it gets added as a related product, under the main product.&#x20;

• They can add one or more related products to any particular product. • On the storefront, related products will appear after the product details in the product detail page.&#x20;

• The Customers can navigate to the detail pages of related products.

### <mark style="color:blue;">Frontend Setup - Seller Panel:</mark>

Follow these steps to set up the front end for the Rating and Review addon in Spurtcommerce Seller Panel.

#### Step 1: Install the Addon:

Locate the Spurtcommerce addon package, typically named seller.addOns.zip.

Extract the zip file and copy the related-product folder into the addOns folder in your project.

projectFolder -> addOns

After this step, the structure should look like:

projectFolder -> addOns > catalog > related-product

Once completed, proceed to update the configuration.

#### Step 2: Update the Configuration

After installing the addon, update the add-ons.constant.ts file to include the necessary plugins:

```
// ---------------------Related-Products Routes---------------------
import * as relatedProducts from './catalog/related-product/related-products-constant';

// components paths
export const relatedProductsComponent = relatedProducts.componentLists;
// route paths
export const relatedProductsRoutes = relatedProducts.routePath;

```

&#x20;If you wish to uninstall or remove the Rating and Review addon, replace the component paths and route paths with an empty array.

```

// ---------------------Related-Products Routes---------------------
import * as relatedProducts from './catalog/related-product/related-products-constant';

// components paths
export const relatedProductsComponent = [];
// route paths
export const relatedProductsRoutes =[];

```

#### &#x20;Step 3: Run the Application:

To run the application with the integrated Rating and Review addon, use the following command:

```
$ npm run large-serve
```

After executing this command, the addon will be available on Spurtcommerce on the designated page.

#### Step 4: Build the Application

Finally, to prepare the application for deployment, run the build command:

```
$ npm run large-build
```

The latest build files will then be ready to deploy to the server.

### <mark style="color:blue;">Frontend Setup – Admin Panel:</mark>

Follow these steps to set up the front end for the Related product addon in Spurtcommerce Admin Panel.

#### Step 1: Install the Addon:

Locate the Spurtcommerce addon package, typically named Admin.addOns.zip.

Extract the zip file and copy the Related Product folder into the addOns folder in your project.

projectFolder -> addOns

After this step, the structure should look like:

projectFolder -> addOns ->Marketing-> Related Product

Once completed, proceed to update the configuration.

#### Step 2: Update the Configuration

After installing the addon, update the add-ons.constant.ts file to include the necessary plugins:

```
// ---------------------Related-Products Routes---------------------
import * as relatedProducts from './Marketing/related-products/related-products.constant';
// components paths
export const relatedProductsComponent = relatedProducts.componentLists;
// route paths
export const relatedProductsRoutes = relatedProducts.routePath;

```

If you wish to uninstall or remove the Related product addon, replace the component paths and route paths with an empty array.

```
// ---------------------Related-Products Routes---------------------
import * as relatedProducts from './Marketing/related-products/related-products.constant';
// components paths
export const relatedProductsComponent = [];
// route paths
export const relatedProductsRoutes = [];


```

#### Step 3: Run the Application:

To run the application with the integrated Related Product addon, use the following command:

```
$ npm run large-serve
```

After executing this command, the addon will be available on Spurtcommerce on the designated page.

#### Step 4: Build the Application

Finally, to prepare the application for deployment, run the build command:

```
$ npm run large-build
```

The latest build files will then be ready to deploy to the server.

### <mark style="color:blue;">Store Setup</mark>

{% tabs %}
{% tab title="Next.js" %}
Follow these steps to set up the Related Product module on the front-end Next.js web store.

#### Setup Overview:

* Install the extension
* Update configuration
* Integrate the module
* Run the application
* Build the application

#### Step 1: Install the Extension

Locate the Spurtcommerce addon package, typically named addOns.zip.

Extract the zip file and copy the RelatedProduct folder into the addOns folder in your project.

&#x20;       projectFolder -> addOns

After this step, the structure should look like:

&#x20;       projectFolder -> addOns -> RelatedProduct

Once completed, proceed to update the configuration.

#### Step 2: Update the Configuration

After installing the extension, update the configuration in Spurtcommerce’s addonsconfig.js as follows:

1. Import the required line into addonsconfig.js.

```
            import RelatedProduct from './RelatedProduct/RelatedProduct'
```

2. Add the RelatedProduct plugin to the specified object.

```
        export const AddonsComponent = {                                                                                                                                          RelatedProduct
}  


```

#### Step 3: Run the Application

Once you have integrated the Related Product module, run the application using:

```
$ npm run dev
```

This command will launch Spurtcommerce with the integrated Payment module visible on the specified page.

#### Step 4 Build the Application

To prepare the application for deployment, execute the following command:

```
$ npm run build
```

or

```
$ yarn run build                                                                                                                             
```

The latest build files will then be ready for server deployment.
{% endtab %}

{% tab title="Flutter" %}

### &#x20;                                     Related Product Add-On

&#x20;

Follow these below steps are installing Related Product

App setup

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

Locate the Spurtcommerce addon package, typically named addons.zip.

Extract the zip file and copy the Related Product folder into the addons folder in your project.

projectFolder->lib->module->add-ons

After this step, the structure should look like:

projectFolder->lib->module->add-ons->RelatedProducts

Once completed, proceed to update the configuration.

#### 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->module->add-ons->addonsshared.dart

Then inside addonsShared array paste the following content

```
{"RelatedProducts": SpurtRelatedProducts(), "data": ""},
```

After placing the above files it will look like this,

List addonsShared = \[

{"RelatedProducts": SpurtRelatedProducts(), "data": ""},

];

Then give the following imports

```
import 'package:spurtcommerce/module/add-ons/RelatedProducts/Page/relatedproducts.dart';
```

Or

There will be a popup for quick fix

#### Step 3 : Module details

After executing the above mentioned steps, we have to place these below lines in the module folder to show the to the user.

Related Products

Once you finished updating the configuration then in the projectFolder->lib->module->Tab->Product-detailpage->presentation->pages->details.dart

Use this line for view the  Related Products

&#x20;

findMyClass("RelatedProducts", {

"slug":

detail.details\["productSlug"]

}),

After insert the line restart your application

#### Step 4 : Run the application

After integrating the Related Products 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
```

&#x20;

&#x20;
{% 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/marketing-related-addons/related-products-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.
