Install the Marketplace Merchant Custom Prices feature
Edit on GitHubThis document describes how to integrate the Marketplace Merchant Custom Prices feature into a Spryker project.
Install feature core
Follow the steps below to install the Marketplace Merchant Custom Prices feature core.
Prerequisites
Install the required features:
NAME | VERSION | INSTALLATION GUIDE |
---|---|---|
Merchant Custom Prices | 202410.0 | Install the Merchant Custom Prices feature |
Marketplace Merchant Portal Product Management | 202410.0 | Install the Merchant Portal - Marketplace Product feature |
1) Install the required modules
Install the required modules using Composer:
composer require spryker-feature/marketplace-merchant-custom-prices:"202410.0" --with-dependencies
Make sure the following modules have been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
PriceProduct | vendor/spryker/price-product |
PriceProductMerchantRelationship | vendor/spryker/price-product-merchant-relationship |
PriceProductMerchantRelationshipMerchantPortalGui | vendor/spryker/price-product-merchant-relationship-merchant-portal-gui |
ProductMerchantPortalGui | vendor/spryker/product-merchant-portal-gui |
2) Set up transfer objects
Generate transfer changes:
console transfer:generate
Make sure the following changes have been applied in transfer objects:
TRANSFER | TYPE | EVENT | PATH |
---|---|---|---|
PriceProductTableView.idMerchantRelationship | property | Created | src/Generated/Shared/Transfer/PriceProductTableViewTransfer.php |
PriceProductTableView.merchantRelationshipName | property | Created | src/Generated/Shared/Transfer/PriceProductTableViewTransfer.php |
MerchantRelationshipFilter.merchantIds | property | Created | src/Generated/Shared/Transfer/MerchantRelationshipFilterTransfer.php |
3) Add Zed 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 |
---|---|---|---|
MerchantRelationshipPreBuildPriceProductGroupKeyPlugin | Extends the logic for the Price Product group key generation. | Spryker\Service\PriceProductMerchantRelationship\Plugin\PriceProduct | |
MerchantRelationshipVolumePriceProductValidatorPlugin | Validates volume prices. | Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\PriceProduct | |
MerchantRelationshipPriceProductCollectionDeletePlugin | Removes price product merchant relationships. | Spryker\Zed\PriceProductMerchantRelationship\Communication\Plugin\PriceProduct | |
MerchantRelationshipPriceProductTableFilterPlugin | Filters price product transfers. | Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui | |
MerchantRelationshipPriceProductAbstractTableConfigurationExpanderPlugin | Expands price product abstract table configuration. | Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui | |
MerchantRelationshipPriceProductConcreteTableConfigurationExpanderPlugin | Expands price product concrete table configuration. | Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui | |
MerchantRelationshipPriceProductMapperPlugin | Maps merchant relationship data. | Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui |
src/Pyz/Zed/ProductMerchantPortalGui/ProductMerchantPortalGuiDependencyProvider.php
<?php
namespace Pyz\Zed\ProductMerchantPortalGui;
use Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui\MerchantRelationshipPriceProductAbstractTableConfigurationExpanderPlugin;
use Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui\MerchantRelationshipPriceProductConcreteTableConfigurationExpanderPlugin;
use Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui\MerchantRelationshipPriceProductMapperPlugin;
use Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\ProductMerchantPortalGui\MerchantRelationshipPriceProductTableFilterPlugin;
use Spryker\Zed\ProductMerchantPortalGui\ProductMerchantPortalGuiDependencyProvider as SprykerProductMerchantPortalGuiDependencyProvider;
class ProductMerchantPortalGuiDependencyProvider extends SprykerProductMerchantPortalGuiDependencyProvider
{
/**
* @return array<\Spryker\Zed\ProductMerchantPortalGuiExtension\Dependency\Plugin\PriceProductTableFilterPluginInterface>
*/
protected function getPriceProductTableFilterPlugins(): array
{
return [
new MerchantRelationshipPriceProductTableFilterPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ProductMerchantPortalGuiExtension\Dependency\Plugin\PriceProductAbstractTableConfigurationExpanderPluginInterface>
*/
protected function getPriceProductAbstractTableConfigurationExpanderPlugins(): array
{
return [
new MerchantRelationshipPriceProductAbstractTableConfigurationExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ProductMerchantPortalGuiExtension\Dependency\Plugin\PriceProductConcreteTableConfigurationExpanderPluginInterface>
*/
protected function getPriceProductConcreteTableConfigurationExpanderPlugins(): array
{
return [
new MerchantRelationshipPriceProductConcreteTableConfigurationExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ProductMerchantPortalGuiExtension\Dependency\Plugin\PriceProductMapperPluginInterface>
*/
protected function getPriceProductMapperPlugins(): array
{
return [
new MerchantRelationshipPriceProductMapperPlugin(),
];
}
}
Log in to the Merchant Portal with a merchant that has at least one merchant relationship.
Open any merchant product and make sure that the Prices table contains the “Customer” column for both: abstract and concrete products.
Make sure that you can filter and sort the price table by Customer column.
src/Pyz/Service/PriceProduct/PriceProductDependencyProvider.php
<?php
namespace Pyz\Service\PriceProduct;
use Spryker\Service\PriceProduct\PriceProductDependencyProvider as SprykerPriceProductDependencyProvider;
use Spryker\Service\PriceProductMerchantRelationship\Plugin\PriceProduct\MerchantRelationshipPreBuildPriceProductGroupKeyPlugin;
class PriceProductDependencyProvider extends SprykerPriceProductDependencyProvider
{
/**
* @return array<int, \Spryker\Service\PriceProductExtension\Dependency\Plugin\PreBuildPriceProductGroupKeyPluginInterface>
*/
protected function getPreBuildPriceProductGroupKeyPlugins(): array
{
return [
new MerchantRelationshipPreBuildPriceProductGroupKeyPlugin(),
];
}
}
Open any merchant product with a regular price.
Create a customer-specific price with the same combination of currency and country as the existing price.
Make sure that there is no validation error.
src/Pyz/Zed/PriceProduct/PriceProductDependencyProvider.php
<?php
namespace Pyz\Zed\PriceProduct;
use Spryker\Zed\PriceProduct\PriceProductDependencyProvider as SprykerPriceProductDependencyProvider;
use Spryker\Zed\PriceProductMerchantRelationship\Communication\Plugin\PriceProduct\MerchantRelationshipPriceProductCollectionDeletePlugin;
use Spryker\Zed\PriceProductMerchantRelationshipMerchantPortalGui\Communication\Plugin\PriceProduct\MerchantRelationshipVolumePriceProductValidatorPlugin;
class PriceProductDependencyProvider extends SprykerPriceProductDependencyProvider
{
/**
* @return array<\Spryker\Zed\PriceProductExtension\Dependency\Plugin\PriceProductValidatorPluginInterface>
*/
protected function getPriceProductValidatorPlugins(): array
{
return [
new MerchantRelationshipVolumePriceProductValidatorPlugin(),
];
}
/**
* @return array<\Spryker\Zed\PriceProductExtension\Dependency\Plugin\PriceProductCollectionDeletePluginInterface>
*/
protected function getPriceProductCollectionDeletePlugins(): array
{
return [
new MerchantRelationshipPriceProductCollectionDeletePlugin(),
];
}
}
Make sure that you see the validation error while attempting to set or create the customer price for the volume price.
Make sure that you can delete the customer price.
5) Filter out product offer prices
This option is only available if you have the Marketplace Product Offer feature installed.
Enable the following behaviors by registering the plugins:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
PriceProductOfferPriceProductTableFilterPlugin (Optional) | Maps merchant relationship data. | Spryker\Zed\PriceProductOfferGui\Communication\Plugin\ProductMerchantPortalGui |
namespace Pyz\Zed\ProductMerchantPortalGui;
use Spryker\Zed\PriceProductOfferGui\Communication\Plugin\ProductMerchantPortalGui\PriceProductOfferPriceProductTableFilterPlugin;
use Spryker\Zed\ProductMerchantPortalGui\ProductMerchantPortalGuiDependencyProvider as SprykerProductMerchantPortalGuiDependencyProvider;
class ProductMerchantPortalGuiDependencyProvider extends SprykerProductMerchantPortalGuiDependencyProvider
{
/**
* @return array<\Spryker\Zed\ProductMerchantPortalGuiExtension\Dependency\Plugin\PriceProductTableFilterPluginInterface>
*/
protected function getPriceProductTableFilterPlugins(): array
{
return [
new PriceProductOfferPriceProductTableFilterPlugin(),
];
}
}
- Log in to the Merchant Portal with a merchant that has at least one merchant relationship and product offer.
- Open any product that has a product offer.
- Make sure that the Prices table does not contain product offer prices for both abstract and concrete products.
Thank you!
For submitting the form