Install the Product Configuration feature
Edit on GitHubThis document describes how to install the Product Configuration feature.
Install feature core
Follow the steps below to install the Product Configuration feature core.
Prerequisites
Install the required features:
| NAME | VERSION | INSTALLATION GUIDE |
|---|---|---|
| Spryker Core | 202610.0 | Install the Spryker Core feature |
| Product | 202610.0 | Install the Product feature |
| Cart | 202610.0 | Install the Cart feature |
| Order Management | 202610.0 | Install the Order Management feature |
| Checkout | 202610.0 | Install the Checkout feature |
| Prices | 202610.0 | Install the Prices feature |
| Inventory Management | 202610.0 | Install the Inventory Management feature |
| Wishlist | 202610.0 | |
| ShoppingList | 202610.0 | Install the Shopping Lists feature |
1) Install the required modules
Install the required modules using Composer:
composer require "spryker-feature/configurable-product":"202610.0" --update-with-dependencies
Make sure that the following modules have been installed:
| MODULE | EXPECTED DIRECTORY |
|---|---|
| ProductConfiguration | vendor/spryker/product-configuration |
| ProductConfigurationCart | vendor/spryker/product-configuration-cart |
| ProductConfigurationDataImport | vendor/spryker/product-configuration-data-import |
| ProductConfigurationGui | vendor/spryker/product-configuration-gui |
| ProductConfigurationPersistentCart | vendor/spryker/product-configuration-persistent-cart |
| ProductConfigurationStorage | vendor/spryker/product-configuration-storage |
| ProductConfigurationWishlist | vendor/spryker/product-configuration-wishlist |
| ProductConfigurationShoppingList | vendor/spryker/product-configuration-shopping-list |
| SalesProductConfiguration | vendor/spryker/sales-product-configuration |
| SalesProductConfigurationGui | vendor/spryker/sales-product-configuration-gui |
2) Set up the configuration
Add the following configuration:
| CONFIGURATION | SPECIFICATION | NAMESPACE |
|---|---|---|
| ProductConfigurationConstants::SPRYKER_PRODUCT_CONFIGURATOR_ENCRYPTION_KEY | Provides an encryption key for checksum validation. It is used for the checksum generation of the product configurator data based on the provided key. | Spryker\Shared\ProductConfiguration\ProductConfigurationConstants |
| ProductConfigurationConstants::SPRYKER_PRODUCT_CONFIGURATOR_HEX_INITIALIZATION_VECTOR | Provides a hex initialization vector for the checksum validation. It is used as a hex initialization vector for the checksum generation of product configurator data. | Spryker\Shared\ProductConfiguration\ProductConfigurationConstants |
| KernelConstants::DOMAIN_WHITELIST | Defines a set of whitelist domains that every external URL is checked against before redirecting. | Spryker\Shared\Kernel\KernelConstants |
config/Shared/config_default.php
<?php
use Spryker\Shared\Kernel\KernelConstants;
use Spryker\Shared\ProductConfiguration\ProductConfigurationConstants;
// >>> Product Configuration
$config[ProductConfigurationConstants::SPRYKER_PRODUCT_CONFIGURATOR_ENCRYPTION_KEY] = getenv('SPRYKER_PRODUCT_CONFIGURATOR_ENCRYPTION_KEY') ?: 'change123';
$config[ProductConfigurationConstants::SPRYKER_PRODUCT_CONFIGURATOR_HEX_INITIALIZATION_VECTOR] = getenv('SPRYKER_PRODUCT_CONFIGURATOR_HEX_INITIALIZATION_VECTOR') ?: '0c1ffefeebdab4a3d839d0e52590c9a2';
$config[KernelConstants::DOMAIN_WHITELIST][] = getenv('SPRYKER_PRODUCT_CONFIGURATOR_HOST');
To make sure that the changes have been applied, check that the exemplary product configurator opens at http://date-time-configurator-example.mysprykershop.com.
You can control whether particular fields must be filtered out and not used for Product Configuration instance hash generation. You can do it through the ProductConfigurationConfig::getConfigurationFieldsNotAllowedForEncoding() config setting.
src/Pyz/Service/ProductConfiguration/ProductConfigurationConfig.php
<?php
namespace Pyz\Service\ProductConfiguration;
use Generated\Shared\Transfer\ProductConfigurationInstanceTransfer;
use Spryker\Service\ProductConfiguration\ProductConfigurationConfig as SprykerProductConfigurationConfig;
class ProductConfigurationConfig extends SprykerProductConfigurationConfig
{
/**
* @return list<string>
*/
public function getConfigurationFieldsNotAllowedForEncoding(): array
{
return [
ProductConfigurationInstanceTransfer::QUANTITY,
];
}
}
Specify only fields that are defined in the transfer definition. Otherwise, you must define them on the project level.
src/Pyz/Shared/ProductConfiguration/Transfer/product_configuration.transfer.xml
<?xml version="1.0"?>
<transfers xmlns="spryker:transfer-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="spryker:transfer-01 http://static.spryker.com/transfer-01.xsd">
<transfer name="ProductConfigurationInstance">
<property name="quantity" type="int"/>
</transfer>
</transfers>
In the Configurator Setup tab of the Edit Concrete Product page, Back Office users download and upload the configuration files of products. To define the files that the tab accepts and how it names the downloaded files, add the following configuration:
| CONFIGURATION | SPECIFICATION | NAMESPACE |
|---|---|---|
| ProductConfigurationGuiConfig::getConfigurationFileMimeTypesByExtension() | Returns the file extensions of configuration files and the MIME types allowed for each extension. An uploaded file must have one of the extensions and one of its MIME types. By default, any file is accepted. | Pyz\Zed\ProductConfigurationGui |
| ProductConfigurationGuiConfig::getConfigurationFileExtensionsByConfiguratorKey() | Returns the file extension of the configuration files of each product configurator, indexed by configurator key. A configuration file is downloaded as {SKU}.{extension}, and an uploaded file must have the extension of the product configurator it belongs to. |
Pyz\Zed\ProductConfigurationGui |
| ProductConfigurationGuiConfig::getConfigurationFileMaxSize() | Returns the maximum size of an uploaded configuration file. The default value is 1M. |
Pyz\Zed\ProductConfigurationGui |
| ProductConfigurationGuiConfig::getConfiguratorSetupIntroTranslationKey() ProductConfigurationGuiConfig::getConfiguratorSetupStepTranslationKeys() ProductConfigurationGuiConfig::getConfiguratorSetupNoteTranslationKey() |
Return the translation keys of the instructions in the Configurator Setup tab. Each text receives the supported file formats as the %formats% parameter. By default, the tab shows instructions that fit any file format. |
Pyz\Zed\ProductConfigurationGui |
src/Pyz/Zed/ProductConfigurationGui/ProductConfigurationGuiConfig.php
<?php
namespace Pyz\Zed\ProductConfigurationGui;
use Spryker\Zed\ProductConfigurationGui\ProductConfigurationGuiConfig as SprykerProductConfigurationGuiConfig;
class ProductConfigurationGuiConfig extends SprykerProductConfigurationGuiConfig
{
protected const string FILE_EXTENSION_JSON = 'json';
protected const string CONFIGURATOR_KEY = 'YOUR_CONFIGURATOR_KEY';
/**
* @return array<string, list<string>>
*/
public function getConfigurationFileMimeTypesByExtension(): array
{
return [
static::FILE_EXTENSION_JSON => ['application/json', 'text/plain'],
];
}
/**
* @return array<string, string>
*/
public function getConfigurationFileExtensionsByConfiguratorKey(): array
{
return [
static::CONFIGURATOR_KEY => static::FILE_EXTENSION_JSON,
];
}
}
The server detects the MIME type of an uploaded file from its content and can detect a JSON file as text/plain, so the example allows both MIME types for the json extension. Replace YOUR_CONFIGURATOR_KEY with the key of your product configurator.
3) Set up database schema and transfer objects
- For entity changes to trigger events, adjust the schema definition:
src/Pyz/Zed/ProductConfiguration/Persistence/Propel/Schema/spy_product_configuration.schema.xml
<?xml version="1.0"?>
<database xmlns="spryker:schema-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="zed" xsi:schemaLocation="spryker:schema-01 https://static.spryker.com/schema-01.xsd" namespace="Orm\Zed\ProductConfiguration\Persistence" package="src.Orm.Zed.ProductConfiguration.Persistence">
<table name="spy_product_configuration">
<behavior name="event">
<parameter name="spy_product_configuration_all" column="*"/>
</behavior>
</table>
</database>
| AFFECTED ENTITY | TRIGGERED EVENTS |
|---|---|
| spy_product_configuration | Entity.spy_product_configuration.create Entity.spy_product_configuration.update Entity.spy_product_configuration.delete |
src/Pyz/Zed/ProductConfigurationStorage/Persistence/Propel/Schema/spy_product_configuration_storage.schema.xml
<?xml version="1.0"?>
<database xmlns="spryker:schema-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="zed" xsi:schemaLocation="spryker:schema-01 https://static.spryker.com/schema-01.xsd" namespace="Orm\Zed\ProductConfigurationStorage\Persistence" package="src.Orm.Zed.ProductConfigurationStorage.Persistence">
<table name="spy_product_configuration_storage">
<behavior name="synchronization">
<parameter name="queue_pool" value="synchronizationPool"/>
</behavior>
</table>
</database>
- 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_product_configuration | table | created |
| spy_product_configuration_storage | table | created |
| spy_sales_order_item_configuration | table | created |
| spy_wishlist_item.product_configuration_instance_data | column | added |
| spy_shopping_list_item.product_configuration_instance_data | column | added |
Make sure that the following changes have been triggered in transfer objects:
| TRANSFER | TYPE | EVENT | PATH |
|---|---|---|---|
| CartChangeTransfer | class | created | src/Generated/Shared/Transfer/CartChangeTransfer |
| CartItemQuantityTransfer | class | created | src/Generated/Shared/Transfer/CartItemQuantityTransfer |
| CheckoutErrorTransfer | class | created | src/Generated/Shared/Transfer/CheckoutErrorTransfer |
| CheckoutResponseTransfer | class | created | src/Generated/Shared/Transfer/CheckoutResponseTransfer |
| CompanyUserTransfer | class | created | src/Generated/Shared/Transfer/CompanyUserTransfer |
| CurrencyTransfer | class | created | src/Generated/Shared/Transfer/CurrencyTransfer |
| CustomerTransfer | class | created | src/Generated/Shared/Transfer/CustomerTransfer |
| DataImporterConfigurationTransfer | class | created | src/Generated/Shared/Transfer/DataImporterConfigurationTransfer |
| DataImporterReportTransfer | class | created | src/Generated/Shared/Transfer/DataImporterReportTransfer |
| ErrorCollectionTransfer | class | created | src/Generated/Shared/Transfer/ErrorCollectionTransfer |
| ErrorTransfer | class | created | src/Generated/Shared/Transfer/ErrorTransfer |
| ErrorTransfer.parameters | property | added | src/Generated/Shared/Transfer/ErrorTransfer |
| FilterTransfer | class | created | src/Generated/Shared/Transfer/FilterTransfer |
| ItemTransfer | class | created | src/Generated/Shared/Transfer/ItemTransfer |
| ItemReplaceTransfer | class | created | src/Generated/Shared/Transfer/ItemReplaceTransfer |
| MessageTransfer | class | created | src/Generated/Shared/Transfer/MessageTransfer |
| MoneyValueTransfer | class | created | src/Generated/Shared/Transfer/MoneyValueTransfer |
| OrderTransfer | class | created | src/Generated/Shared/Transfer/OrderTransfer |
| PaginationTransfer | class | created | src/Generated/Shared/Transfer/PaginationTransfer |
| PersistentCartChangeTransfer | class | created | src/Generated/Shared/Transfer/PersistentCartChangeTransfer |
| PriceProductTransfer | class | created | src/Generated/Shared/Transfer/PriceProductTransfer |
| PriceProductDimensionTransfer | class | created | src/Generated/Shared/Transfer/PriceProductDimensionTransfer |
| PriceProductFilterTransfer | class | created | src/Generated/Shared/Transfer/PriceProductFilterTransfer |
| ProductConcreteTransfer | class | created | src/Generated/Shared/Transfer/ProductConcreteTransfer |
| ProductConcreteTransfer.productConfigurationFile | property | added | src/Generated/Shared/Transfer/ProductConcreteTransfer |
| ProductConfigurationTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationTransfer |
| ProductConfigurationTransfer.updatedAt | property | added | src/Generated/Shared/Transfer/ProductConfigurationTransfer |
| ProductConfigurationAggregationTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationAggregationTransfer |
| ProductConfigurationCollectionRequestTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationCollectionRequestTransfer |
| ProductConfigurationCollectionResponseTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationCollectionResponseTransfer |
| ProductConfigurationCollectionTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationCollectionTransfer |
| ProductConfigurationConditionsTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationConditionsTransfer |
| ProductConfigurationCriteriaTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationCriteriaTransfer |
| ProductConfigurationFileTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationFileTransfer |
| ProductConfigurationFilterTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationFilterTransfer |
| ProductConfigurationInstanceTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationInstanceTransfer |
| ProductConfigurationInstanceCollectionTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationInstanceCollectionTransfer |
| ProductConfigurationInstanceConditionsTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationInstanceConditionsTransfer |
| ProductConfigurationInstanceCriteriaTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationInstanceCriteriaTransfer |
| ProductConfigurationSetupTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationSetupTransfer |
| ProductConfigurationStorageTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationStorageTransfer |
| ProductConfigurationSummaryTemplateTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationSummaryTemplateTransfer |
| ProductConfigurationTemplateCollectionTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationTemplateCollectionTransfer |
| ProductConfigurationTemplateConditionsTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationTemplateConditionsTransfer |
| ProductConfigurationTemplateCriteriaTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationTemplateCriteriaTransfer |
| ProductConfigurationTemplateFileTransfer | class | created | src/Generated/Shared/Transfer/ProductConfigurationTemplateFileTransfer |
| ProductConfiguratorPageResponseTransfer | class | created | src/Generated/Shared/Transfer/ProductConfiguratorPageResponseTransfer |
| ProductConfiguratorRedirectTransfer | class | created | src/Generated/Shared/Transfer/ProductConfiguratorRedirectTransfer |
| ProductConfiguratorRequestTransfer | class | created | src/Generated/Shared/Transfer/ProductConfiguratorRequestTransfer |
| ProductConfiguratorRequestDataTransfer | class | created | src/Generated/Shared/Transfer/ProductConfiguratorRequestDataTransfer |
| ProductConfiguratorResponseTransfer | class | created | src/Generated/Shared/Transfer/ProductConfiguratorResponseTransfer |
| ProductConfiguratorResponseProcessorResponseTransfer | class | created | src/Generated/Shared/Transfer/ProductConfiguratorResponseProcessorResponseTransfer |
| ProductStorageCriteriaTransfer | class | created | src/Generated/Shared/Transfer/ProductStorageCriteriaTransfer |
| ProductViewTransfer | class | created | src/Generated/Shared/Transfer/ProductViewTransfer |
| QuoteTransfer | class | created | src/Generated/Shared/Transfer/QuoteTransfer |
| QuoteErrorTransfer | class | created | src/Generated/Shared/Transfer/QuoteErrorTransfer |
| QuoteRequestTransfer | class | created | src/Generated/Shared/Transfer/QuoteRequestTransfer |
| QuoteRequestResponseTransfer | class | created | src/Generated/Shared/Transfer/QuoteRequestResponseTransfer |
| QuoteRequestVersionTransfer | class | created | src/Generated/Shared/Transfer/QuoteRequestVersionTransfer |
| QuoteResponseTransfer | class | created | src/Generated/Shared/Transfer/QuoteResponseTransfer |
| SalesOrderItemConfigurationTransfer | class | created | src/Generated/Shared/Transfer/SalesOrderItemConfigurationTransfer |
| SalesOrderItemConfigurationFilterTransfer | class | created | src/Generated/Shared/Transfer/SalesOrderItemConfigurationFilterTransfer |
| SalesProductConfigurationTemplateTransfer | class | created | src/Generated/Shared/Transfer/SalesProductConfigurationTemplateTransfer |
| SaveOrderTransfer | class | created | src/Generated/Shared/Transfer/SaveOrderTransfer |
| ShoppingListTransfer | class | created | src/Generated/Shared/Transfer/ShoppingListTransfer |
| ShoppingListItemTransfer | class | created | src/Generated/Shared/Transfer/ShoppingListItemTransfer |
| ShoppingListItemCollectionTransfer | class | created | src/Generated/Shared/Transfer/ShoppingListItemCollectionTransfer |
| ShoppingListItemResponseTransfer | class | created | src/Generated/Shared/Transfer/ShoppingListItemResponseTransfer |
| ShoppingListPreAddItemCheckResponseTransfer | class | created | src/Generated/Shared/Transfer/ShoppingListPreAddItemCheckResponseTransfer |
| SortTransfer | class | created | src/Generated/Shared/Transfer/SortTransfer |
| StoreTransfer | class | created | src/Generated/Shared/Transfer/StoreTransfer |
| SynchronizationDataTransfer | class | created | src/Generated/Shared/Transfer/SynchronizationDataTransfer |
| WishlistTransfer | class | created | src/Generated/Shared/Transfer/WishlistTransfer |
| WishlistItemTransfer | class | created | src/Generated/Shared/Transfer/WishlistItemTransfer |
| WishlistItemCollectionTransfer | class | created | src/Generated/Shared/Transfer/WishlistItemCollectionTransfer |
| WishlistItemCriteriaTransfer | class | created | src/Generated/Shared/Transfer/WishlistItemCriteriaTransfer |
| WishlistItemMetaTransfer | class | created | src/Generated/Shared/Transfer/WishlistItemMetaTransfer |
| WishlistItemResponseTransfer | class | created | src/Generated/Shared/Transfer/WishlistItemResponseTransfer |
| WishlistMoveToCartRequestTransfer | class | created | src/Generated/Shared/Transfer/WishlistMoveToCartRequestTransfer |
| WishlistMoveToCartRequestCollectionTransfer | class | created | src/Generated/Shared/Transfer/WishlistMoveToCartRequestCollectionTransfer |
| WishlistPreAddItemCheckResponseTransfer | class | created | src/Generated/Shared/Transfer/WishlistPreAddItemCheckResponseTransfer |
| WishlistPreUpdateItemCheckResponseTransfer | class | created | src/Generated/Shared/Transfer/WishlistPreUpdateItemCheckResponseTransfer |
4) Set up behavior
Set up the following behaviors:
- Set up Publishers and a Queue processor:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationWritePublisherPlugin | Updates product configuration when triggered by provided product configuration events. | None | Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Publisher\ProductConfiguration |
| ProductConfigurationDeletePublisherPlugin | Removes all data from the product configuration storage when triggered by provided product configuration events. | None | Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Publisher\ProductConfiguration |
| SynchronizationStorageQueueMessageProcessorPlugin | Reads messages from the synchronization queue and saves them to the storage. | None | \Spryker\Zed\Synchronization\Communication\Plugin\Queue |
src/Pyz/Zed/Publisher/PublisherDependencyProvider.php
<?php
namespace Pyz\Zed\Publisher;
use Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Publisher\ProductConfiguration\ProductConfigurationDeletePublisherPlugin;
use Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Publisher\ProductConfiguration\ProductConfigurationWritePublisherPlugin;
use Spryker\Zed\Publisher\PublisherDependencyProvider as SprykerPublisherDependencyProvider;
class PublisherDependencyProvider extends SprykerPublisherDependencyProvider
{
/**
* @return array<int|string, \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface>|array<string, array<int|string, \Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface>>
*/
protected function getPublisherPlugins(): array
{
return array_merge(
$this->getProductConfigurationStoragePlugins()
);
}
/**
* @return array<\Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface>
*/
protected function getProductConfigurationStoragePlugins(): array
{
return [
new ProductConfigurationWritePublisherPlugin(),
new ProductConfigurationDeletePublisherPlugin(),
];
}
}
src/Pyz/Zed/Queue/QueueDependencyProvider.php
<?php
namespace Pyz\Zed\Queue;
use Spryker\Shared\ProductConfigurationStorage\ProductConfigurationStorageConfig;
use Spryker\Zed\Kernel\Container;
use Spryker\Zed\Queue\QueueDependencyProvider as SprykerDependencyProvider;
use Spryker\Zed\Synchronization\Communication\Plugin\Queue\SynchronizationStorageQueueMessageProcessorPlugin;
class QueueDependencyProvider extends SprykerDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return array<\Spryker\Zed\Queue\Dependency\Plugin\QueueMessageProcessorPluginInterface>
*/
protected function getProcessorMessagePlugins(Container $container): array
{
return [
ProductConfigurationStorageConfig::PRODUCT_CONFIGURATION_SYNC_STORAGE_QUEUE => new SynchronizationStorageQueueMessageProcessorPlugin(),
];
}
}
src/Pyz/Client/RabbitMq/RabbitMqConfig.php
<?php
namespace Pyz\Client\RabbitMq;
use Spryker\Shared\ProductConfigurationStorage\ProductConfigurationStorageConfig;
use Spryker\Client\RabbitMq\RabbitMqConfig as SprykerRabbitMqConfig;
class RabbitMqConfig extends SprykerRabbitMqConfig
{
/**
* QueueNameFoo, // Queue => QueueNameFoo, (Queue and error queue will be created: QueueNameFoo and QueueNameFoo.error)
* QueueNameBar => [
* RoutingKeyFoo => QueueNameBaz, // (Additional queues can be defined by several routing keys)
* ],
*
* @see https://www.rabbitmq.com/tutorials/amqp-concepts.html
*
* @return array<mixed>
*/
protected function getQueueConfiguration(): array
{
return [
ProductConfigurationStorageConfig::PRODUCT_CONFIGURATION_SYNC_STORAGE_QUEUE,
];
}
}
Make sure that, after creating a product configuration, you can find the corresponding record in the spy_product_configuration_storage table.
- Set up, regenerate, and resync features by setting up the following plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationPublisherTriggerPlugin | Triggers publish events for product configuration data. | None | Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Publisher |
| ProductConfigurationSynchronizationDataRepositoryPlugin | Allows synchronizing the content of the entire spy_product_configuration_storage table into the storage. |
None | Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Synchronization |
src/Pyz/Zed/Publisher/PublisherDependencyProvider.php
<?php
namespace Pyz\Zed\Publisher;
use Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Publisher\ProductConfigurationPublisherTriggerPlugin;
use Spryker\Zed\Publisher\PublisherDependencyProvider as SprykerPublisherDependencyProvider;
class PublisherDependencyProvider extends SprykerPublisherDependencyProvider
{
/**
* @return array<\Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherTriggerPluginInterface>
*/
protected function getPublisherTriggerPlugins(): array
{
return [
new ProductConfigurationPublisherTriggerPlugin(),
];
}
}
src/Pyz/Zed/ProductConfigurationStorage/ProductConfigurationStorageConfig.php
<?PHP
namespace Pyz\Zed\ProductConfigurationStorage;
use Pyz\Zed\Synchronization\SynchronizationConfig;
use Spryker\Zed\ProductConfigurationStorage\ProductConfigurationStorageConfig as SprykerProductConfigurationStorageConfig;
class ProductConfigurationStorageConfig extends SprykerProductConfigurationStorageConfig
{
/**
* @return string|null
*/
public function getProductConfigurationSynchronizationPoolName(): ?string
{
return SynchronizationConfig::DEFAULT_SYNCHRONIZATION_POOL_NAME;
}
}
src/Pyz/Zed/Synchronization/SynchronizationDependencyProvider.php
<?php
namespace Pyz\Zed\Synchronization;
use Spryker\Zed\ProductConfigurationStorage\Communication\Plugin\Synchronization\ProductConfigurationSynchronizationDataRepositoryPlugin;
use Spryker\Zed\Synchronization\SynchronizationDependencyProvider as SprykerSynchronizationDependencyProvider;
class SynchronizationDependencyProvider extends SprykerSynchronizationDependencyProvider
{
/**
* @return array<\Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataPluginInterface>
*/
protected function getSynchronizationDataPlugins(): array
{
return [
new ProductConfigurationSynchronizationDataRepositoryPlugin(),
];
}
}
Make sure that the product configuration trigger plugin works correctly:
- Fill the
spy_product_configurationtable with some data. - Run the
console publish:trigger-events -r product_configurationcommand. - Make sure that the
spy_product_configuration_storagetable has been filled with respective data. - In your system, make sure that storage entries are displayed with the
kv:product_configuration:skumask.
Make sure that the product configuration synchronization plugin works correctly:
- Fill the
spy_product_configuration_storagetable with some data. - Run the
console sync:data product_configurationcommand. - In your system, make sure that the storage entries are displayed with the
kv:product_configuration:skumask.
- Set up quantity counter plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationCartItemQuantityCounterStrategyPlugin | Finds a provided item in a provided cart. Counts the item quantity by the item SKU and the product configuration instance. Returns the item quantity. | None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Availability |
| ProductConfigurationCartItemQuantityCounterStrategyPlugin | Finds a provided item in a provided cart. Counts the item quantity by the item SKU and the product configuration instance. Returns the item quantity. | None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\AvailabilityCartConnector |
| ProductConfigurationCartItemQuantityCounterStrategyPlugin | Finds a provided item in a provided changed cart. Counts the item quantity by the item SKU and the product configuration instance in add and subtract directions. Returns the item quantity. | None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\PriceCartConnector |
src/Pyz/Zed/Availability/AvailabilityDependencyProvider.php
<?php
namespace Pyz\Zed\Availability;
use Spryker\Zed\Availability\AvailabilityDependencyProvider as SprykerAvailabilityDependencyProvider;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Availability\ProductConfigurationCartItemQuantityCounterStrategyPlugin;
class AvailabilityDependencyProvider extends SprykerAvailabilityDependencyProvider
{
/**
* @return array<\Spryker\Zed\AvailabilityExtension\Dependency\Plugin\CartItemQuantityCounterStrategyPluginInterface>
*/
protected function getCartItemQuantityCounterStrategyPlugins(): array
{
return [
new ProductConfigurationCartItemQuantityCounterStrategyPlugin(),
];
}
}
src/Pyz/Zed/AvailabilityCartConnector/AvailabilityCartConnectorDependencyProvider.php
<?php
namespace Pyz\Zed\AvailabilityCartConnector;
use Spryker\Zed\AvailabilityCartConnector\AvailabilityCartConnectorDependencyProvider as SprykerAbstractBundleDependencyProvider;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\AvailabilityCartConnector\ProductConfigurationCartItemQuantityCounterStrategyPlugin;
class AvailabilityCartConnectorDependencyProvider extends SprykerAbstractBundleDependencyProvider
{
/**
* @return array<\Spryker\Zed\AvailabilityCartConnectorExtension\Dependency\Plugin\CartItemQuantityCounterStrategyPluginInterface>
*/
public function getCartItemQuantityCounterStrategyPlugins(): array
{
return [
new ProductConfigurationCartItemQuantityCounterStrategyPlugin(),
];
}
}
src/Pyz/Zed/PriceCartConnector/PriceCartConnectorDependencyProvider.php
<?php
namespace Pyz\Zed\PriceCartConnector;
use Spryker\Zed\PriceCartConnector\PriceCartConnectorDependencyProvider as SprykerPriceCartConnectorDependencyProvider;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\PriceCartConnector\ProductConfigurationCartItemQuantityCounterStrategyPlugin;
class PriceCartConnectorDependencyProvider extends SprykerPriceCartConnectorDependencyProvider
{
/**
* @return array<\Spryker\Zed\PriceCartConnectorExtension\Dependency\Plugin\CartItemQuantityCounterStrategyPluginInterface>
*/
protected function getCartItemQuantityCounterStrategyPlugins(): array
{
return [
new ProductConfigurationCartItemQuantityCounterStrategyPlugin(),
];
}
}
Make sure that the product configuration item quantity counter plugins work correctly:
- Configure a configurable product.
- Add the product to the cart.
- Make sure that the product has been successfully added to the cart.
- Set up cart plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationGroupKeyItemExpanderPlugin | Expands the items that have a product configuration instance property with a group key. | None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Cart |
| ProductConfigurationCartChangeRequestExpanderPlugin | Expands provided changed cart items with product configuration instances. | None | Spryker\Client\ProductConfigurationCart\Plugin\Cart |
| ProductConfigurationPersistentCartRequestExpanderPlugin | Expands provided changed persistent cart items with product configuration instances. | None | Spryker\Client\ProductConfigurationPersistentCart\Plugin\PersistentCart |
src/Pyz/Zed/Cart/CartDependencyProvider.php
<?php
namespace Pyz\Zed\Cart;
use Spryker\Zed\Cart\CartDependencyProvider as SprykerCartDependencyProvider;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Cart\ProductConfigurationGroupKeyItemExpanderPlugin;
class CartDependencyProvider extends SprykerCartDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return array<\Spryker\Zed\CartExtension\Dependency\Plugin\ItemExpanderPluginInterface>
*/
protected function getExpanderPlugins(Container $container): array
{
return [
new ProductConfigurationGroupKeyItemExpanderPlugin(),
];
}
}
src/Pyz/Client/Cart/CartDependencyProvider.php
<?php
namespace Pyz\Client\Cart;
use Spryker\Client\Cart\CartDependencyProvider as SprykerCartDependencyProvider;
use Spryker\Client\ProductConfigurationCart\Plugin\Cart\ProductConfigurationCartChangeRequestExpanderPlugin;
class CartDependencyProvider extends SprykerCartDependencyProvider
{
/**
* @return array<\Spryker\Client\CartExtension\Dependency\Plugin\CartChangeRequestExpanderPluginInterface>
*/
protected function getAddItemsRequestExpanderPlugins()
{
return [
new ProductConfigurationCartChangeRequestExpanderPlugin(),
];
}
}
src/Pyz/Client/PersistentCart/PersistentCartDependencyProvider.php
<?php
namespace Pyz\Client\PersistentCart;
use Spryker\Client\PersistentCart\PersistentCartDependencyProvider as SprykerPersistentCartDependencyProvider;
use Spryker\Client\ProductConfigurationPersistentCart\Plugin\PersistentCart\ProductConfigurationPersistentCartRequestExpanderPlugin;
class PersistentCartDependencyProvider extends SprykerPersistentCartDependencyProvider
{
/**
* @return array<\Spryker\Client\PersistentCartExtension\Dependency\Plugin\PersistentCartChangeExpanderPluginInterface>
*/
protected function getChangeRequestExtendPlugins(): array
{
return [
new ProductConfigurationPersistentCartRequestExpanderPlugin(),
];
}
}
Make sure that the cart plugins work correctly:
- Configure a configurable product.
- Add the configured product to the cart.
- Make sure that the product has been successfully added to the cart.
- Set up checkout plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationCheckoutPreConditionPlugin | Returns true if all product configuration items in a quote are complete. Otherwise, returns false. |
None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Checkout |
src/Pyz/Zed/Checkout/CheckoutDependencyProvider.php
<?php
namespace Pyz\Zed\Checkout;
use Spryker\Zed\Checkout\CheckoutDependencyProvider as SprykerCheckoutDependencyProvider;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Checkout\ProductConfigurationCheckoutPreConditionPlugin;
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
*/
protected function getCheckoutPreConditions(Container $container): array
{
return [
new ProductConfigurationCheckoutPreConditionPlugin(),
];
}
}
Make sure that checkout plugins work correctly:
- Add a configurable product to the cart without completing its configuration.
- Try to place an order with the product.
- Make sure that the order is not placed and you get an error message about incomplete configuration.
- Set up product management plugins.
The Configurator Setup tab of the Edit Concrete Product page lets Back Office users set up the configuration of a product with a configuration file. To mark configurable products in the product table and add the tab, register the following plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationProductTableDataBulkExpanderPlugin | Expands product items with a configurable product type if they have a configuration. | None | Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement |
| ProductConfigurationProductConcreteFormEditTabsExpanderPlugin | Adds the Configurator Setup tab to the Edit Concrete Product page. Register the plugin as the last one of the stack, so the tab is the last tab of the page. | None | Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement |
| ProductConfigurationProductConcreteFormEditDataProviderExpanderPlugin | Adds the data of the Configurator Setup tab to the form data of the concrete product: the saved product configuration and the keys of the product configurators that provide a template. | None | Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement |
| ProductConfigurationProductConcreteEditFormExpanderPlugin | Adds the configuration file field to the concrete product form. On submit, validates the size and the format of the uploaded file, and then its content with the validator plugin of the product configurator that recognizes the file. | ProductConfigurationProductConcreteFormEditDataProviderExpanderPlugin | Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement |
| ProductConfigurationProductFormTransferMapperExpanderPlugin | Maps the uploaded configuration file to ProductConcreteTransfer.productConfigurationFile. |
None | Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement |
| ProductConfigurationProductConcretePostUpdatePlugin | Saves the uploaded configuration file as the default configuration of the product configuration of the concrete product, or creates the product configuration. Saves the configuration as incomplete and adds a message with the result. | ProductConfigurationProductFormTransferMapperExpanderPlugin | Spryker\Zed\ProductConfigurationGui\Communication\Plugin\Product |
src/Pyz/Zed/ProductManagement/ProductManagementDependencyProvider.php
<?php
namespace Pyz\Zed\ProductManagement;
use Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement\ProductConfigurationProductConcreteEditFormExpanderPlugin;
use Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement\ProductConfigurationProductConcreteFormEditDataProviderExpanderPlugin;
use Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement\ProductConfigurationProductConcreteFormEditTabsExpanderPlugin;
use Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement\ProductConfigurationProductFormTransferMapperExpanderPlugin;
use Spryker\Zed\ProductConfigurationGui\Communication\Plugin\ProductManagement\ProductConfigurationProductTableDataBulkExpanderPlugin;
use Spryker\Zed\ProductManagement\ProductManagementDependencyProvider as SprykerProductManagementDependencyProvider;
class ProductManagementDependencyProvider extends SprykerProductManagementDependencyProvider
{
/**
* @return array<\Spryker\Zed\ProductManagementExtension\Dependency\Plugin\ProductTableDataBulkExpanderPluginInterface>
*/
protected function getProductTableDataBulkExpanderPlugins(): array
{
return [
new ProductConfigurationProductTableDataBulkExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ProductManagementExtension\Dependency\Plugin\ProductConcreteFormEditTabsExpanderPluginInterface>
*/
protected function getProductConcreteFormEditTabsExpanderPlugins(): array
{
return [
new ProductConfigurationProductConcreteFormEditTabsExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ProductManagementExtension\Dependency\Plugin\ProductConcreteFormEditDataProviderExpanderPluginInterface>
*/
protected function getProductConcreteFormEditDataProviderExpanderPlugins(): array
{
return [
new ProductConfigurationProductConcreteFormEditDataProviderExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ProductManagementExtension\Dependency\Plugin\ProductConcreteEditFormExpanderPluginInterface>
*/
protected function getProductConcreteEditFormExpanderPlugins(): array
{
return [
new ProductConfigurationProductConcreteEditFormExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ProductManagementExtension\Dependency\Plugin\ProductFormTransferMapperExpanderPluginInterface>
*/
protected function getProductFormTransferMapperExpanderPlugins(): array
{
return [
new ProductConfigurationProductFormTransferMapperExpanderPlugin(),
];
}
}
src/Pyz/Zed/Product/ProductDependencyProvider.php
<?php
namespace Pyz\Zed\Product;
use Spryker\Zed\Kernel\Container;
use Spryker\Zed\Product\ProductDependencyProvider as SprykerProductDependencyProvider;
use Spryker\Zed\ProductConfigurationGui\Communication\Plugin\Product\ProductConfigurationProductConcretePostUpdatePlugin;
class ProductDependencyProvider extends SprykerProductDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return array<\Spryker\Zed\Product\Dependency\Plugin\ProductConcretePluginUpdateInterface>
*/
protected function getProductConcreteAfterUpdatePlugins(Container $container): array
{
return [
new ProductConfigurationProductConcretePostUpdatePlugin(),
];
}
}
Check that product management plugins work correctly:
- Add the configuration to the product using data import.
- In the Back Office, go to Catalog > Products.
- Find a product with a configuration that you created before.
- Check that product is marked as configurable.
- Next to the product, click Edit. On the Variants tab, click Edit next to a product variant.
- Check that the Configurator Setup tab is displayed as the last tab of the Edit Concrete Product page.
To check that a configuration file is saved, follow the verification steps in Build Zed UI frontend.
- Set up sales plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationOrderItemExpanderPlugin | Expands items with product configuration. | None | Spryker\Zed\SalesProductConfiguration\Communication\Plugin\Sales |
src/Pyz/Zed/Sales/SalesDependencyProvider.php
<?php
namespace Pyz\Zed\Sales;
use Spryker\Zed\Sales\SalesDependencyProvider as SprykerSalesDependencyProvider;
use Spryker\Zed\SalesProductConfiguration\Communication\Plugin\Sales\ProductConfigurationOrderItemExpanderPlugin;
use Spryker\Zed\SalesProductConfiguration\Communication\Plugin\Sales\ProductConfigurationOrderItemsPostSavePlugin;
class SalesDependencyProvider extends SprykerSalesDependencyProvider
{
/**
* @return array<\Spryker\Zed\SalesExtension\Dependency\Plugin\OrderItemExpanderPluginInterface>
*/
protected function getOrderItemExpanderPlugins(): array
{
return [
new ProductConfigurationOrderItemExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\SalesExtension\Dependency\Plugin\OrderItemsPostSavePluginInterface>
*/
protected function getOrderItemsPostSavePlugins(): array
{
return [
new ProductConfigurationOrderItemsPostSavePlugin(),
];
}
}
Make sure that sales plugins work correctly:
- Configure a configurable product.
- Place an order with the product.
- Check that the
spy_sales_order_item_configurationdatabase table contains a record with the configurable order item.
- Set up price product plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationPriceProductExpanderPlugin | Expands the list of price product transfers with product configuration prices. | None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\PriceCartConnector |
| ProductConfigurationPriceProductFilterPlugin | Filters out all but product configuration prices. | None | Spryker\Service\ProductConfiguration\Plugin\PriceProduct |
| ProductConfigurationVolumePriceProductFilterPlugin | Finds a corresponding volume price for a provided quantity. | None | Spryker\Service\ProductConfiguration\Plugin\PriceProduct |
| ProductConfigurationStoragePriceDimensionPlugin | Returns product configuration prices. If a product configuration instance or prices weren’t set, returns an empty array . | None | Spryker\Client\ProductConfigurationStorage\Plugin\PriceProductStorage |
| ProductConfigurationPriceProductFilterExpanderPlugin | Expands PriceProductFilterTransfer with a product configuration instance. |
None | Spryker\Client\ProductConfigurationStorage\Plugin\PriceProductStorage |
| PriceProductVolumeProductConfigurationPriceExtractorPlugin | Extracts volume prices from price product data. | None | Spryker\Client\ProductConfiguration\Plugin |
src/Pyz/Zed/PriceCartConnector/PriceCartConnectorDependencyProvider.php
<?php
namespace Pyz\Zed\PriceCartConnector;
use Spryker\Zed\PriceCartConnector\PriceCartConnectorDependencyProvider as SprykerPriceCartConnectorDependencyProvider;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\PriceCartConnector\ProductConfigurationPriceProductExpanderPlugin;
class PriceCartConnectorDependencyProvider extends SprykerPriceCartConnectorDependencyProvider
{
/**
* @return array<\Spryker\Zed\PriceCartConnectorExtension\Dependency\Plugin\PriceProductExpanderPluginInterface>
*/
protected function getPriceProductExpanderPlugins(): array
{
return [
new ProductConfigurationPriceProductExpanderPlugin(),
];
}
}
src/Pyz/Service/PriceProduct/PriceProductDependencyProvider.php
<?php
namespace Pyz\Service\PriceProduct;
use Spryker\Service\PriceProduct\PriceProductDependencyProvider as SprykerPriceProductDependencyProvider;
use Spryker\Service\ProductConfiguration\Plugin\PriceProduct\ProductConfigurationPriceProductFilterPlugin;
use Spryker\Service\ProductConfiguration\Plugin\PriceProduct\ProductConfigurationVolumePriceProductFilterPlugin;
class PriceProductDependencyProvider extends SprykerPriceProductDependencyProvider
{
/**
* @return array<\Spryker\Service\PriceProductExtension\Dependency\Plugin\PriceProductFilterPluginInterface>
*/
protected function getPriceProductDecisionPlugins(): array
{
return array_merge([
new ProductConfigurationPriceProductFilterPlugin(),
new ProductConfigurationVolumePriceProductFilterPlugin(),
], parent::getPriceProductDecisionPlugins());
}
}
src/Pyz/Client/PriceProductStorage/PriceProductStorageDependencyProvider.php
<?php
namespace Pyz\Client\PriceProductStorage;
use Spryker\Client\PriceProductStorage\PriceProductStorageDependencyProvider as SprykerPriceProductStorageDependencyProvider;
use Spryker\Client\ProductConfigurationStorage\Plugin\PriceProductStorage\ProductConfigurationPriceProductFilterExpanderPlugin;
use Spryker\Client\ProductConfigurationStorage\Plugin\PriceProductStorage\ProductConfigurationStoragePriceDimensionPlugin;
class PriceProductStorageDependencyProvider extends SprykerPriceProductStorageDependencyProvider
{
/**
* @return array<\Spryker\Client\PriceProductStorageExtension\Dependency\Plugin\PriceProductStoragePriceDimensionPluginInterface>
*/
public function getPriceDimensionStorageReaderPlugins(): array
{
return [
new ProductConfigurationStoragePriceDimensionPlugin(),
];
}
/**
* @return array<\Spryker\Client\PriceProductStorageExtension\Dependency\Plugin\PriceProductFilterExpanderPluginInterface>
*/
protected function getPriceProductFilterExpanderPlugins(): array
{
return [
new ProductConfigurationPriceProductFilterExpanderPlugin(),
];
}
}
src/Pyz/Client/ProductConfiguration/ProductConfigurationDependencyProvider.php
<?php
namespace Pyz\Client\ProductConfiguration;
use Spryker\Client\ProductConfiguration\Plugin\PriceProductVolumeProductConfigurationPriceExtractorPlugin;
use Spryker\Client\ProductConfiguration\ProductConfigurationDependencyProvider as SprykerProductConfigurationDependencyProvider;
class ProductConfigurationDependencyProvider extends SprykerProductConfigurationDependencyProvider
{
/**
* @return array<\Spryker\Client\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationPriceExtractorPluginInterface>
*/
protected function getProductConfigurationPriceExtractorPlugins(): array
{
return [
new PriceProductVolumeProductConfigurationPriceExtractorPlugin(),
];
}
}
Make sure that the product configuration price overrides the default product price:
- Configure a configurable product with a regular price and volume price.
- Add the product to the cart with the amount required for the volume prices to apply.
- Make sure that the volume price applies.
- Set up availability plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationAvailabilityStorageStrategyPlugin | Checks whether a product configuration provides an availability for a product. | None | Spryker\Client\ProductConfigurationStorage\Plugin\AvailabilityStorage |
src/Pyz/Client/AvailabilityStorage/AvailabilityStorageDependencyProvider.php
<?php
namespace Pyz\Client\AvailabilityStorage;
use Spryker\Client\AvailabilityStorage\AvailabilityStorageDependencyProvider as SprykerAvailabilityStorageDependencyProvider;
use Spryker\Client\ProductConfigurationStorage\Plugin\AvailabilityStorage\ProductConfigurationAvailabilityStorageStrategyPlugin;
class AvailabilityStorageDependencyProvider extends SprykerAvailabilityStorageDependencyProvider
{
/**
* @return array<\Spryker\Client\AvailabilityStorageExtension\Dependency\Plugin\AvailabilityStorageStrategyPluginInterface>
*/
public function getAvailabilityStorageStrategyPlugins(): array
{
return [
new ProductConfigurationAvailabilityStorageStrategyPlugin(),
];
}
}
Make sure that availability plugins work correctly:
- Configure a configurable product that has regular availability.
- Make sure that you cannot add to the cart more items than are available for the configuration.
- Set up product plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductViewProductConfigurationExpanderPlugin | Expands a product with a configuration. | None | Spryker\Client\ProductConfigurationStorage\Plugin\ProductStorage |
src/Pyz/Client/ProductStorage/ProductStorageDependencyProvider.php
<?php
namespace Pyz\Client\ProductStorage;
use Spryker\Client\ProductConfigurationStorage\Plugin\ProductStorage\ProductViewProductConfigurationExpanderPlugin;
use Spryker\Client\ProductStorage\ProductStorageDependencyProvider as SprykerProductStorageDependencyProvider;
class ProductStorageDependencyProvider extends SprykerProductStorageDependencyProvider
{
/**
* @return array<\Spryker\Client\ProductStorage\Dependency\Plugin\ProductViewExpanderPluginInterface>
*/
protected function getProductViewExpanderPlugins(): array
{
return [
new ProductViewProductConfigurationExpanderPlugin(),
];
}
}
On the Product Details page of a configurable product, make sure that you can see product configuration information.
- Set up product configuration check plugins for the quote request module:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationQuoteRequestQuoteCheckPlugin | Validates product configuration before the quote request creation. | None | Spryker\Client\ProductConfigurationCart\Plugin\QuoteRequest |
src/Pyz/Client/QuoteRequest/QuoteRequestDependencyProvider.php
<?php
namespace Pyz\Client\QuoteRequest;
use Spryker\Client\ProductConfigurationCart\Plugin\QuoteRequest\ProductConfigurationQuoteRequestQuoteCheckPlugin;
use Spryker\Client\QuoteRequest\QuoteRequestDependencyProvider as SprykerQuoteRequestDependencyProvider;
class QuoteRequestDependencyProvider extends SprykerQuoteRequestDependencyProvider
{
/**
* @return array<\Spryker\Client\QuoteRequestExtension\Dependency\Plugin\QuoteRequestQuoteCheckPluginInterface>
*/
protected function getQuoteRequestQuoteCheckPlugins(): array
{
return [
new ProductConfigurationQuoteRequestQuoteCheckPlugin(),
];
}
}
Make sure the plugins work correctly:
- Add a configurable product with an incomplete configuration to the cart.
- Check that the Checkout and Request for quote buttons are not available.
- Set up product configuration validation plugins for the quote request module:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationQuoteRequestValidatorPlugin | Validates customers’ quote requests with the validators stack. | None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\QuoteRequest |
| ProductConfigurationQuoteRequestUserValidatorPlugin | Validates agents assists’ quote requests with the validators stack. | None | Spryker\Zed\ProductConfigurationCart\Communication\Plugin\QuoteRequest |
src/Pyz/Zed/QuoteRequest/QuoteRequestDependencyProvider.php
<?php
namespace Pyz\Zed\QuoteRequest;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\QuoteRequest\ProductConfigurationQuoteRequestUserValidatorPlugin;
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\QuoteRequest\ProductConfigurationQuoteRequestValidatorPlugin;
use Spryker\Zed\QuoteRequest\QuoteRequestDependencyProvider as SprykerQuoteRequestDependencyProvider;
class QuoteRequestDependencyProvider extends SprykerQuoteRequestDependencyProvider
{
/**
* @return array<\Spryker\Zed\QuoteRequestExtension\Dependency\Plugin\QuoteRequestValidatorPluginInterface>
*/
protected function getQuoteRequestValidatorPlugins(): array
{
return [
new ProductConfigurationQuoteRequestValidatorPlugin(),
];
}
/**
* @return array<\Spryker\Zed\QuoteRequestExtension\Dependency\Plugin\QuoteRequestUserValidatorPluginInterface>
*/
protected function getQuoteRequestUserValidatorPlugins(): array
{
return [
new ProductConfigurationQuoteRequestUserValidatorPlugin(),
];
}
}
Make sure the plugins work correctly:
- Log in as an agent assist.
- Add a configurable product with an incomplete configuration to the cart.
- Select Save or Save and Back to Edit.
- Make sure that the validation error message appears.
- Set up wishlist plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationItemExpanderPlugin | Expands the WishlistItem transfer object with product configuration data. |
None | Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist |
| ProductConfigurationWishlistAddItemPreCheckPlugin | Checks whether product configuration exists by provided WishlistItem.sku transfer property. |
None | Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist |
| ProductConfigurationWishlistReloadItemsPlugin | Expands the WishlistItem transfers collection in Wishlist transfer object with product configuration data. |
None | Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist |
| ProductConfigurationWishlistPreAddItemPlugin | Prepares product configuration attached to a wishlist item to be saved. | None | Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist |
| ProductConfigurationWishlistItemExpanderPlugin | Expands the WishlistItem transfer object with product configuration data. |
None | Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist |
| ProductConfigurationWishlistPreUpdateItemPlugin | Prepares product configuration attached to a wishlist item to be saved. | None | Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist |
| ProductConfigurationWishlistUpdateItemPreCheckPlugin | Checks whether product configuration exists by the provided WishlistItem.sku transfer property. |
None | Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist |
| ProductConfigurationWishlistCollectionToRemoveExpanderPlugin | Expands WishlistItemCollectionTransfer with successfully added wishlist items to a cart. |
None | Spryker\Client\ProductConfigurationWishlist\Plugin\Wishlist |
| ProductConfigurationWishlistPostMoveToCartCollectionExpanderPlugin | Expands WishlistMoveToCartRequestCollectionTransfer with not valid product configuration items. |
None | Spryker\Client\ProductConfigurationWishlist\Plugin\Wishlist |
| ProductConfigurationWishlistItemPriceProductExpanderPlugin | Expands the collection of product price transfers with product configuration prices taken from ProductViewTransfer. |
None | Spryker\Client\ProductConfigurationWishlist\Plugin\PriceProductStorage |
src/Pyz/Zed/Wishlist/WishlistDependencyProvider.php
<?php
namespace Pyz\Zed\Wishlist;
use Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist\ProductConfigurationItemExpanderPlugin;
use Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist\ProductConfigurationWishlistAddItemPreCheckPlugin;
use Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist\ProductConfigurationWishlistItemExpanderPlugin;
use Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist\ProductConfigurationWishlistPreAddItemPlugin;
use Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist\ProductConfigurationWishlistPreUpdateItemPlugin;
use Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist\ProductConfigurationWishlistReloadItemsPlugin;
use Spryker\Zed\ProductConfigurationWishlist\Communication\Plugin\Wishlist\ProductConfigurationWishlistUpdateItemPreCheckPlugin;
use Spryker\Zed\Wishlist\WishlistDependencyProvider as SprykerWishlistDependencyProvider;
class WishlistDependencyProvider extends SprykerWishlistDependencyProvider
{
/**
* @return array<\Spryker\Zed\Wishlist\Dependency\Plugin\ItemExpanderPluginInterface>
*/
protected function getItemExpanderPlugins()
{
return [
new ProductConfigurationItemExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\WishlistExtension\Dependency\Plugin\AddItemPreCheckPluginInterface>
*/
protected function getAddItemPreCheckPlugins(): array
{
return [
new ProductConfigurationWishlistAddItemPreCheckPlugin(),
];
}
/**
* @return array<\Spryker\Zed\WishlistExtension\Dependency\Plugin\WishlistReloadItemsPluginInterface>
*/
protected function getWishlistReloadItemsPlugins(): array
{
return [
new ProductConfigurationWishlistReloadItemsPlugin(),
];
}
/**
* @return array<\Spryker\Zed\WishlistExtension\Dependency\Plugin\WishlistPreAddItemPluginInterface>
*/
protected function getWishlistPreAddItemPlugins(): array
{
return [
new ProductConfigurationWishlistPreAddItemPlugin(),
];
}
/**
* @return array<\Spryker\Zed\WishlistExtension\Dependency\Plugin\WishlistItemExpanderPluginInterface>
*/
protected function getWishlistItemExpanderPlugins(): array
{
return [
new ProductConfigurationWishlistItemExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\WishlistExtension\Dependency\Plugin\WishlistPreUpdateItemPluginInterface>
*/
protected function getWishlistPreUpdateItemPlugins(): array
{
return [
new ProductConfigurationWishlistPreUpdateItemPlugin(),
];
}
/**
* @return array<\Spryker\Zed\WishlistExtension\Dependency\Plugin\UpdateItemPreCheckPluginInterface>
*/
protected function getUpdateItemPreCheckPlugins(): array
{
return [
new ProductConfigurationWishlistUpdateItemPreCheckPlugin(),
];
}
}
src/Pyz/Client/Wishlist/WishlistDependencyProvider.php
<?php
namespace Pyz\Client\Wishlist;
use Spryker\Client\ProductConfigurationWishlist\Plugin\Wishlist\ProductConfigurationWishlistCollectionToRemoveExpanderPlugin;
use Spryker\Client\ProductConfigurationWishlist\Plugin\Wishlist\ProductConfigurationWishlistPostMoveToCartCollectionExpanderPlugin;
use Spryker\Client\Wishlist\WishlistDependencyProvider as SprykerWishlistDependencyProvider;
class WishlistDependencyProvider extends SprykerWishlistDependencyProvider
{
/**
* @return array<\Spryker\Client\WishlistExtension\Dependency\Plugin\WishlistPostMoveToCartCollectionExpanderPluginInterface>
*/
protected function getWishlistPostMoveToCartCollectionExpanderPlugins(): array
{
return [
new ProductConfigurationWishlistPostMoveToCartCollectionExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Client\WishlistExtension\Dependency\Plugin\WishlistCollectionToRemoveExpanderPluginInterface>
*/
protected function getWishlistCollectionToRemoveExpanderPlugins(): array
{
return [
new ProductConfigurationWishlistCollectionToRemoveExpanderPlugin(),
];
}
}
src/Pyz/Client/PriceProductStorage/PriceProductStorageDependencyProvider.php
<?php
namespace Pyz\Client\PriceProductStorage;
use Spryker\Client\PriceProductStorage\PriceProductStorageDependencyProvider as SprykerPriceProductStorageDependencyProvider;
use Spryker\Client\ProductConfigurationWishlist\Plugin\PriceProductStorage\ProductConfigurationWishlistItemPriceProductExpanderPlugin;
class PriceProductStorageDependencyProvider extends SprykerPriceProductStorageDependencyProvider
{
/**
* @return array<\Spryker\Client\PriceProductStorageExtension\Dependency\Plugin\PriceProductExpanderPluginInterface>
*/
protected function getPriceProductExpanderPlugins(): array
{
return [
new ProductConfigurationWishlistItemPriceProductExpanderPlugin(),
];
}
}
Make sure that the wishlist plugins work correctly:
- Configure a configurable product.
- Add the configured product to a wishlist.
- Make sure that the product has been successfully added to the wishlist.
- Set up shopping list plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationShoppingListItemMapperPlugin | Adds product configuration to a shopping list item if product configuration found. | None | Spryker\Client\ProductConfigurationShoppingList\Plugin\ShoppingList |
| ProductConfigurationShoppingListItemToItemMapperPlugin | Copies product configuration from the shopping list item to a cart item. | None | Spryker\Client\ProductConfigurationShoppingList\Plugin\ShoppingList |
| ProductConfigurationShoppingListExpanderPlugin | Expands shopping list items with product configuration. | None | Spryker\Client\ProductConfigurationShoppingList\Plugin\ShoppingList |
| ProductConfigurationShoppingListAddItemPreCheckPlugin | Checks whether product configuration exists by the provided ShoppingListItem.sku transfer property. |
None | Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList |
| ProductConfigurationShoppingListItemBulkPostSavePlugin | Removes configuration if a product configuration instance is not set at a shopping list item. | None | Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList |
| ProductConfigurationShoppingListItemCollectionExpanderPlugin | Expands ShoppingListItemTransfer transfer object with product configuration data. |
None | Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList |
| ItemProductConfigurationItemToShoppingListItemMapperPlugin | Copies product configuration from a cart item to a shopping list item. | None | Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList |
src/Pyz/Client/ShoppingList/ShoppingListDependencyProvider.php
<?php
namespace Pyz\Client\ShoppingList;
use Spryker\Client\ProductConfigurationShoppingList\Plugin\ShoppingList\ProductConfigurationShoppingListExpanderPlugin;
use Spryker\Client\ProductConfigurationShoppingList\Plugin\ShoppingList\ProductConfigurationShoppingListItemMapperPlugin;
use Spryker\Client\ProductConfigurationShoppingList\Plugin\ShoppingList\ProductConfigurationShoppingListItemToItemMapperPlugin;
use Spryker\Client\ShoppingList\ShoppingListDependencyProvider as SprykerShoppingListDependencyProvider;
class ShoppingListDependencyProvider extends SprykerShoppingListDependencyProvider
{
/**
* @return array<\Spryker\Client\ShoppingListExtension\Dependency\Plugin\ShoppingListItemMapperPluginInterface>
*/
protected function getAddItemShoppingListItemMapperPlugins(): array
{
return [
new ProductConfigurationShoppingListItemMapperPlugin(),
];
}
/**
* @return array<\Spryker\Client\ShoppingListExtension\Dependency\Plugin\ShoppingListItemToItemMapperPluginInterface>
*/
protected function getShoppingListItemToItemMapperPlugins(): array
{
return [
new ProductConfigurationShoppingListItemToItemMapperPlugin(),
];
}
/**
* @return array<\Spryker\Client\ShoppingListExtension\Dependency\Plugin\ShoppingListExpanderPluginInterface>
*/
protected function getShoppingListExpanderPlugins(): array
{
return [
new ProductConfigurationShoppingListExpanderPlugin(),
];
}
}
src/Pyz/Zed/ShoppingList/ShoppingListDependencyProvider.php
<?php
namespace Pyz\Zed\ShoppingList;
use Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList\ItemProductConfigurationItemToShoppingListItemMapperPlugin;
use Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList\ProductConfigurationShoppingListAddItemPreCheckPlugin;
use Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList\ProductConfigurationShoppingListItemBulkPostSavePlugin;
use Spryker\Zed\ProductConfigurationShoppingList\Communication\Plugin\ShoppingList\ProductConfigurationShoppingListItemCollectionExpanderPlugin;
use Spryker\Zed\ShoppingList\ShoppingListDependencyProvider as SprykerShoppingListDependencyProvider;
class ShoppingListDependencyProvider extends SprykerShoppingListDependencyProvider
{
/**
* @return array<\Spryker\Zed\ShoppingListExtension\Dependency\Plugin\AddItemPreCheckPluginInterface>
*/
protected function getAddItemPreCheckPlugins(): array
{
return [
new ProductConfigurationShoppingListAddItemPreCheckPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ShoppingListExtension\Dependency\Plugin\ShoppingListItemBulkPostSavePluginInterface>
*/
protected function getShoppingListItemBulkPostSavePlugins(): array
{
return [
new ProductConfigurationShoppingListItemBulkPostSavePlugin(),
];
}
/**
* @return array<\Spryker\Zed\ShoppingListExtension\Dependency\Plugin\ShoppingListItemCollectionExpanderPluginInterface>
*/
protected function getItemCollectionExpanderPlugins(): array
{
return [
new ProductConfigurationShoppingListItemCollectionExpanderPlugin(),
];
}
/**
* @return array<\Spryker\Zed\ShoppingListExtension\Dependency\Plugin\ItemToShoppingListItemMapperPluginInterface>
*/
protected function getItemToShoppingListItemMapperPlugins(): array
{
return [
new ItemProductConfigurationItemToShoppingListItemMapperPlugin(),
];
}
}
Make sure that the shopping list plugins work correctly:
- Configure a configurable product.
- Add the configured product to a shopping list.
- Make sure that the product has been added successfully to the shopping list.
- Set up the plugins of your product configurators.
The Configurator Setup tab and the product configuration import work with configurations of any format. Each product configurator provides the plugins that recognize, validate, and summarize its configurations. For each product configurator that Back Office users set up products for, implement the following plugin interfaces and register the plugins:
| PLUGIN INTERFACE | SPECIFICATION | NAMESPACE |
|---|---|---|
| ProductConfigurationConfiguratorKeyResolverPluginInterface | Recognizes the configurations of a product configurator, so the configurator key of an uploaded or imported configuration is determined from its content. If no plugin recognizes an uploaded file, the upload fails with the error The file does not match the format of any configurator. | Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin |
| ProductConfigurationValidatorStrategyPluginInterface | Validates a configuration in the format of its product configurator and returns each error with its location in the configuration. An uploaded file is saved only if a validator plugin applies to its configurator key. The import validates the rows that a validator plugin applies to and imports the other rows without validation. | Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin |
| ProductConfigurationDefaultDisplayDataStrategyPluginInterface | Generates the default display data from a valid configuration. If no plugin applies, the default display data is kept unchanged. | Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin |
| ProductConfigurationTemplatePluginInterface | Returns the absolute path of a starter configuration file, which Back Office users download as the template of the product configurator. The Back Office reads the file only when a Back Office user downloads it, so deploy the file with your code and make it readable for the Back Office. If the file doesn’t exist or isn’t readable, the download returns to the product with the message No configuration file is available for download. | Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin |
| ProductConfigurationSummaryRenderStrategyPluginInterface | Renders the summary of a configuration in the Current configuration section of the tab and summarizes the configuration in the message after saving. If no plugin applies, the section shows only the configurator key and the time of the last change. | Spryker\Zed\ProductConfigurationGui\Dependency\Plugin |
src/Pyz/Zed/ProductConfiguration/ProductConfigurationDependencyProvider.php
<?php
namespace Pyz\Zed\ProductConfiguration;
use Spryker\Zed\ProductConfiguration\ProductConfigurationDependencyProvider as SprykerProductConfigurationDependencyProvider;
class ProductConfigurationDependencyProvider extends SprykerProductConfigurationDependencyProvider
{
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationConfiguratorKeyResolverPluginInterface>
*/
protected function getProductConfigurationConfiguratorKeyResolverPlugins(): array
{
return [
new YourConfiguratorKeyResolverPlugin(),
];
}
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationValidatorStrategyPluginInterface>
*/
protected function getProductConfigurationValidatorStrategyPlugins(): array
{
return [
new YourConfiguratorValidatorStrategyPlugin(),
];
}
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationDefaultDisplayDataStrategyPluginInterface>
*/
protected function getProductConfigurationDefaultDisplayDataStrategyPlugins(): array
{
return [
new YourConfiguratorDefaultDisplayDataStrategyPlugin(),
];
}
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationTemplatePluginInterface>
*/
protected function getProductConfigurationTemplatePlugins(): array
{
return [
new YourConfiguratorTemplatePlugin(),
];
}
}
src/Pyz/Zed/ProductConfigurationGui/ProductConfigurationGuiDependencyProvider.php
<?php
namespace Pyz\Zed\ProductConfigurationGui;
use Spryker\Zed\ProductConfigurationGui\ProductConfigurationGuiDependencyProvider as SprykerProductConfigurationGuiDependencyProvider;
class ProductConfigurationGuiDependencyProvider extends SprykerProductConfigurationGuiDependencyProvider
{
/**
* @return list<\Spryker\Zed\ProductConfigurationGui\Dependency\Plugin\ProductConfigurationSummaryRenderStrategyPluginInterface>
*/
protected function getProductConfigurationSummaryRenderStrategyPlugins(): array
{
return [
new YourConfiguratorSummaryRenderStrategyPlugin(),
];
}
}
Replace the YourConfigurator*Plugin classes with the plugins of your product configurators. To check the plugins, follow the verification steps in Build Zed UI frontend. For the plugins of the CONFIGURABLE_PRODUCT product configurator of the example module, see Set up the configurable product configurator.
5) Import data
The following imported entities are used as product configurations in Spryker. To import product configuration data, follow these steps:
- Prepare data according to your requirements using the following demo data:
data/import/product_configuration.csv
>concrete_sku,configurator_key,is_complete,default_configuration,default_display_data
093_24495843,DATE_TIME_CONFIGURATOR,0,"{""time_of_day"": ""2""}","{""Preferred time of the day"": ""Afternoon"", ""Date"": ""9.09.2020""}"
| COLUMN | Required | DATA TYPE | DATA EXAMPLE | DATA EXPLANATION |
|---|---|---|---|---|
| concrete_sku | ✓ | string | 093_24495843 | Unique product identifier. |
| configurator_key | ✓ | string | DATE_TIME_CONFIGURATOR | Unique identifier of a product configurator to be used for this product. |
| is_complete | boolean | 0 | Defines if product configuration complete by default. | |
| default_configuration | text | "{""time_of_day"": ""2""}" |
Defines default configuration. | |
| default_display_data | text | "{""Preferred time of the day"": ""Afternoon"", ""Date"": ""9.09.2020""}" |
Defines default display data for the configuration. |
- Register the following data import plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationDataImportPlugin | Imports product configuration data. | None | \Spryker\Zed\ProductConfigurationDataImport\Communication\Plugin |
src/Pyz/Zed/DataImport/DataImportDependencyProvider.php
<?php
namespace Pyz\Zed\DataImport;
use Spryker\Zed\ProductConfigurationDataImport\Communication\Plugin\ProductConfigurationDataImportPlugin;
use Spryker\Zed\DataImport\DataImportDependencyProvider as SprykerSynchronizationDependencyProvider;
class DataImportDependencyProvider extends SprykerDataImportDependencyProvider
{
/**
* @return array<\Spryker\Zed\DataImport\Dependency\Plugin\DataImportPluginInterface>
*/
protected function getDataImporterPlugins(): array
{
return [
new ProductConfigurationDataImportPlugin(),
];
}
}
- Import data:
console data:import product-configuration
The import validates the default configuration of each row that a validator plugin of ProductConfigurationDependencyProvider::getProductConfigurationValidatorStrategyPlugins() applies to. An invalid row is not imported, and the import reports the SKU of the product with each error. The rows of other product configurators are imported without validation.
Make sure that the configured data has been added to the spy_product_configuration table.
6) Generate Zed translations
Generate a new translation cache for Zed:
console translator:generate-cache
7) Build Zed UI frontend
Enable JavaScript and CSS changes for Zed:
console frontend:zed:build
Make sure that Back Office users can set up a configurable product:
- In the Back Office, go to Catalog > Products.
- Next to a product, click Edit. On the Variants tab, click Edit next to a product variant.
- On the Configurator Setup tab, check that the texts are translated and the upload area lists the supported file formats.
- Click Template and check that the template of your product configurator is downloaded.
- Upload the template and click Save. Make sure that the success message is displayed and the
spy_product_configurationtable contains the configuration of the product variant with your configurator key. - Add an error to the file, upload it, and click Save. Make sure that the tab lists the error and no changes of the product variant are saved.
8) Grant access to the configuration downloads
The upload of a configuration file is part of the product form. The Template and Current configuration downloads are actions of the configurator-setup controller of the product-configuration-gui bundle. If the role of a Back Office user doesn’t grant access to all bundles, add the following rule to the role in Users > User Roles:
| BUNDLE | CONTROLLER | ACTION | PERMISSION |
|---|---|---|---|
| product-configuration-gui | configurator-setup | * | allow |
Log in as a user with this role. On the Configurator Setup tab of a product variant, click Template and make sure that the template is downloaded.
Install feature frontend
Follow the steps below to install the feature frontend.
Prerequisites
Install the required features:
| NAME | VERSION | INSTALLATION GUIDE |
|---|---|---|
| Spryker Core | 202610.0 | Install the Spryker Core feature |
| Product | 202610.0 | Install the Product feature |
1) Install the required modules
Install the required modules using Composer:
composer require "spryker-feature/configurable-product":"202610.0" --update-with-dependencies
Make sure that the following modules have been installed:
| MODULE | EXPECTED DIRECTORY |
|---|---|
| ProductConfigurationCartWidget | vendor/spryker-shop/product-configuration-cart-widget |
| ProductConfigurationWidget | vendor/spryker-shop/product-configuration-widget |
| ProductConfigurationWishlistWidget | vendor/spryker-shop/product-configuration-wishlist-widget |
| ProductConfigurationShoppingListWidget | vendor/spryker-shop/product-configuration-shopping-list-widget |
| ProductConfiguratorGatewayPage | vendor/spryker-shop/product-configurator-gateway-page |
| SalesProductConfigurationWidget | vendor/spryker-shop/sales-product-configuration-widget |
2) Add translations
Add translations as follows:
- Append glossary according to your configuration:
product_configuration.checkout.validation.error.is_not_complete,"Product configuration is not completed.",en_US
product_configuration.checkout.validation.error.is_not_complete,"Die Produktkonfiguration ist nicht abgeschlossen.",de_DE
product_configuration_widget.configure,Configure,en_US
product_configuration_widget.configure,Konfigurieren,de_DE
product_configuration_widget.complete,"Configuration complete!",en_US
product_configuration_widget.complete,"Konfiguration abgeschlossen!",de_DE
product_configuration_widget.not_complete,"Configuration is not complete.",en_US
product_configuration_widget.not_complete,"Die Konfiguration ist nicht abgeschlossen.",de_DE
product_configuration_widget.quote_not_valid,"This cart can't be processed. Please configure items inside the cart.",en_US
product_configuration_widget.quote_not_valid,"Dieser Warenkorb kann nicht bearbeitet werden. Bitte konfigurieren Sie Artikel im Warenkorb.",de_DE
product_configurator_gateway_page.configurator_key_not_blank,"Configurator key is required parameter",en_US
product_configurator_gateway_page.configurator_key_not_blank,"Konfiguratorschlüssel ist ein erforderlicher Parameter",de_DE
product_configurator_gateway_page.item_group_key_required,"Group Key is required parameter",en_US
product_configurator_gateway_page.item_group_key_required,"Gruppenschlüssel ist erforderlicher Parameter",de_DE
product_configurator_gateway_page.source_type_not_blank,"Source is required parameter",en_US
product_configurator_gateway_page.source_type_not_blank,"Source ist erforderlicher Parameter",de_DE
product_configurator_gateway_page.sku_not_blank,"Product SKU is required parameter",en_US
product_configurator_gateway_page.sku_not_blank,"Produkt-SKU ist ein erforderlicher Parameter",de_DE
product_configurator_gateway_page.quantity_required,"Quantity is required parameter",en_US
product_configurator_gateway_page.quantity_required,"Menge ist Parameter erforderlich",de_DE
product_configuration.validation.error.not_valid_response_checksum,"Not valid response checksum provided",en_US
product_configuration.validation.error.not_valid_response_checksum,"Keine gültige Antwortprüfsumme angegeben",de_DE
product_configuration.validation.error.expired_timestamp,"Expired timestamp was provided",en_US
product_configuration.validation.error.expired_timestamp,"Der abgelaufene Zeitstempel wurde bereitgestellt",de_DE
product_configuration_storage.validation.error.group_key_is_not_provided,"Group key must be provided",en_US
product_configuration_storage.validation.error.group_key_is_not_provided,"Gruppenschlüssel muss angegeben werden",de_DE
product_configuration.access_token.request.error.can_not_obtain_access_token,"Can not obtain access token",en_US
product_configuration.access_token.request.error.can_not_obtain_access_token,"Zugriffstoken kann nicht abgerufen werden",de_DE
product_configuration.error.configured_item_not_found_in_cart,Configured product '%sku%' was not found.,en_US
product_configuration.error.configured_item_not_found_in_cart,'%sku%' des kofigurierbaren Produkts wurde nicht gefunden.,de_DE
product_configuration.error.availability.failed,The product has an availability of %availability%.,en_US
product_configuration.error.availability.failed,Das Produkt hat eine Verfügbarkeit von %availability%.,de_DE
product_configuration.quote_request.validation.error.incomplete,You must finish the configuration of the products to validate the quote.,en_US
product_configuration.quote_request.validation.error.incomplete,"Sie müssen die Konfiguration der Produkte abschließen, um das Angebot zu validieren.",de_DE
product_configuration.response.validation.error,Failed to validate product configurator response.,en_US
product_configuration.response.validation.error,Die Antwort vom Produktkonfigurator konnte nicht validiret werden.,de_DE
product_configuration.error.configuration_not_found,Product configuration was not found for product '%sku%'.,en_US
product_configuration.error.configuration_not_found,Produktkonfiguration wurde nicht für Produkt '%sku%' gefunden.,de_DE
wishlist.validation.error.wishlist_item_not_found,Wishlist item not found.,en_US
wishlist.validation.error.wishlist_item_not_found,Wunschliste Artikel nicht gefunden.,de_DE
wishlist.validation.error.wishlist_item_cannot_be_updated,Wishlist item cannot be updated.,en_US
wishlist.validation.error.wishlist_item_cannot_be_updated,Wunschliste kann nicht aktualisiert werden.,de_DE
product_configuration_wishlist.error.configuration_not_found,"Product configuration was not found for wishlist item '%id%'.",en_US
product_configuration_wishlist.error.configuration_not_found,"Für den Wunschlistenartikel '%id%' wurde keine Produktkonfiguration gefunden.",de_DE
product_configuration_shopping_list.error.configuration_not_found,"Product configuration was not found for shopping list item '%uuid%'.",en_US
product_configuration_shopping_list.error.configuration_not_found,"Für den Einkaufslistenartikel '%uuid%' wurde keine Produktkonfiguration gefunden.",de_DE
product_configuration_shopping_list.error.item_not_found,"Shopping list item not found.",en_US
product_configuration_shopping_list.error.item_not_found,"Artikel auf der Einkaufsliste nicht gefunden.",de_DE
- Import data:
console data:import glossary
Make sure that, in the database, the configured data has been added to the spy_glossary table.
3) Enable controllers
- On the Storefront, register the following route provider:
| PROVIDER | NAMESPACE |
|---|---|
| ProductConfiguratorGatewayPageRouteProviderPlugin | SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin\Router |
src/Pyz/Yves/Router/RouterDependencyProvider.php
<?php
namespace Pyz\Yves\Router;
use Spryker\Yves\Router\RouterDependencyProvider as SprykerRouterDependencyProvider;
use SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin\Router\ProductConfiguratorGatewayPageRouteProviderPlugin;
class RouterDependencyProvider extends SprykerRouterDependencyProvider
{
/**
* @return array<\Spryker\Yves\RouterExtension\Dependency\Plugin\RouteProviderPluginInterface>
*/
protected function getRouteProvider(): array
{
return [
new ProductConfiguratorGatewayPageRouteProviderPlugin(),
];
}
}
Make sure that the yves.mysprykershop.com/product-configurator-gateway/request and yves.mysprykershop.com/product-configurator-gateway/response routes are available for POST requests.
- Register the following reorder item expander plugin:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationReorderItemExpanderPlugin | Expands items with product configuration based on data from order items. | None | SprykerShop\Yves\SalesProductConfigurationWidget\Plugin\CustomerReorderWidget |
src/Pyz/Yves/CustomerReorderWidget/CustomerReorderWidgetDependencyProvider.php
<?php
namespace Pyz\Yves\CustomerReorderWidget;
use SprykerShop\Yves\CustomerReorderWidget\CustomerReorderWidgetDependencyProvider as SprykerCustomerReorderWidgetDependencyProvider;
use SprykerShop\Yves\SalesProductConfigurationWidget\Plugin\CustomerReorderWidget\ProductConfigurationReorderItemExpanderPlugin;
class CustomerReorderWidgetDependencyProvider extends SprykerCustomerReorderWidgetDependencyProvider
{
/**
* @return array<\SprykerShop\Yves\CustomerReorderWidgetExtension\Dependency\Plugin\ReorderItemExpanderPluginInterface>
*/
protected function getReorderItemExpanderPlugins(): array
{
return [
new ProductConfigurationReorderItemExpanderPlugin(),
];
}
}
Make sure that the reorder expander plugin works:
- Order with a configurable product.
- On the Storefront, go to the Order history page.
- Next to the order with the configurable product, select Reorder.
- In the cart, check that the configurable product has the configuration from the previous order.
- Register the following gateway plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductDetailPageProductConfiguratorRequestStrategyPlugin | Finds the product configuration instance for a given product, maps it to ProductConfiguratorRequestTransfer, and sends the product configurator access token request. |
None | SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin |
| ProductDetailPageProductConfiguratorResponseStrategyPlugin | Maps the product configurator check sum response, validates it and replaces configuration for a given product in the session. | None | SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin |
| ProductDetailPageProductConfiguratorRequestDataFormExpanderStrategyPlugin | Extends the product configurator request form with the SKU field to support configuration for a product on the PDP page. | None | SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin |
| CartPageProductConfiguratorRequestStartegyPlugin | Finds configuration instance in quote, maps it to ProductConfiguratorRequestTransfer and sends product configurator access token request. |
None | SprykerShop\Yves\ProductConfigurationCartWidget\Plugin |
| CartPageProductConfiguratorResponseStrategyPlugin | Maps the raw product configurator checksum response, validates it, and replaces the corresponding item in a quote. | None | SprykerShop\Yves\ProductConfigurationCartWidget\Plugin |
| CartPageProductConfiguratorRequestDataFormExpanderStrategyPlugin | Extends the product configurator request form with SKU, quantity, and key group fields to support configuration for a cart item on a cart page. | None | SprykerShop\Yves\ProductConfigurationCartWidget\Plugin |
| WishlistPageProductConfiguratorRequestStrategyPlugin | Finds product configuration instance for given wishlist item, maps product configuration instance data to ProductConfiguratorRequestTransfer, and sends product configurator access token request. |
None | SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\ProductConfiguratorGatewayPage |
| WishlistPageProductConfiguratorResponseStrategyPlugin | Maps the product configurator check sum response, validates it, and replaces configuration for a given product in the wishlist item. | None | SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\ProductConfiguratorGatewayPage |
| WishlistPageProductConfiguratorRequestDataFormExpanderStrategyPlugin | Extends the product configurator request form with the idWishlistItem and sku fields to support configuration for a wishlist item on the wishlist page. |
None | SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\ProductConfiguratorGatewayPage |
| ShoppingListPageProductConfiguratorRequestStrategyPlugin | Finds product configuration instance for given shopping list item, maps product configuration instance data to ProductConfiguratorRequestTransfer, and sends product configurator access token request. |
None | SprykerShop\Yves\ProductConfigurationShoppingListWidget\Plugin\ProductConfiguratorGatewayPage |
| ShoppingListPageProductConfiguratorResponseStrategyPlugin | Maps the product configurator check sum response, validates it and replaces configuration for a given product in the shopping list item. | None | SprykerShop\Yves\ProductConfigurationShoppingListWidget\Plugin\ProductConfiguratorGatewayPage |
| ShoppingListPageProductConfiguratorRequestDataFormExpanderStrategyPlugin | Extends the product configurator request form with the shoppingListItemUuid and quantity fields to support configuration for a shopping list item on the Shopping List page. |
None | SprykerShop\Yves\ProductConfigurationShoppingListWidget\Plugin\ProductConfiguratorGatewayPage |
src/Pyz/Yves/ProductConfiguratorGatewayPage/ProductConfiguratorGatewayPageDependencyProvider.php
<?php
namespace Pyz\Yves\ProductConfiguratorGatewayPage;
use SprykerShop\Yves\ProductConfigurationCartWidget\Plugin\ProductConfiguratorGatewayPage\CartPageProductConfiguratorRequestDataFormExpanderStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationCartWidget\Plugin\ProductConfiguratorGatewayPage\CartPageProductConfiguratorRequestStartegyPlugin;
use SprykerShop\Yves\ProductConfigurationCartWidget\Plugin\ProductConfiguratorGatewayPage\CartPageProductConfiguratorResponseStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationShoppingListWidget\Plugin\ProductConfiguratorGatewayPage\ShoppingListPageProductConfiguratorRequestDataFormExpanderStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationShoppingListWidget\Plugin\ProductConfiguratorGatewayPage\ShoppingListPageProductConfiguratorRequestStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationShoppingListWidget\Plugin\ProductConfiguratorGatewayPage\ShoppingListPageProductConfiguratorResponseStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\ProductConfiguratorGatewayPage\WishlistPageProductConfiguratorRequestDataFormExpanderStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\ProductConfiguratorGatewayPage\WishlistPageProductConfiguratorRequestStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\ProductConfiguratorGatewayPage\WishlistPageProductConfiguratorResponseStrategyPlugin;
use SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin\ProductConfiguratorGatewayPage\ProductDetailPageProductConfiguratorRequestDataFormExpanderStrategyPlugin;
use SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin\ProductConfiguratorGatewayPage\ProductDetailPageProductConfiguratorRequestStrategyPlugin;
use SprykerShop\Yves\ProductConfiguratorGatewayPage\Plugin\ProductConfiguratorGatewayPage\ProductDetailPageProductConfiguratorResponseStrategyPlugin;
use SprykerShop\Yves\ProductConfiguratorGatewayPage\ProductConfiguratorGatewayPageDependencyProvider as SprykerProductConfiguratorGatewayPageDependencyProvider;
class ProductConfiguratorGatewayPageDependencyProvider extends SprykerProductConfiguratorGatewayPageDependencyProvider
{
/**
* @return array<\SprykerShop\Yves\ProductConfiguratorGatewayPageExtension\Dependency\Plugin\ProductConfiguratorRequestStrategyPluginInterface>
*/
protected function getProductConfiguratorRequestPlugins(): array
{
return [
new ProductDetailPageProductConfiguratorRequestStrategyPlugin(),
new CartPageProductConfiguratorRequestStartegyPlugin(),
new WishlistPageProductConfiguratorRequestStrategyPlugin(),
new ShoppingListPageProductConfiguratorRequestStrategyPlugin(),
];
}
/**
* @return array<\SprykerShop\Yves\ProductConfiguratorGatewayPageExtension\Dependency\Plugin\ProductConfiguratorResponseStrategyPluginInterface>
*/
protected function getProductConfiguratorResponsePlugins(): array
{
return [
new ProductDetailPageProductConfiguratorResponseStrategyPlugin(),
new CartPageProductConfiguratorResponseStrategyPlugin(),
new WishlistPageProductConfiguratorResponseStrategyPlugin(),
new ShoppingListPageProductConfiguratorResponseStrategyPlugin(),
];
}
/**
* @return array<\SprykerShop\Yves\ProductConfiguratorGatewayPageExtension\Dependency\Plugin\ProductConfiguratorRequestDataFormExpanderStrategyPluginInterface>
*/
protected function getProductConfiguratorRequestDataFormExpanderStrategyPlugins(): array
{
return [
new ProductDetailPageProductConfiguratorRequestDataFormExpanderStrategyPlugin(),
new CartPageProductConfiguratorRequestDataFormExpanderStrategyPlugin(),
new WishlistPageProductConfiguratorRequestDataFormExpanderStrategyPlugin(),
new ShoppingListPageProductConfiguratorRequestDataFormExpanderStrategyPlugin(),
];
}
}
Make sure that the plugins are set up correctly:
- Go to the PDP of a configurable product, make sure that you can open the configurator page, and return to the PDP with the configuration saved.
- Add a configurable product to the wishlist. Then, go to the wishlist page and make sure that you can open the configurator page and return to the wishlist page with the configuration saved.
- Add a configurable product to the shopping list. Then, go to the shopping list page and make sure that you can open the configurator page and return to the shopping list page with the configuration saved.
- To set up widgets, register the following plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ProductConfigurationCartItemDisplayWidget | Displays the product configuration of cart items. | None | SprykerShop\Yves\ProductConfigurationWidget\Widget |
| ProductConfigurationCartPageButtonWidget | Displays the product configuration button for configurable cart items. | None | SprykerShop\Yves\ProductConfigurationCartWidget\Widget |
| ProductConfigurationProductDetailPageButtonWidget | Displays the product configuration button for configurable products. | None | SprykerShop\Yves\ProductConfigurationWidget\Widget |
| ProductConfigurationProductViewDisplayWidget | Displays the product configuration of configurable products. | None | SprykerShop\Yves\ProductConfigurationCartWidget\Widget |
| ProductConfigurationQuoteValidatorWidget | Displays if the configuration of configurable cart items is valid. | None | SprykerShop\Yves\ProductConfigurationWidget\Widget |
| ProductConfigurationOrderItemDisplayWidget | Displays the product configuration of order items. | None | SprykerShop\Yves\SalesProductConfigurationWidget\Widget |
| ProductConfigurationWishlistFormWidget | Adds has_product_configuration_attached form hidden field to enable wishlist item expansion. |
None | SprykerShop\Yves\ProductConfigurationWishlistWidget\Widget |
| ProductConfigurationWishlistItemDisplayWidget | Displays the product configuration of wishlist items. | None | SprykerShop\Yves\ProductConfigurationWishlistWidget\Widget |
| ProductConfigurationWishlistPageButtonWidget | Displays the product configuration button for configurable wishlist items. | None | SprykerShop\Yves\ProductConfigurationWishlistWidget\Widget |
| ProductConfigurationShoppingListItemDisplayWidget | Displays the product configuration of shopping list items. | None | SprykerShop\Yves\ProductConfigurationShoppingListWidget\Widget |
| ProductConfigurationShoppingListPageButtonWidget | Displays the product configuration button for configurable shopping list items. | None | SprykerShop\Yves\ProductConfigurationShoppingListWidget\Widget |
src/Pyz/Yves/ShopApplication/ShopApplicationDependencyProvider.php
<?php
namespace Pyz\Yves\ShopApplication;
use SprykerShop\Yves\ProductConfigurationCartWidget\Widget\ProductConfigurationCartItemDisplayWidget;
use SprykerShop\Yves\ProductConfigurationCartWidget\Widget\ProductConfigurationCartPageButtonWidget;
use SprykerShop\Yves\ProductConfigurationCartWidget\Widget\ProductConfigurationQuoteValidatorWidget;
use SprykerShop\Yves\ProductConfigurationWidget\Widget\ProductConfigurationProductDetailPageButtonWidget;
use SprykerShop\Yves\ProductConfigurationWidget\Widget\ProductConfigurationProductViewDisplayWidget;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\Widget\ProductConfigurationWishlistFormWidget;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\Widget\ProductConfigurationWishlistItemDisplayWidget;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\Widget\ProductConfigurationWishlistPageButtonWidget;
use SprykerShop\Yves\SalesProductConfigurationWidget\Widget\ProductConfigurationOrderItemDisplayWidget;
use SprykerShop\Yves\ProductConfigurationShoppingListWidget\Widget\ProductConfigurationShoppingListItemDisplayWidget;
use SprykerShop\Yves\ProductConfigurationShoppingListWidget\Widget\ProductConfigurationShoppingListPageButtonWidget;
use SprykerShop\Yves\ShopApplication\ShopApplicationDependencyProvider as SprykerShopApplicationDependencyProvider;
class ShopApplicationDependencyProvider extends SprykerShopApplicationDependencyProvider
{
/**
* @return array<string>
*/
protected function getGlobalWidgets(): array
{
return [
ProductConfigurationCartPageButtonWidget::class,
ProductConfigurationCartItemDisplayWidget::class,
ProductConfigurationProductDetailPageButtonWidget::class,
ProductConfigurationProductViewDisplayWidget::class,
ProductConfigurationOrderItemDisplayWidget::class,
ProductConfigurationQuoteValidatorWidget::class,
ProductConfigurationWishlistFormWidget::class,
ProductConfigurationWishlistItemDisplayWidget::class,
ProductConfigurationWishlistPageButtonWidget::class,
ProductConfigurationShoppingListItemDisplayWidget::class,
ProductConfigurationShoppingListPageButtonWidget::class,
];
}
}
Make sure the following widgets have been registered by adding the respective code snippets to a Twig template:
| WIDGET | VERIFICATION |
|---|---|
| ProductConfigurationCartItemDisplayWidget | {% widget 'ProductConfigurationCartItemDisplayWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationCartPageButtonWidget | {% widget 'ProductConfigurationCartPageButtonWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationProductDetailPageButtonWidget | {% widget 'ProductConfigurationProductDetailPageButtonWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationProductViewDisplayWidget | {% widget 'ProductConfigurationProductViewDisplayWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationQuoteValidatorWidget | {% widget 'ProductConfigurationQuoteValidatorWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationOrderItemDisplayWidget | {% widget 'ProductConfigurationOrderItemDisplayWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationWishlistFormWidget | {% widget 'ProductConfigurationWishlistFormWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationWishlistItemDisplayWidget | {% widget 'ProductConfigurationWishlistItemDisplayWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationWishlistPageButtonWidget | {% widget 'ProductConfigurationWishlistPageButtonWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationShoppingListItemDisplayWidget | {% widget 'ProductConfigurationShoppingListItemDisplayWidget' args [...] only %}{% endwidget %} |
| ProductConfigurationShoppingListPageButtonWidget | {% widget 'ProductConfigurationShoppingListPageButtonWidget' args [...] only %}{% endwidget %} |
- Enable Javascript and CSS changes:
console frontend:yves:build
Make sure that product configuration data is displayed on the Product Details, Cart, Wishlist, and Shopping list pages.
Install an example date-time product configurator
Follow the steps below to install an exemplary date-time product configurator.
Prerequisites
Install the required features:
| NAME | VERSION | INSTALLATION GUIDE |
|---|---|---|
| Spryker Core | 202610.0 | Install the Spryker Core feature |
| Product | 202610.0 | Install the Product feature |
1) Install the required modules
composer require "spryker-shop/date-time-configurator-page-example":"^0.8.0" --update-with-dependencies
The validation of the example module needs justinrainbow/json-schema 6.7.0 or later. If Composer reports a conflict with this package, find the package that holds an earlier version with composer why-not justinrainbow/json-schema 6.7.0, and update both packages together.
Make sure that the following modules have been installed:
| MODULE | EXPECTED DIRECTORY |
|---|---|
| DateTimeConfiguratorPageExample | vendor/spryker-shop/date-time-configurator-page-example |
2) Configure an endpoint
- Define a new front controller for the date-time configurator:
public/Configurator/index.php
<?php
use SprykerShop\Configurator\DateTimeConfiguratorPageExample\ConfiguratorPage;
use Symfony\Component\HttpFoundation\Response;
define('APPLICATION', 'CONFIGURATOR');
defined('APPLICATION_ROOT_DIR') || define('APPLICATION_ROOT_DIR', dirname(__DIR__, 2));
require_once APPLICATION_ROOT_DIR . '/vendor/autoload.php';
$configuratorPage = new ConfiguratorPage();
$response = $configuratorPage->render();
if ($response instanceof Response) {
$response->send();
}
echo $response;
- To enable the new endpoint, adjust a Deploy file:
deploy.*.yml
version: "0.1"
namespace: spryker_demo
tag: '1.0'
environment: docker.dev
image:
environment:
SPRYKER_PRODUCT_CONFIGURATOR_HOST: date-time-configurator-example.spryker.local
SPRYKER_PRODUCT_CONFIGURATOR_PORT: 80
SPRYKER_PRODUCT_CONFIGURATOR_ENCRYPTION_KEY: 'change123'
SPRYKER_PRODUCT_CONFIGURATOR_HEX_INITIALIZATION_VECTOR: '0c1ffefeebdab4a3d839d0e52590c9a2'
...
groups:
EU:
region: EU
applications:
yves_eu:
application: yves
endpoints:
date-time-configurator-example.spryker.local:
entry-point: Configurator
...
- Fetch the changes and restart the application with the endpoint enabled:
docker/sdk boot deploy.yml
docker/sdk up
- Add the endpoint to your
hostsfile:
/etc/hosts
127.0.0.1 date-time-configurator-example.spryker.local
Make sure that the http://date-time-configurator-example.spryker.local/ endpoint is accessible.
3) Add translations
- Append glossary according to your configuration:
demo_date_time_configurator_page.checkout.validation.error.price_is_not_valid,"Product configuration price is not valid",en_US
demo_date_time_configurator_page.checkout.validation.error.price_is_not_valid,"Der Produktkonfigurationspreis ist ungültig",de_DE
product_configurator_gateway_page.wishlist_item_id_required,"Wishlist item ID is required parameter.",en_US
product_configurator_gateway_page.wishlist_item_id_required,"Die ID des Wunschartikels ist ein erforderlicher Parameter.",de_DE
product_configurator_gateway_page.configurator_key_is_not_supported,"Configurator key is not supported.",en_US
product_configurator_gateway_page.configurator_key_is_not_supported,"Konfiguratorschlüssel wird nicht unterstützt.",de_DE
product_configurator_gateway_page.shopping_list_item_uuid_required,"Shopping List item ID is required parameter.",en_US
product_configurator_gateway_page.shopping_list_item_uuid_required,"Die Artikel-ID der Einkaufsliste ist ein erforderlicher Parameter.",de_DE
- Import data:
console data:import glossary
Make sure that the configured data has been added to the spy_glossary table.
4) Set up behavior
- Set up the following plugins:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ExampleDateTimeConfiguratorAvailabilityStrategyPlugin | Applies to the product configuration instances of the DATE_TIME_CONFIGURATOR and CONFIGURABLE_PRODUCT product configurators. Returns the lower of the product availability and the available quantity of the configuration, or the product availability if the configuration has no available quantity. |
None | SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\Availability |
| ExampleDateTimeProductConfigurationRenderStrategyPlugin | Renders the display data of the DATE_TIME_CONFIGURATOR and CONFIGURABLE_PRODUCT product configurations. Display data per locale is shown in the current locale. |
None | SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\ProductConfigurationWidget |
| ExampleDateTimeProductConfigurationRenderStrategyPlugin | Renders the display data of the DATE_TIME_CONFIGURATOR and CONFIGURABLE_PRODUCT product configurations of order items. Display data per locale is shown in the locale of the Back Office user. |
None | SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\SalesProductConfigurationGui |
| ExampleDateTimeSalesProductConfigurationRenderStrategyPlugin | Renders the display data of the DATE_TIME_CONFIGURATOR and CONFIGURABLE_PRODUCT product configurations. Display data per locale is shown in the current locale. |
None | SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\SalesProductConfigurationWidget |
| ExampleDateTimeCartProductConfigurationRenderStrategyPlugin | Renders the display data of the DATE_TIME_CONFIGURATOR and CONFIGURABLE_PRODUCT product configurations. Display data per locale is shown in the current locale. |
None | SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\ProductConfigurationCartWidget |
| ExampleDateTimeProductConfiguratorRequestExpanderPlugin | Expands the request to the configurator with the date-time configurator host. For a CONFIGURABLE_PRODUCT request with an SKU, adds the default price of the product in the current currency for the customer. |
None | SprykerShop\Client\DateTimeConfiguratorPageExample\Plugin\ProductConfiguration |
| ExampleDateTimeWishlistItemProductConfigurationRenderStrategyPlugin | Renders the display data of the DATE_TIME_CONFIGURATOR and CONFIGURABLE_PRODUCT product configurations. Display data per locale is shown in the current locale. |
None | SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\ProductConfigurationWishlistWidget |
| ProductConfigurationWishlistItemRequestExpanderPlugin | Expands WishlistItem with product configuration. |
None | SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\WishlistPage |
| ExampleDateTimeShoppingListItemProductConfigurationRenderStrategyPlugin | Renders the display data of the DATE_TIME_CONFIGURATOR and CONFIGURABLE_PRODUCT product configurations. Display data per locale is shown in the current locale. |
None | SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\ProductConfigurationShoppingListWidget |
| ConfiguratorSecurityHeaderExpanderPlugin | Adds configurator url to Content-Security-Policy header. |
None | SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\Application |
src/Pyz/Zed/Availability/AvailabilityDependencyProvider.php
<?php
namespace Pyz\Zed\Availability;
use Spryker\Zed\Availability\AvailabilityDependencyProvider as SprykerAvailabilityDependencyProvider;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\Availability\ExampleDateTimeConfiguratorAvailabilityStrategyPlugin;
class AvailabilityDependencyProvider extends SprykerAvailabilityDependencyProvider
{
/**
* @return array<\Spryker\Zed\AvailabilityExtension\Dependency\Plugin\AvailabilityStrategyPluginInterface>
*/
protected function getAvailabilityStrategyPlugins(): array
{
return [
new ExampleDateTimeConfiguratorAvailabilityStrategyPlugin(),
];
}
}
src/Pyz/Zed/SalesProductConfigurationGui/SalesProductConfigurationGuiDependencyProvider.php
<?php
namespace Pyz\Zed\SalesProductConfigurationGui;
use Spryker\Zed\SalesProductConfigurationGui\SalesProductConfigurationGuiDependencyProvider as SprykerSalesProductConfigurationGuiDependencyProvider;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\SalesProductConfigurationGui\ExampleDateTimeProductConfigurationRenderStrategyPlugin;
class SalesProductConfigurationGuiDependencyProvider extends SprykerSalesProductConfigurationGuiDependencyProvider
{
/**
* @return array<\Spryker\Zed\SalesProductConfigurationGuiExtension\Dependency\Plugin\ProductConfigurationRenderStrategyPluginInterface>
*/
protected function getProductConfigurationRenderStrategyPlugins(): array
{
return [
new ExampleDateTimeProductConfigurationRenderStrategyPlugin(),
];
}
}
src/Pyz/Yves/ProductConfigurationWishlistWidget/ProductConfigurationWishlistWidgetDependencyProvider.php
<?php
namespace Pyz\Yves\ProductConfigurationWishlistWidget;
use SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\ProductConfigurationWishlistWidget\ExampleDateTimeWishlistItemProductConfigurationRenderStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\ProductConfigurationWishlistWidgetDependencyProvider as SprykerProductConfigurationWishlistWidgetDependencyProvider;
class ProductConfigurationWishlistWidgetDependencyProvider extends SprykerProductConfigurationWishlistWidgetDependencyProvider
{
/**
* @return array<\SprykerShop\Yves\ProductConfigurationWishlistWidgetExtension\Dependency\Plugin\WishlistItemProductConfigurationRenderStrategyPluginInterface>
*/
protected function getWishlistItemProductConfigurationRenderStrategyPlugins(): array
{
return [
new ExampleDateTimeWishlistItemProductConfigurationRenderStrategyPlugin(),
];
}
}
src/Pyz/Yves/WishlistPage/WishlistPageDependencyProvider.php
<?php
namespace Pyz\Yves\WishlistPage;
use SprykerShop\Yves\ProductConfigurationWishlistWidget\Plugin\WishlistPage\ProductConfigurationWishlistItemRequestExpanderPlugin;
use SprykerShop\Yves\WishlistPage\WishlistPageDependencyProvider as SprykerWishlistPageDependencyProvider;
class WishlistPageDependencyProvider extends SprykerWishlistPageDependencyProvider
{
/**
* @return array<\SprykerShop\Yves\WishlistPageExtension\Dependency\Plugin\WishlistItemRequestExpanderPluginInterface>
*/
protected function getWishlistItemRequestExpanderPlugins(): array
{
return [
new ProductConfigurationWishlistItemRequestExpanderPlugin(),
];
}
}
src/Pyz/Yves/ProductConfigurationShoppingListWidget/ProductConfigurationShoppingListWidgetDependencyProvider.php
<?php
namespace Pyz\Yves\ProductConfigurationShoppingListWidget;
use SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\ProductConfigurationShoppingListWidget\ExampleDateTimeShoppingListItemProductConfigurationRenderStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationShoppingListWidget\ProductConfigurationShoppingListWidgetDependencyProvider as SprykerProductConfigurationShoppingListWidgetDependencyProvider;
class ProductConfigurationShoppingListWidgetDependencyProvider extends SprykerProductConfigurationShoppingListWidgetDependencyProvider
{
/**
* @return array<\SprykerShop\Yves\ProductConfigurationShoppingListWidgetExtension\Dependency\Plugin\ShoppingListItemProductConfigurationRenderStrategyPluginInterface>
*/
protected function getShoppingListItemProductConfigurationRenderStrategyPlugins(): array
{
return [
new ExampleDateTimeShoppingListItemProductConfigurationRenderStrategyPlugin(),
];
}
}
src/Pyz/Yves/Application/ApplicationDependencyProvider.php
<?php
namespace Pyz\Yves\Application;
use Spryker\Yves\Application\ApplicationDependencyProvider as SprykerApplicationDependencyProvider;
use SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\Application\ConfiguratorSecurityHeaderExpanderPlugin;
class ApplicationDependencyProvider extends SprykerApplicationDependencyProvider
{
/**
* @return array<\Spryker\Yves\ApplicationExtension\Dependency\Plugin\SecurityHeaderExpanderPluginInterface>
*/
protected function getSecurityHeaderExpanderPlugins(): array
{
return [
new ConfiguratorSecurityHeaderExpanderPlugin(),
];
}
}
src/Pyz/Zed/SalesProductConfigurationGui/SalesProductConfigurationGuiDependencyProvider.php
<?php
namespace Pyz\Zed\SalesProductConfigurationGui;
use Spryker\Zed\SalesProductConfigurationGui\SalesProductConfigurationGuiDependencyProvider as SprykerSalesProductConfigurationGuiDependencyProvider;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\SalesProductConfigurationGui\ExampleDateTimeProductConfigurationRenderStrategyPlugin;
class SalesProductConfigurationGuiDependencyProvider extends SprykerSalesProductConfigurationGuiDependencyProvider
{
/**
* @return array<\Spryker\Zed\SalesProductConfigurationGuiExtension\Dependency\Plugin\ProductConfigurationRenderStrategyPluginInterface>
*/
protected function getProductConfigurationRenderStrategyPlugins(): array
{
return [
new ExampleDateTimeProductConfigurationRenderStrategyPlugin(),
];
}
}
src/Pyz/Yves/SalesProductConfigurationWidget/SalesProductConfigurationWidgetDependencyProvider.php
<?php
namespace Pyz\Yves\SalesProductConfigurationWidget;
use SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\SalesProductConfigurationWidget\ExampleDateTimeSalesProductConfigurationRenderStrategyPlugin;
use SprykerShop\Yves\SalesProductConfigurationWidget\SalesProductConfigurationWidgetDependencyProvider as SprykerSalesProductConfigurationWidgetDependencyProvider;
class SalesProductConfigurationWidgetDependencyProvider extends SprykerSalesProductConfigurationWidgetDependencyProvider
{
/**
* @return array<\SprykerShop\Yves\SalesProductConfigurationWidgetExtension\Dependency\Plugin\SalesProductConfigurationRenderStrategyPluginInterface>
*/
protected function getSalesProductConfigurationRenderStrategyPlugins(): array
{
return [
new ExampleDateTimeSalesProductConfigurationRenderStrategyPlugin(),
];
}
}
src/Pyz/Client/ProductConfiguration/ProductConfigurationDependencyProvider.php
<?php
namespace Pyz\Client\ProductConfiguration;
use Spryker\Client\ProductConfiguration\ProductConfigurationDependencyProvider as SprykerProductConfigurationDependencyProvider;
use SprykerShop\Client\DateTimeConfiguratorPageExample\Plugin\ProductConfiguration\ExampleDateTimeProductConfiguratorRequestExpanderPlugin;
class ProductConfigurationDependencyProvider extends SprykerProductConfigurationDependencyProvider
{
/**
* @return array<\Spryker\Client\ProductConfigurationExtension\Dependency\Plugin\ProductConfiguratorRequestExpanderPluginInterface>
*/
protected function getProductConfigurationRequestExpanderPlugins(): array
{
return [
new ExampleDateTimeProductConfiguratorRequestExpanderPlugin(),
];
}
}
src/Pyz/Yves/ProductConfigurationCartWidget/ProductConfigurationCartWidgetDependencyProvider.php
<?php
namespace Pyz\Yves\ProductConfigurationCartWidget;
use SprykerShop\Yves\DateTimeConfiguratorPageExample\Plugin\ProductConfigurationCartWidget\ExampleDateTimeCartProductConfigurationRenderStrategyPlugin;
use SprykerShop\Yves\ProductConfigurationCartWidget\ProductConfigurationCartWidgetDependencyProvider as SprykerProductConfigurationCartWidgetDependencyProvider;
class ProductConfigurationCartWidgetDependencyProvider extends SprykerProductConfigurationCartWidgetDependencyProvider
{
/**
* @return array<\SprykerShop\Yves\ProductConfigurationCartWidgetExtension\Dependency\Plugin\CartProductConfigurationRenderStrategyPluginInterface>
*/
protected function getCartProductConfigurationRenderStrategyPlugins(): array
{
return [
new ExampleDateTimeCartProductConfigurationRenderStrategyPlugin(),
];
}
}
- To build the frontend assets for the configurator application, in
ConsoleDependencyProvider, set up theDateTimeProductConfiguratorBuildFrontendConsoleconsole command.
src/Pyz/Zed/Console/ConsoleDependencyProvider.php
<?php
namespace Pyz\Zed\Console;
use Spryker\Zed\Console\ConsoleDependencyProvider as SprykerConsoleDependencyProvider;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Console\DateTimeProductConfiguratorBuildFrontendConsole;
class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return array<\Symfony\Component\Console\Command\Command>
*/
protected function getConsoleCommands(Container $container): array
{
return [
new DateTimeProductConfiguratorBuildFrontendConsole(),
];
}
}
- Build the frontend application of the date-time configurator:
console frontend:date-time-product-configurator:build
Make sure that the frontend part has been built:
- Check that the folder
public/Configurator/distexists, and it’s not empty. - Check that you can access the configurator at
https://date-time-configurator-example.mysprykershop.com/.
5) Set up the configurable product configurator
The example module also provides the CONFIGURABLE_PRODUCT product configurator. Its configuration file is a JSON basis configuration with groups, options, prices per currency and price mode, rules, availability, and volume prices. Back Office users set up a product with a basis configuration in the Configurator Setup tab, and on the Storefront, the configurator app starts from the basis configuration of the product.
- Set up the plugins of the product configurator:
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---|---|---|---|
| ConfigurableProductConfigurationConfiguratorKeyResolverPlugin | Recognizes a basis configuration by its schemaVersion property and returns the CONFIGURABLE_PRODUCT configurator key. |
None | SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration |
| ConfigurableProductConfigurationValidatorStrategyPlugin | Validates a basis configuration: its JSON schema, its references, its rules, and its prices for the currencies and price modes of the stores of the product. Returns each error with its location in the file. | None | SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration |
| ConfigurableProductConfigurationDefaultDisplayDataStrategyPlugin | Generates the default display data of a basis configuration: the default option of each group, in each locale of the basis configuration. | None | SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration |
| ConfigurableProductConfigurationTemplatePlugin | Provides the template of the product configurator: the basis configuration of a seawater desalination skid. | None | SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration |
| ConfigurableProductConfigurationSummaryRenderStrategyPlugin | Renders the summary of a basis configuration in the Configurator Setup tab: the numbers of groups, options, and rules, the currencies, and the groups, options, and rules in expandable sections. Summarizes the configuration in the message after saving. | None | SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfigurationGui |
src/Pyz/Zed/ProductConfiguration/ProductConfigurationDependencyProvider.php
<?php
namespace Pyz\Zed\ProductConfiguration;
use Spryker\Zed\ProductConfiguration\ProductConfigurationDependencyProvider as SprykerProductConfigurationDependencyProvider;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration\ConfigurableProductConfigurationConfiguratorKeyResolverPlugin;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration\ConfigurableProductConfigurationDefaultDisplayDataStrategyPlugin;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration\ConfigurableProductConfigurationTemplatePlugin;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfiguration\ConfigurableProductConfigurationValidatorStrategyPlugin;
class ProductConfigurationDependencyProvider extends SprykerProductConfigurationDependencyProvider
{
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationConfiguratorKeyResolverPluginInterface>
*/
protected function getProductConfigurationConfiguratorKeyResolverPlugins(): array
{
return [
new ConfigurableProductConfigurationConfiguratorKeyResolverPlugin(),
];
}
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationValidatorStrategyPluginInterface>
*/
protected function getProductConfigurationValidatorStrategyPlugins(): array
{
return [
new ConfigurableProductConfigurationValidatorStrategyPlugin(),
];
}
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationDefaultDisplayDataStrategyPluginInterface>
*/
protected function getProductConfigurationDefaultDisplayDataStrategyPlugins(): array
{
return [
new ConfigurableProductConfigurationDefaultDisplayDataStrategyPlugin(),
];
}
/**
* @return list<\Spryker\Zed\ProductConfigurationExtension\Dependency\Plugin\ProductConfigurationTemplatePluginInterface>
*/
protected function getProductConfigurationTemplatePlugins(): array
{
return [
new ConfigurableProductConfigurationTemplatePlugin(),
];
}
}
src/Pyz/Zed/ProductConfigurationGui/ProductConfigurationGuiDependencyProvider.php
<?php
namespace Pyz\Zed\ProductConfigurationGui;
use Spryker\Zed\ProductConfigurationGui\ProductConfigurationGuiDependencyProvider as SprykerProductConfigurationGuiDependencyProvider;
use SprykerShop\Zed\DateTimeConfiguratorPageExample\Communication\Plugin\ProductConfigurationGui\ConfigurableProductConfigurationSummaryRenderStrategyPlugin;
class ProductConfigurationGuiDependencyProvider extends SprykerProductConfigurationGuiDependencyProvider
{
/**
* @return list<\Spryker\Zed\ProductConfigurationGui\Dependency\Plugin\ProductConfigurationSummaryRenderStrategyPluginInterface>
*/
protected function getProductConfigurationSummaryRenderStrategyPlugins(): array
{
return [
new ConfigurableProductConfigurationSummaryRenderStrategyPlugin(),
];
}
}
- Configure the Configurator Setup tab for the JSON files of the example product configurators and for the instructions of the example module:
src/Pyz/Zed/ProductConfigurationGui/ProductConfigurationGuiConfig.php
<?php
namespace Pyz\Zed\ProductConfigurationGui;
use Spryker\Zed\ProductConfigurationGui\ProductConfigurationGuiConfig as SprykerProductConfigurationGuiConfig;
class ProductConfigurationGuiConfig extends SprykerProductConfigurationGuiConfig
{
protected const string FILE_EXTENSION_JSON = 'json';
/**
* @uses \SprykerShop\Shared\DateTimeConfiguratorPageExample\DateTimeConfiguratorPageExampleConfig::CONFIGURABLE_PRODUCT_CONFIGURATOR_KEY
*/
protected const string CONFIGURATOR_KEY_CONFIGURABLE_PRODUCT = 'CONFIGURABLE_PRODUCT';
/**
* @uses \SprykerShop\Shared\DateTimeConfiguratorPageExample\DateTimeConfiguratorPageExampleConfig::DATE_TIME_CONFIGURATOR_KEY
*/
protected const string CONFIGURATOR_KEY_DATE_TIME = 'DATE_TIME_CONFIGURATOR';
protected const string TRANSLATION_KEY_EXAMPLE_INTRO = 'date_time_configurator_page_example.configurator_setup.intro';
protected const array TRANSLATION_KEYS_EXAMPLE_STEPS = [
'date_time_configurator_page_example.configurator_setup.step.download',
'date_time_configurator_page_example.configurator_setup.step.edit',
'date_time_configurator_page_example.configurator_setup.step.upload',
];
protected const string TRANSLATION_KEY_EXAMPLE_NOTE = 'date_time_configurator_page_example.configurator_setup.note';
/**
* @return array<string, list<string>>
*/
public function getConfigurationFileMimeTypesByExtension(): array
{
return [
static::FILE_EXTENSION_JSON => ['application/json', 'text/plain'],
];
}
/**
* @return array<string, string>
*/
public function getConfigurationFileExtensionsByConfiguratorKey(): array
{
return [
static::CONFIGURATOR_KEY_CONFIGURABLE_PRODUCT => static::FILE_EXTENSION_JSON,
static::CONFIGURATOR_KEY_DATE_TIME => static::FILE_EXTENSION_JSON,
];
}
public function getConfiguratorSetupIntroTranslationKey(): string
{
return static::TRANSLATION_KEY_EXAMPLE_INTRO;
}
/**
* @return list<string>
*/
public function getConfiguratorSetupStepTranslationKeys(): array
{
return static::TRANSLATION_KEYS_EXAMPLE_STEPS;
}
public function getConfiguratorSetupNoteTranslationKey(): string
{
return static::TRANSLATION_KEY_EXAMPLE_NOTE;
}
}
- Store the published data of a basis configuration. It doesn’t fit into a
TEXTcolumn: the template of the example module is published with 68 KB. The example module redefines thedatacolumn of thespy_product_configuration_storagetable asCLOB, but in a project, Propel merges the schema files ofvendor/spryker-shopbefore the ones ofvendor/spryker, so the core definition of the column applies. Redefine the column in the project schema file of the table from Set up database schema and transfer objects:
src/Pyz/Zed/ProductConfigurationStorage/Persistence/Propel/Schema/spy_product_configuration_storage.schema.xml
<?xml version="1.0"?>
<database xmlns="spryker:schema-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="zed" xsi:schemaLocation="spryker:schema-01 https://static.spryker.com/schema-01.xsd" namespace="Orm\Zed\ProductConfigurationStorage\Persistence" package="src.Orm.Zed.ProductConfigurationStorage.Persistence">
<table name="spy_product_configuration_storage">
<column name="data" type="CLOB" required="false"/>
<behavior name="synchronization">
<parameter name="queue_pool" value="synchronizationPool"/>
</behavior>
</table>
</database>
console propel:schema:validate rejects a changed column type unless the project allows it:
src/Pyz/Zed/Propel/PropelConfig.php
<?php
namespace Pyz\Zed\Propel;
use Spryker\Zed\Propel\PropelConfig as SprykerPropelConfig;
class PropelConfig extends SprykerPropelConfig
{
/**
* @return array<string, array<string>>
*/
public function getWhitelistForAllowedAttributeValueChanges(): array
{
return [
'spy_product_configuration_storage.schema.xml' => ['type'],
];
}
}
Apply the database change:
console propel:install
Before this change, saving a basis configuration in the Back Office succeeds, but publishing it fails because the data doesn’t fit into the column, so the Storefront keeps showing the configuration published before. If Back Office users saved basis configurations before this change, publish the product configurations again:
console publish:trigger-events -r product_configuration
Make sure that the data column of the spy_product_configuration_storage table has the LONGTEXT type in MySQL and MariaDB or the TEXT type in PostgreSQL.
- To let customers open the configurator from the product page, cart, wishlist, and shopping list, add the
CONFIGURABLE_PRODUCTconfigurator key to the configurator keys that the configurator gateway page and the configuration widgets support:
src/Pyz/Yves/ProductConfiguratorGatewayPage/ProductConfiguratorGatewayPageConfig.php
<?php
namespace Pyz\Yves\ProductConfiguratorGatewayPage;
use SprykerShop\Yves\ProductConfiguratorGatewayPage\ProductConfiguratorGatewayPageConfig as SprykerShopProductConfiguratorGatewayPageConfig;
class ProductConfiguratorGatewayPageConfig extends SprykerShopProductConfiguratorGatewayPageConfig
{
/**
* @uses \SprykerShop\Shared\DateTimeConfiguratorPageExample\DateTimeConfiguratorPageExampleConfig::CONFIGURABLE_PRODUCT_CONFIGURATOR_KEY
*/
protected const string CONFIGURATOR_KEY_CONFIGURABLE_PRODUCT = 'CONFIGURABLE_PRODUCT';
/**
* @return list<string>
*/
public function getSupportedConfiguratorKeys(): array
{
return [
...parent::getSupportedConfiguratorKeys(),
static::CONFIGURATOR_KEY_CONFIGURABLE_PRODUCT,
];
}
}
Extend ProductConfigurationCartWidgetConfig, ProductConfigurationWishlistWidgetConfig, and ProductConfigurationShoppingListWidgetConfig the same way, in the Pyz\Yves\ProductConfigurationCartWidget, Pyz\Yves\ProductConfigurationWishlistWidget, and Pyz\Yves\ProductConfigurationShoppingListWidget namespaces.
- Generate the Zed translations of the example module—the validation messages, the summary, and the instructions of the Configurator Setup tab:
console translator:generate-cache
Make sure that the configurable product configurator works:
- In the Back Office, go to Catalog > Products.
- Next to a product whose stores use only the EUR, CHF, and USD currencies, click Edit. On the Variants tab, click Edit next to a product variant. The template of the example module declares prices in these currencies only, and the validation requires a price in every currency of the stores of the product.
- On the Configurator Setup tab, click Template. Make sure that a JSON file named after the SKU of the product variant is downloaded.
- Upload the file and click Save. Make sure that the success message summarizes the configuration:
6 groups · 57 options · 12 rules · prices complete in EUR, CHF, USD. - After the product configuration is published, on the Storefront, open the product page of the product variant and click Configure. Make sure that the configurator shows the groups and options of the template with the default option of each group selected.
Thank you!
For submitting the form