Marketplace Product + Marketplace Product Offer feature integration

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

This document describes how to integrate the Marketplace Product + Marketplace Product Offer feature into a Spryker project.

Install feature core

Follow the steps below to install the Marketplace Product + Marketplace Product Offer feature core.

Prerequisites

To start feature integration, integrate the required features:

NAME VERSION INTEGRATION GUIDE
Spryker Core 202108.0 Spryker Core feature integration
Marketplace Product 202108.0 Marketplace Product feature integration
Product Offer 202108.0 Marketplace Product Offer feature integration

Set up behavior

Enable the following behaviors by registering the plugins:

PLUGIN DESCRIPTION PREREQUISITES NAMESPACE
MerchantProductProductOfferReferenceStrategyPlugin Allows selecting a merchant product by default on PDP. Spryker\Client\MerchantProductOfferStorageExtension\Dependency\Plugin
Note

The order is important. Plugin has to be registered after ProductOfferReferenceStrategyPlugin.

src/Pyz/Client/MerchantProductOfferStorage/MerchantProductOfferStorageDependencyProvider.php

<?php

namespace Pyz\Client\MerchantProductOfferStorage;

use Spryker\Client\MerchantProductOfferStorage\MerchantProductOfferStorageDependencyProvider as SprykerMerchantProductOfferStorageDependencyProvider;
use Spryker\Client\MerchantProductOfferStorageExtension\Dependency\Plugin\ProductOfferStorageCollectionSorterPluginInterface;
use Spryker\Client\MerchantProductStorage\Plugin\MerchantProductOfferStorage\MerchantProductProductOfferReferenceStrategyPlugin;

class MerchantProductOfferStorageDependencyProvider extends SprykerMerchantProductOfferStorageDependencyProvider
{
    /**
     * @return array<\Spryker\Client\MerchantProductOfferStorageExtension\Dependency\Plugin\ProductOfferReferenceStrategyPluginInterface>
     */
    protected function getProductOfferReferenceStrategyPlugins(): array
    {
        return [
            new MerchantProductProductOfferReferenceStrategyPlugin(),
        ];
    }
}
Verification

Make sure you can switch between marketplace products and product offers on the Product Details page.

Make sure that marketplace products selected on the Product Details page by default.