Install the Marketplace Inventory Management Glue API

Edit on GitHub

This document describes how to integrate the Marketplace Inventory Management Glue API feature into a Spryker project.

Install feature core

Follow the steps below to install the Marketplace Inventory Management Glue API feature core.

Prerequisites

Install the required features:

NAME VERSION INSTALLATION GUIDE
Spryker Core 202410.0 Install the Spryker Core Glue API
Marketplace Inventory Management 202410.0 Install the Marketplace Inventory Management feature

1) Install the required modules

Install the required modules using Composer:

composer require spryker/product-offer-availabilities-rest-api:"^0.4.0" --update-with-dependencies
Verification

Make sure that the following modules have been installed:

MODULE EXPECTED DIRECTORY
ProductOfferAvailabilitiesRestApi vendor/spryker/product-offer-availabilities-rest-api

2) Set up transfer objects

Generate transfer changes:

console transfer:generate
Verification

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

TRANSFER TYPE EVENT PATH
RestProductOfferAvailabilitiesAttributes object Created src/Generated/Shared/Transfer/RestProductOfferAvailabilitiesAttributesTransfer

3) Enable resources and relationships

Activate the following plugins:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
ProductOfferAvailabilitiesResourceRoutePlugin Registers the product-offer-availabilities resource. Spryker\Glue\ProductOfferAvailabilitiesRestApi\Plugin\GlueApplication
ProductOfferAvailabilitiesByProductOfferReferenceResourceRelationshipPlugin Adds the product-offer-availabilities resource as a relationship of the product-offers resource. Spryker\Glue\ProductOfferAvailabilitiesRestApi\Plugin\GlueApplication
src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php
<?php

namespace Pyz\Glue\GlueApplication;

use Spryker\Glue\GlueApplication\GlueApplicationDependencyProvider as SprykerGlueApplicationDependencyProvider;
use Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface;
use Spryker\Glue\MerchantProductOffersRestApi\MerchantProductOffersRestApiConfig;
use Spryker\Glue\ProductOfferAvailabilitiesRestApi\Plugin\GlueApplication\ProductOfferAvailabilitiesByProductOfferReferenceResourceRelationshipPlugin;
use Spryker\Glue\ProductOfferAvailabilitiesRestApi\Plugin\GlueApplication\ProductOfferAvailabilitiesResourceRoutePlugin;

class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependencyProvider
{
    /**
     * @return array<\Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRoutePluginInterface>
     */
    protected function getResourceRoutePlugins(): array
    {
        return [
            new ProductOfferAvailabilitiesResourceRoutePlugin(),
        ];
    }

    /**
     * @param \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface $resourceRelationshipCollection
     *
     * @return \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface
     */
    protected function getResourceRelationshipPlugins(
        ResourceRelationshipCollectionInterface $resourceRelationshipCollection
    ): ResourceRelationshipCollectionInterface {
        $resourceRelationshipCollection->addRelationship(
            MerchantProductOffersRestApiConfig::RESOURCE_PRODUCT_OFFERS,
            new ProductOfferAvailabilitiesByProductOfferReferenceResourceRelationshipPlugin()
        );

        return $resourceRelationshipCollection;
    }
}
Verification

Make sure that the ProductOfferAvailabilitiesResourceRoutePlugin plugin is set up by sending the request GET https://glue.mysprykershop.com/product-offers/{{productOfferReference}}/product-offer-availabilities.

Make sure that ProductOfferAvailabilitiesByProductOfferReferenceResourceRelationshipPlugin is set up by sending the request GET https://glue.mysprykershop.com{{url}}/product-offers/{{productOfferReference}}?include=product-offer-availabilities. The response should include the product-offer-availabilities resource along with product-offers.

Integrate the following related features:

FEATURE REQUIRED FOR THE CURRENT FEATURE INSTALLATION GUIDE
Marketplace Inventory Management + Wishlist Glue API Install the Marketplace Inventory Management + Wishlist Glue API