Alternative Products + Product Label feature integration
Edit on GitHubInstall Feature Core
Prerequisites
Please review and install the necessary features before beginning the integration. |Name|Version| |—|—| |Alternative Products|201903.0| |Product Label|201903.0|
1) Install the required modules using Composer
Run the following command to install the required modules:
composer require spryker/product-alternative-product-label-connector:"^1.0.0" --update-with-dependencies
Module | Expected Directory |
---|---|
`ProductAlternativeProductLabelConnector` | `vendor/spryker/product-alternative-product-label-connector` |
2) Import Data
Add Infrastructural Data
Plugin | Specification | Prerequisites | Namespace |
---|---|---|---|
ProductAlternativeProductLabelConnectorInstallerPlugin |
Installs the configured infrastructural alternative product labels. | None | Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin\Installer |
Add the following to your project:
src/Pyz/Zed/Installer/InstallerDependencyProvider.php
<?php
namespace Pyz\Zed\Installer;
use Spryker\Zed\Installer\InstallerDependencyProvider as SprykerInstallerDependencyProvider;
use Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin\Installer\ProductAlternativeProductLabelConnectorInstallerPlugin;
class InstallerDependencyProvider extends SprykerInstallerDependencyProvider
{
/**
* @return \Spryker\Zed\Installer\Dependency\Plugin\InstallerPluginInterface[]
*/
public function getInstallerPlugins()
{
return [
new ProductAlternativeProductLabelConnectorInstallerPlugin(),
];
}
}
Run the following console command to:
- Execute registered installer plugins
- Install the infrastructural data
console setup:init-db
3) Set up Behavior
Setup Alternative Products Labels Workflow
Enable the following behavior types by registering the plugins:
|Plugin|Specification|Prerequisites|Namespace|
|—|—|—|—|
|PostProductAlternativeCreatePlugin
|After the product alternative is created, adds product alternatives availability label to the abstract product.|None|Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin
|
|PostProductAlternativeDeletePlugin
|After the product alternative is deleted, removes product alternatives availability label from the abstract product.|None|Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin
|
|ProductAlternativeLabelUpdaterPlugin
|Used to persist alternative product label relation changes into the database.
The plugin is called when the ProductLabelRelationUpdaterConsole
command is executed.|None|Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin
|
src/Pyz/Zed/ProductAlternative/ProductAlternativeDependencyProvider.php
<?php
namespace Pyz\Zed\ProductAlternative;
use Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin\PostProductAlternativeCreatePlugin;
use Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin\PostProductAlternativeDeletePlugin;
use Spryker\Zed\ProductAlternative\ProductAlternativeDependencyProvider as SprykerProductAlternativeDependencyProvider;
class ProductAlternativeDependencyProvider extends SprykerProductAlternativeDependencyProvider
{
/**
* @return \Spryker\Zed\ProductAlternativeExtension\Dependency\Plugin\PostProductAlternativeCreatePluginInterface[]
*/
protected function getPostProductAlternativeCreatePlugins(): array
{
return [
new PostProductAlternativeCreatePlugin(),
];
}
/**
* @return \Spryker\Zed\ProductAlternativeExtension\Dependency\Plugin\PostProductAlternativeDeletePluginInterface[]
*/
protected function getPostProductAlternativeDeletePlugins(): array
{
return [
new PostProductAlternativeDeletePlugin(),
];
}
}
src/Pyz/Zed/ProductLabel/ProductLabelDependencyProvider.php
<?php
namespace Pyz\Zed\ProductLabel;
use Spryker\Zed\ProductAlternativeProductLabelConnector\Communication\Plugin\ProductAlternativeLabelUpdaterPlugin;
use Spryker\Zed\ProductLabel\ProductLabelDependencyProvider as SprykerProductLabelDependencyProvider;
class ProductLabelDependencyProvider extends SprykerProductLabelDependencyProvider
{
/**
* @return \Spryker\Zed\ProductLabel\Dependency\Plugin\ProductLabelRelationUpdaterPluginInterface[]
*/
protected function getProductLabelRelationUpdaterPlugins()
{
return [
new ProductAlternativeLabelUpdaterPlugin(),
];
}
}
When you add product alternatives, it adds the corresponding label to the product.
When you remove product alternatives, it removes the corresponding label from the product.
Thank you!
For submitting the form