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

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

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

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

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 "productrelated-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

Make sure your device 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 "productrelated-addOn.zip".

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

Path - <PROJECT_ROOT>/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 fromRelatedProducts from 
'../add-ons/marketing/related-product/core/reducer/related-product.reducer';

2) Add the reducer into the below object

relatedProducts: fromRelatedProducts.reducer

3) After adding its looks like below

export const AddOnReducers: ActionReducerMap<State> = {

relatedProducts: fromRelatedProducts.reducer,

};

Update State Config

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

import { RelatedState } from 
'../add-ons/marketing/related-product/core/reducer/related-product.state';

2) Add the state into the below object

relatedProducts: RelatedState,

3) After adding its looks like below

export interface AddOnAppState {

relatedProducts: RelatedState

}

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

Inside the src/theme/default/admin/marketing/components/manage-cross-selling/manage-cross-selling.routing.ts

1) Import below line

   import * as  marketingRoutes  from "../../../../../../../add-ons/marketing/marketing.routing"

2) Add these routes below the marketingRoutes array

manageCrossSelling.push(marketingRoutes.RelatedProductsRoutes[0]);

3) Add the following code in

src/theme/default/marketing/components/header/header.component.html

Below line no :20

<li [appHideIfUnauthorized]="'related_product'">
                    <a href="#" [routerLink]="['/marketing/manage-cross-selling/related_product']" [routerLinkActive]="'active'">
                      Related products
                    </a>
                </li>

Step 4 : Run the application

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

Store setup

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

  • Installing an extension

  • Update the configuration

  • Component Detail

  • Run the application

  • Make the build

Step 1 : Installing an extension

Make sure your device 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 ".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 * as fromRelatedProducts from './RelatedProducts/core/reducer/related-products.reducer'

2. Add the reducer into the below object

relatedProducts: fromRelatedProducts.reducer

3. After adding its looks like below

export const AddOnReducers: ActionReducerMap<State> = {

relatedProducts: fromRelatedProducts.reducer

}

Update State Config

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

   import { RelatedState} from './RelatedProducts/core/reducer/related-products.state'

Add the state into the below object

relatedProducts:RelatedState

  1. After adding its looks like below

export interface AddOnAppState {

relatedProducts:RelatedState

}

Update Effect Config

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

import { RelatedProductsEffect } from './RelatedProducts/core/effect/related-products.effects';

  1. Add the effect into the below object

RelatedProductsEffect

2. After adding its looks like below

export const ADD_ON_EFFECT = [

RelatedProductsEffect

];

Update Component Config

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

     import { RelatedProductsComponent } from './RelatedProducts/template/related-products/related-products.component';
     

2.Add the following components into the below object

RelatedProductsComponent

3. After adding its looks like below

export const ADD_ON_COMPONENTS = [

RelatedProductsComponent

]

Step 3 : Component Detail

The modules pertaining to related productst 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 related productst in Spurtcommerce pages.

In the RelatedProducts addon having one components.

  1. RelatedProductsComponent

RelatedProductsComponent

Directive

 <app-spurt-related-products style="width: 20%;"  [productId]="id"></app-spurt-related-products>

In the above directive have one input field

productId:number

RelatedProductsSandbox can be imported in 2 modules and 2 components namely

  1. ProductsModule

  2. SharedModule

  3. ControlsComponent

  4. ProductComponent

Step 4 : Run the application

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