Product + Order Management feature integration

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

Install Feature Core

Prerequisites

To start feature integration, overview and install the necessary features:

Feature Version
Product 202009.0
Order Management 202009.0
Spryker Core 202009.0

1) Install the required modules using Composer

Run the following command(s) to install the required modules

composer require spryker/sales-product-connector:"^1.4.0" --update-with-dependencies
Verification

Make sure that the following modules have been installed:

Module Expected Directory
SalesProductConnector vendor/spryker/sales-product-connector
### 2) Set up Transfer Objects Run the following command to generate transfer changes: ```bash console transfer:generate ```
Verification

Make sure that the following changes have been applied in transfer objects:

Transfer Type Event Path
Order.idSalesOrder property Created src/Generated/Shared/Transfer/OrderTransfer
Item.fkSalesOrder property Created src/Generated/Shared/Transfer/ItemTransfer

3) Set up Behavior

Register the following plugins: | Plugin | Specification | Prerequisites | Namespace | | — | — | — | — | | ItemMetadataSearchOrderExpanderPlugin | Expands items of each order with metadata information. | None | Spryker\Zed\SalesProductConnector\Communication\Plugin\Sales | | MetadataOrderItemExpanderPlugin | Expands order items with metadata information. | None | Spryker\Zed\SalesProductConnector\Communication\Plugin\Sales | | ProductIdOrderItemExpanderPlugin | Expands order items with abstract and concrete product ids. | None | Spryker\Zed\SalesProductConnector\Communication\Plugin\Sales

/src/Pyz/Zed/Sales/SalesDependencyProvider.php

<?php

namespace Pyz\Zed\Sales;

use Spryker\Zed\Sales\SalesDependencyProvider as SprykerSalesDependencyProvider;
use Spryker\Zed\SalesProductConnector\Communication\Plugin\Sales\ItemMetadataSearchOrderExpanderPlugin;
use Spryker\Zed\SalesProductConnector\Communication\Plugin\Sales\MetadataOrderItemExpanderPlugin;
use Spryker\Zed\SalesProductConnector\Communication\Plugin\Sales\ProductIdOrderItemExpanderPlugin;

class SalesDependencyProvider extends SprykerSalesDependencyProvider
{
    /**
     * @return \Spryker\Zed\SalesExtension\Dependency\Plugin\SearchOrderExpanderPluginInterface[]
     */
    protected function getSearchOrderExpanderPlugins(): array
    {
        return [
            new ItemMetadataSearchOrderExpanderPlugin(),
        ];
    }
    
    /**
     * @return \Spryker\Zed\SalesExtension\Dependency\Plugin\OrderItemExpanderPluginInterface[]
     */
    protected function getOrderItemExpanderPlugins(): array
    {
        return [
            new MetadataOrderItemExpanderPlugin(),
            new ProductIdOrderItemExpanderPlugin(),
        ];
    }
}
Verification

Make sure that every order item from SalesFacade::searchOrders() results contain metadata information.

Verification

Make sure that every order item from SalesFacade::getOrderItems() results contain product concrete/abstract IDs data. Make sure that every order item from SalesFacade::getOrderItems() results contain metadata information.