Glue API - Configurable Bundle + Product feature integration

Edit on GitHub

This document describes how to integrate the Glue API: Configurable Bundle + Product feature.

Prerequisites

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

NAME VERSION INTEGRATION GUIDE
Spryker Core 202204.0 Glue API: Spryker Core feature integration
Configurable Bundle 202204.0 Glue API: Configurable Bundle feature integration
Product 202204.0 Glue API: Products feature integration

1) Install the required modules using Composer

Install the required modules:

composer require spryker/configurable-bundles-products-resource-relationship:"^1.0.0" --update-with-dependencies
Verification

Make sure that the following module has been installed:

MODULE EXPECTED DIRECTORY
ConfigurableBundlesProductsResourceRelationship vendor/spryker/configurable-bundles-products-resource-relationship

2) Set up transfer objects

Set up transfer objects:

console transfer:generate
Verification

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

Transfer Type Event Path
ConcreteProductsRestAttributesTransfer class created src/Generated/Shared/Transfer/ConcreteProductsRestAttributesTransfer
ProductConcreteCriteriaFilterTransfer class created src/Generated/Shared/Transfer/ProductConcreteCriteriaFilterTransfer
ConfigurableBundleTemplateSlotStorageTransfer class created src/Generated/Shared/Transfer/ConfigurableBundleTemplateSlotStorageTransfer
ProductListTransfer class created src/Generated/Shared/Transfer/ProductListTransfer

3) Set up behavior

Activate the following plugins:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
ProductConcreteByConfigurableBundleTemplateSlotResourceRelationshipPlugin Adds the concrete-products resource as a relationship by configurable bundle template slot. None Spryker\Glue\ConfigurableBundlesProductsResourceRelationship\Plugin\GlueApplication

src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php

<?php

namespace Pyz\Glue\GlueApplication;

use Spryker\Glue\ConfigurableBundlesProductsResourceRelationship\ConfigurableBundlesProductsResourceRelationshipConfig;
use Spryker\Glue\ConfigurableBundlesProductsResourceRelationship\Plugin\GlueApplication\ProductConcreteByConfigurableBundleTemplateSlotResourceRelationshipPlugin;
use Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface;
use Spryker\Glue\GlueApplication\GlueApplicationDependencyProvider as SprykerGlueApplicationDependencyProvider;

class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependencyProvider
{
    /**
     * @param \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface $resourceRelationshipCollection
     *
     * @return \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface
     */
    protected function getResourceRelationshipPlugins(
        ResourceRelationshipCollectionInterface $resourceRelationshipCollection
    ): ResourceRelationshipCollectionInterface {
        $resourceRelationshipCollection->addRelationship(
            ConfigurableBundlesProductsResourceRelationshipConfig::RESOURCE_CONFIGURABLE_BUNDLE_TEMPLATE_SLOTS,
            new ProductConcreteByConfigurableBundleTemplateSlotResourceRelationshipPlugin()
        );

        return $resourceRelationshipCollection;
    }
}
Verification

Send the following request and make sure that each configurable-bundle-template-slot resource has a relationship to the concrete-products resource: GET https://glue.mysprykershop.com/configurable-bundle-templates?include=configurable-bundle-template-slots,concrete-products.

Integrate the following related features:

FEATURE REQUIRED FOR THE CURRENT FEATURE INTEGRATION GUIDE
Glue API: Configurable Bundle Glue API: Configurable Bundle feature integration
GLUE: Configurable Bundle + Cart Glue API: Configurable Bundle + Cart feature integration