Install the Alternative Products Glue API

Edit on GitHub

Install Feature API

Prerequisites

Install the required features:

NAME VERSION REQUIRED SUB-FEATURE
Spryker Core 202307.0 Install the Spryker Core Glue API
Alternative Products 202307.0
Products 202307.0 Install the Product Glue API

1) Install the required modules

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