Glue API - Alternative products feature integration

Edit on GitHub
You are browsing a previous version of the document. The latest version is 202108.0.

Install feature API

Prerequisites

To start feature integration, overview and install the necessary features:

Name Version Required Sub-Feature
Spryker Core 202009.0 Glue Application feature integration
Alternative Products 201907.0
Products 202009.0 Product API feature integration

1) Install the required modules using Composer

Run the following command to install the required modules:

composer require spryker/alternative-products-rest-api:"^1.0.0" --update-with-dependencies
“Verification”

Make sure that the following module is installed:

Module Expected Directory
AlternativeProductsRestApi vendor/spryker/alternative-products-rest-api

2) Set up Behavior

Activate the following plugins:

Plugin Specification Prerequisites Namespace
AbstractAlternativeProductsResourceRoutePlugin Registers the abstract alternative products resource. None Spryker\Glue\AlternativeProductsRestApi\Plugin\GlueApplication
ConcreteAlternativeProductsResourceRoutePlugin Registers the concrete alternative products resource. None Spryker\Glue\AlternativeProductsRestApi\Plugin\GlueApplication

src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php

<?php

namespace Pyz\Glue\GlueApplication;

use Spryker\Glue\GlueApplication\GlueApplicationDependencyProvider as SprykerGlueApplicationDependencyProvider;
use Spryker\Glue\AlternativeProductsRestApi\Plugin\GlueApplication\AbstractAlternativeProductsResourceRoutePlugin;
use Spryker\Glue\AlternativeProductsRestApi\Plugin\GlueApplication\ConcreteAlternativeProductsResourceRoutePlugin

class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependencyProvider
{
    /**
     * @return \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRoutePluginInterface[]
     */
    protected function getResourceRoutePlugins(): array
    {
        return [
            new AbstractAlternativeProductsResourceRoutePlugin(),
            new ConcreteAlternativeProductsResourceRoutePlugin(),
        ];
    }
}
“Verification”

Make sure that the following endpoints are available:

  • http://mysprykershop.com/concrete-products/{{concrete_sku}}/abstract-alternative-products
  • http://mysprykershop.com/concrete-products/{{concrete_sku}}/abstract-alternative-products