Marketplace Product + Quick Add to Cart feature integration

Edit on GitHub

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

Install feature frontend

Follow the steps below to install the Marketplace Product + Quick Add to Cart feature frontend.

Prerequisites

To start feature integration, integrate the required features:

NAME VERSION INTEGRATION GUIDE
Marketplace Product 202204.0 Marketplace Product Feature Integration
Quick Add to Cart 202204.0 Install the Quick Add to Cart feature

Add translations

Add translations as follows:

  1. Append glossary for the feature:
merchant_search_widget.all_merchants,All Merchants,en_US
merchant_search_widget.all_merchants,Alle Händler,de_DE
merchant_search_widget.merchants,Merchants,en_US
merchant_search_widget.merchants,Händler,de_DE
  1. Import data:
console data:import glossary
Verification

Make sure that the configured data has been added to the spy_glossary_key and spy_glossary_translation tables in the database.

Set up widgets

Register the following plugins to enable widgets:

PLUGIN DESCRIPTION PREREQUISITES NAMESPACE
MerchantSearchWidget Provides a widget to render a merchants filter. SprykerShop\Yves\MerchantSearchWidget\Widget

src/Pyz/Yves/ShopApplication/ShopApplicationDependencyProvider.php

<?php

namespace Pyz\Yves\ShopApplication;

use SprykerShop\Yves\MerchantSearchWidget\Widget\MerchantSearchWidget;
use SprykerShop\Yves\ShopApplication\ShopApplicationDependencyProvider as SprykerShopApplicationDependencyProvider;

class ShopApplicationDependencyProvider extends SprykerShopApplicationDependencyProvider
{
    /**
     * @return array<string>
     */
    protected function getGlobalWidgets(): array
    {
        return [
            MerchantSearchWidget::class,
        ];
    }
}
Verification

Make sure that Quick Order Page contains “Merchant Selector” dropdown with all active merchants.

Make sure that selected merchant reference affects search results while retrieving for product by name or sku.

Set up behavior

Enable the following behaviors by registering the plugins:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
MerchantProductQuickOrderItemExpanderPlugin Expands the provided ItemTransfer with merchant reference. SprykerShop\Yves\MerchantProductWidget\Plugin\QuickOrderPage

src/Pyz/Yves/QuickOrderPage/QuickOrderPageDependencyProvider.php

<?php

namespace Pyz\Yves\QuickOrderPage;

use SprykerShop\Yves\MerchantProductWidget\Plugin\QuickOrderPage\MerchantProductQuickOrderItemExpanderPlugin;
use SprykerShop\Yves\QuickOrderPage\QuickOrderPageDependencyProvider as SprykerQuickOrderPageDependencyProvider;

class QuickOrderPageDependencyProvider extends SprykerQuickOrderPageDependencyProvider
{
    /**
     * @return array<\SprykerShop\Yves\QuickOrderPageExtension\Dependency\Plugin\QuickOrderItemExpanderPluginInterface>
     */
    protected function getQuickOrderItemTransferExpanderPlugins(): array
    {
        return [
            new MerchantProductQuickOrderItemExpanderPlugin(),
        ];
    }
}
Verification

Make sure that merchant related products are added to cart with the corresponding merchant in “Sold By” section.