Glue API - Alternative Products feature integration

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

Install Feature API

Prerequisites

Install the required features:

NAME VERSION REQUIRED SUB-FEATURE
Spryker Core 202204.0 Glue Application feature integration
Alternative Products 202204.0
Products 202204.0 Product API feature integration

1) Install the required modules using Composer

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