Alternative Products + Discontinued Products feature integration

Edit on GitHub

This document describes how to install the Alternative Products + Discontinued Products.

Install feature core

Follow the steps below to install the Alternative Products + Discontinued Products feature core.

Prerequisites

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

NAME VERSION INSTALLATION GUIDE
Alternative Products 202404.0 Install the Alternative Products feature
Discontinued Products 202404.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 Labels 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.