Glue API - Alternative products feature integration

Edit on GitHub

Install Feature API

Prerequisites

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

NAME VERSION REQUIRED SUB-FEATURE
Spryker Core 202108.0 Glue Application feature integration
Alternative Products 202108.0
Products 202108.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