Alternative products + Discontinued Products feature integration

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

Install Feature Core

Prerequisites

Please review and install the necessary features before beginning the integration.

Name Version
Alternative Products 202009.0
Discontinued Products 202009.0

1) Set up Behavior

Register the following plugins:

Plugin Specification Prerequisites Namespace
DiscontinuedCheckAlternativeProductApplicablePlugin Checks if product alternatives should be shown for the product. Expects SKUand idProductConcrete to be set for ProductViewTransfer. Spryker\Client\ProductDiscontinuedStorage\Plugin\ProductAlternativeStorage
DiscontinuedCheckAlternativeProductApplicablePlugin Checks if product alternatives should be shown for the product. None Spryker\Zed\ProductDiscontinued\Communication\Plugin\ProductAlternative

src/Pyz/Client/ProductAlternativeStorage/ProductAlternativeStorageDependencyProvider.php

<?php

namespace Pyz\Client\ProductAlternativeStorage;

use Spryker\Client\ProductAlternativeStorage\ProductAlternativeStorageDependencyProvider as SprykerProductAlternativeStorageDependencyProvider;
use Spryker\Client\ProductDiscontinuedStorage\Plugin\ProductAlternativeStorage\DiscontinuedCheckAlternativeProductApplicablePlugin;

class ProductAlternativeStorageDependencyProvider extends SprykerProductAlternativeStorageDependencyProvider
{
    /**
     * @return \Spryker\Client\ProductAlternativeStorageExtension\Dependency\Plugin\AlternativeProductApplicablePluginInterface[]
     */
    protected function getAlternativeProductApplicableCheckPlugins(): array
    {
        return [
            new DiscontinuedCheckAlternativeProductApplicablePlugin(),
        ];
    }
}

src/Pyz/Zed/ProductAlternative/ProductAlternativeDependencyProvider.php

<?php

namespace Pyz\Zed\ProductAlternative;

use Spryker\Zed\ProductAlternative\ProductAlternativeDependencyProvider as SprykerProductAlternativeDependencyProvider;
use Spryker\Zed\ProductDiscontinued\Communication\Plugin\ProductAlternative\DiscontinuedCheckAlternativeProductApplicablePlugin;

class ProductAlternativeDependencyProvider extends SprykerProductAlternativeDependencyProvider
{
    /**
     * @return \Spryker\Zed\ProductAlternativeExtension\Dependency\Plugin\AlternativeProductApplicablePluginInterface[]
     */
    protected function getAlternativeProductApplicablePlugins(): array
    {
        return [
            new DiscontinuedCheckAlternativeProductApplicablePlugin(), #ProductDiscontinuedFeature
        ];
    }
}
Verification
Make sure that you can see alternatives for products that are marked as **discontinued** on the product details page.
Store relation

If the Product Label feature is integrated into your project, make sure to define store relations for Discontinued and Alternatives available product labels by re-importing product_label_store.csv. Otherwise, the product labels are not displayed on the Storefront.