Glue API - Product Relations feature integration
Edit on GitHub
You are browsing a previous version of the document. The latest version is 202204.0.
Install feature API
Follow the steps to install the Product Relations feature API.
Prerequisites
To start feature integration, overview and install the necessary features:
Name | Version | Required Sub-Feature |
---|---|---|
Spryker Core | master | Glue Application |
Product Relation | master | |
Glue API: Cart | master | Glue API: Cart feature integration |
Glue API: Products | master | Glue API: Products feature integration |
1) Install the required modules using Composer
Run the following command to install the required modules:
composer require spryker/related-products-rest-api:"^1.0.0" spryker/up-selling-products-rest-api:"^1.0.0" --update-with-dependencies
“Verification”
Make sure that the following modules have been installed:
Module | Expected Directory |
---|---|
RelatedProductsRestApi |
vendor/spryker/related-products-rest-api |
UpSellingProductsRestApi |
vendor/spryker/up-selling-products-rest-api |
2) Set up Behavior
Set up the following behavior.
Enable Resources and Relationships
Activate the following plugins:
Plugin | Specification | Prerequisites | Namespace |
---|---|---|---|
RelatedProductsResourceRoutePlugin |
Retrieves the related products collection. | None | Spryker\Glue\RelatedProductsRestApi\Plugin\GlueApplication |
CartUpSellingProductsResourceRoutePlugin |
Retrieves the up-selling products collection for the cart. | None | Spryker\Glue\UpSellingProductsRestApi\Plugin\GlueApplication |
GuestCartUpSellingProductsResourceRoutePlugin |
Retrieves the up-selling products collection for the guest cart. | None | Spryker\Glue\UpSellingProductsRestApi\Plugin\GlueApplication |
src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php
<?php
namespace Pyz\Glue\GlueApplication;
use Spryker\Glue\GlueApplication\GlueApplicationDependencyProvider as SprykerGlueApplicationDependencyProvider;
use Spryker\Glue\RelatedProductsRestApi\Plugin\GlueApplication\RelatedProductsResourceRoutePlugin;
use Spryker\Glue\UpSellingProductsRestApi\Plugin\GlueApplication\CartUpSellingProductsResourceRoutePlugin;
use Spryker\Glue\UpSellingProductsRestApi\Plugin\GlueApplication\GuestCartUpSellingProductsResourceRoutePlugin;
class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependencyProvider
{
/**
* @return \Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRoutePluginInterface[]
*/
protected function getResourceRoutePlugins(): array
{
return [
new RelatedProductsResourceRoutePlugin(),
new CartUpSellingProductsResourceRoutePlugin(),
new GuestCartUpSellingProductsResourceRoutePlugin(),
];
}
}
<section class='info-block info-block--warning'><i class='info-block__icon icon-warning'></i><div class='info-block__content'><div class="info-block__title">Verification</div>
Make sure that the following endpoints are available:
`https://glue.mysprykershop.com/abstract-products/`{{abstract_product_sku}}`e/related-products`
`https://glue.mysprykershop.com/carts/`{{cart_uuid}}`/up-selling-products`
`https://glue.mysprykershop.com/guest-carts/`{{guest_cart_uuid}}`/up-selling-products`
</div></section>
Thank you!
For submitting the form