Marketplace Product Approval Process feature integration
Edit on GitHubThis document describes how to integrate the Marketplace Product Approval Process feature into a Spryker project.
Install feature core
Follow the steps below to install the Marketplace Product Approval Process 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 |
Product Approval Process | 202204.0 | Product Approval Process feature integration |
1) Install the required modules using Сomposer
Install the required modules:
composer require spryker-feature/marketplace-product-approval-process:"202204.0" --update-with-dependencies
Make sure that the following modules have been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
MerchantProductApproval | vendor/spryker/merchant-product-approval |
MerchantProductApprovalDataImport | vendor/spryker/merchant-product-approval-data-import |
2) Set up database schema and transfer objects
Apply database changes and generate entity and transfer changes:
console transfer:generate
console propel:install
console transfer:generate
Make sure that the following changes have been applied by checking your database:
DATABASE ENTITY | TYPE | EVENT |
---|---|---|
spy_merchant.default_product_abstract_approval_status | column | added |
Make sure that the following changes have been triggered in transfer objects:
TRANSFER | TYPE | EVENT | PATH |
---|---|---|---|
ProductAbstractTransfer | class | created | src/Generated/Shared/Transfer/ProductAbstractTransfer |
MerchantProductCriteriaTransfer | class | created | src/Generated/Shared/Transfer/MerchantProductCriteriaTransfer |
MerchantProductTransfer | class | created | src/Generated/Shared/Transfer/MerchantProductTransfer |
MerchantTransfer | class | created | src/Generated/Shared/Transfer/MerchantTransfer |
DataImporterReaderConfigurationTransfer | class | created | src/Generated/Shared/Transfer/DataImporterReaderConfigurationTransfer |
DataImporterConfigurationTransfer | class | created | src/Generated/Shared/Transfer/DataImporterConfigurationTransfer |
DataImporterReportTransfer | class | created | src/Generated/Shared/Transfer/DataImporterReportTransfer |
3) Add translations
Generate new translation cache for Zed:
console translator:generate-cache
4) Set up behavior
Enable the following behaviors by registering the plugins:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
MerchantProductApprovalProductAbstractPreCreatePlugin | Expands product abstract transfer with default merchant product approval status when ProductAbstractTransfer::approvalStatus is null. |
None | Spryker\Zed\MerchantProductApproval\Communication\Plugin\Product |
src/Pyz/Zed/Product/ProductDependencyProvider.php
<?php
namespace Pyz\Zed\Product;
use Spryker\Zed\MerchantProductApproval\Communication\Plugin\Product\MerchantProductApprovalProductAbstractPreCreatePlugin;
use Spryker\Zed\Product\ProductDependencyProvider as SprykerProductDependencyProvider;
class ProductDependencyProvider extends SprykerProductDependencyProvider
{
/**
* @return array<\Spryker\Zed\ProductExtension\Dependency\Plugin\ProductAbstractPreCreatePluginInterface>
*/
protected function getProductAbstractPreCreatePlugins(): array
{
return [
new MerchantProductApprovalProductAbstractPreCreatePlugin(),
];
}
}
5) Import data
Follow the steps to import product approval data:
- Prepare data according to your requirements using the following demo data:
data/import/common/common/marketplace/merchant_product_approval_status_default.csv
merchant_reference,approval_status
MER000002,approved
COLUMN | Required | DATA TYPE | DATA EXAMPLE | DATA EXPLANATION |
---|---|---|---|---|
merchant_reference | ✓ | string | MER000002 | Unique merchant identifier. |
approval_status | ✓ | string | approved | Status (draft, waiting_for_approval, approved, denied). |
- Register the following data import plugins:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
MerchantProductApprovalStatusDefaultDataImportPlugin | Iterates over the data sets and imports merchant default product approval statuses into the database. | None | Spryker\Zed\MerchantProductApprovalDataImport\Communication\Plugin\DataImport |
src/Pyz/Zed/DataImport/DataImportDependencyProvider.php
<?php
namespace Pyz\Zed\DataImport;
use Spryker\Zed\MerchantProductApprovalDataImport\Communication\Plugin\DataImport\MerchantProductApprovalStatusDefaultDataImportPlugin;
use Spryker\Zed\DataImport\DataImportDependencyProvider as SprykerSynchronizationDependencyProvider;
class DataImportDependencyProvider extends SprykerDataImportDependencyProvider
{
/**
* @return array
*/
protected function getDataImporterPlugins(): array
{
return [
new MerchantProductApprovalStatusDefaultDataImportPlugin(),
];
}
}
- Import data:
console data:import merchant-product-approval-status-default
Make sure that statuses has been added to the spy_merchant
table.
Thank you!
For submitting the form