Marketplace Product + Marketplace Product Offer feature integration

Edit on GitHub
You are browsing a previous version of the document. The latest version is 202212.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 202204.0 Spryker Core feature integration
Marketplace Product 202204.0 Marketplace Product feature integration
Marketplace Product Offer 202204.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\MerchantProductStorage\Plugin\ProductOfferStorage
Note

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

src/Pyz/Client/ProductOfferStorage/ProductOfferStorageDependencyProvider.php

<?php

namespace Pyz\Client\ProductOfferStorage;

use Spryker\Client\MerchantProductStorage\Plugin\ProductOfferStorage\MerchantProductProductOfferReferenceStrategyPlugin;
use Spryker\Client\ProductOfferStorage\ProductOfferStorageDependencyProvider as SprykerProductOfferStorageDependencyProvider;

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

Verification

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

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

Install feature frontend

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

Prerequisites

To start feature integration, integrate the required features:

NAME VERSION INTEGRATION GUIDE
Marketplace Product 202204.0 Marketplace Product feature integration
Marketplace Product Offer 202204.0 Marketplace Product Offer feature integration

Set up behavior

Enable the following behaviors by registering the plugins:

PLUGIN DESCRIPTION PREREQUISITES NAMESPACE
MerchantProductMerchantProductOfferCollectionExpanderPlugin Finds merchant product by sku and expands form choices with a merchant product’s value. SprykerShop\Yves\MerchantProductWidget\Plugin\MerchantProductOfferWidget

src/Pyz/Yves/MerchantProductOfferWidget/MerchantProductOfferWidgetDependencyProvider.php

<?php

namespace Pyz\Yves\MerchantProductOfferWidget;

use SprykerShop\Yves\MerchantProductOfferWidget\MerchantProductOfferWidgetDependencyProvider as SprykerMerchantProductOfferWidgetDependencyProvider;
use SprykerShop\Yves\MerchantProductWidget\Plugin\MerchantProductOfferWidget\MerchantProductMerchantProductOfferCollectionExpanderPlugin;

class MerchantProductOfferWidgetDependencyProvider extends SprykerMerchantProductOfferWidgetDependencyProvider
{
    /**
     * @return array<\SprykerShop\Yves\MerchantProductOfferWidgetExtension\Dependency\Plugin\MerchantProductOfferCollectionExpanderPluginInterface>
     */
    protected function getMerchantProductOfferCollectionExpanderPlugins(): array
    {
        return [
            new MerchantProductMerchantProductOfferCollectionExpanderPlugin(),
        ];
    }
}
Verification

Make sure that the offers select field obtained via MerchantProductOffersSelectWidget is extended with the corresponding merchant product if it exists.