From 30752641b8ecf3a9ea646c9449dcf9332e2e7fbf Mon Sep 17 00:00:00 2001 From: Ievgen Malykhin Date: Mon, 17 Jul 2023 18:13:18 +0300 Subject: [PATCH 1/8] CC-16486: Update product rationg and review feature integration guide --- ...-rating-and-reviews-feature-integration.md | 666 ++++++++++++++++++ 1 file changed, 666 insertions(+) create mode 100644 docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md diff --git a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md new file mode 100644 index 00000000000..17c8c4cee7f --- /dev/null +++ b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md @@ -0,0 +1,666 @@ +--- +title: Glue API - Product rating & reviews feature integration +description: This guide contains step-by-step instructions on integrating Product Rating & Reviews API feature into a Spryker-based project. +last_updated: Jul 17, 2023 +template: feature-integration-guide-template +originalLink: https://documentation.spryker.com/2021080/docs/glue-api-product-rating-reviews-feature-integration +originalArticleId: 6634ada1-2f5a-454b-a5b3-9319b7e90cbf +redirect_from: + - /2021080/docs/glue-api-product-rating-reviews-feature-integration + - /2021080/docs/en/glue-api-product-rating-reviews-feature-integration + - /docs/glue-api-product-rating-reviews-feature-integration + - /docs/en/glue-api-product-rating-reviews-feature-integration +--- + +## Install feature API + +### Prerequisites + +To start feature integration, overview and install the necessary features: + +| NAME | VERSION | INTEGRATION GUIDE | +| --- | --- | --- | +| Spryker Core | {{page.version}} | [Feature API](/docs/scos/dev/feature-integration-guides/{{page.version}}/glue-api/glue-api-spryker-core-feature-integration.html) | +| Product Rating & Reviews | {{page.version}} | | + +### 1) Install the required modules using Composer + +Run the following command to install the required modules: + +```bash +composer require spryker/product-reviews-rest-api:"^1.0.0" --update-with-dependencies +``` +{% info_block warningBox "Verification" %} + +Make sure that the following module was installed: + +| MODULE | EXPECTED DIRECTORY | +| --- | --- | +| ProductReviewsRestApi | vendor/spryker/product-reviews-rest-api | + +{% endinfo_block %} + +### 2) Set up database schema and transfer objects + +Run the following command to generate transfer changes: + +```bash +console transfer:generate +console propel:install +console transfer:generate +``` +{% info_block warningBox "Verification" %} + +Make sure that the following changes have been applied in the transfer objects: + +| TRANSFER | TYPE | EVENT | PATH | +| --- | --- | --- | --- | +| RestProductReviewsAttributesTransfer | class | created |src/Generated/Shared/Transfer/RestProductReviewsAttributesTransfer | +| BulkProductReviewSearchRequestTransfer | class | created |src/Generated/Shared/Transfer/BulkProductReviewSearchRequestTransfer| + +{% endinfo_block %} + +{% info_block warningBox "Verification" %} + +Make sure that `SpyProductAbstractStorage` and `SpyProductConcreteStorage` are extended by synchronization behavior with these methods: + +| ENTITY | TYPE | EVENT | PATH | METHODS | +| --- | --- | --- | --- | --- | +| SpyProductAbstractStorage | class | extended |src/Orm/Zed/ProductStorage/Persistence/Base/SpyProductAbstractStorage | syncPublishedMessageForMappings(), syncUnpublishedMessageForMappings() | +| SpyProductConcreteStorage | class | extended | src/Orm/Zed/ProductStorage/Persistence/Base/SpyProductConcreteStorage | syncPublishedMessageForMappings(), yncUnpublishedMessageForMappings() | + +{% endinfo_block %} + +### 3) Set up behavior + +#### Reload data to storage + +Run the following commands to reload abstract and product data to storage. + +```bash +console event:trigger -r product_abstract +console event:trigger -r product_concrete +``` +{% info_block warningBox "Verification" %} + +Make sure that there is data in Redis with keys: + +- `kv:product_abstract:{% raw %}{{{% endraw %}store_name{% raw %}}}{% endraw %}:{% raw %}{{{% endraw %}locale_name{% raw %}}}{% endraw %}:sku:{% raw %}{{{% endraw %}sku_product_abstract{% raw %}}}{% endraw %}` +- `kv:product_concrete:{% raw %}{{{% endraw %}locale_name{% raw %}}}{% endraw %}:sku:{% raw %}{{{% endraw %}sku_product_concrete{% raw %}}}{% endraw %}` + +{% endinfo_block %} + +#### Enable resources + +Activate the following plugins: + +| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | +| --- | --- | --- | --- | +| AbstractProductsProductReviewsResourceRoutePlugin | Registers the product-reviews resource. | None | Spryker\Glue\ProductReviewsRestApi\Plugin\GlueApplication | + +**src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php** + +```php + +Example + +```json +{ + "data": [ + { + "type": "product-reviews", + "id": "21", + "attributes": { + "rating": 4, + "nickname": "Spencor", + "summary": "Donec vestibulum lectus ligula", + "description": "Donec vestibulum lectus ligula, non aliquet neque vulputate vel. Integer neque massa, ornare sit amet felis vitae, pretium feugiat magna. Suspendisse mollis rutrum ante, vitae gravida ipsum commodo quis. Donec eleifend orci sit amet nisi suscipit pulvinar. Nullam ullamcorper dui lorem, nec vehicula justo accumsan id. Sed venenatis magna at posuere maximus. Sed in mauris mauris. Curabitur quam ex, vulputate ac dignissim ac, auctor eget lorem. Cras vestibulum ex quis interdum tristique." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews/21" + } + }, + { + "type": "product-reviews", + "id": "22", + "attributes": { + "rating": 4, + "nickname": "Maria", + "summary": "Curabitur varius, dui ac vulputate ullamcorper", + "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vel mauris consequat, dictum metus id, facilisis quam. Vestibulum imperdiet aliquam interdum. Pellentesque tempus at neque sed laoreet. Nam elementum vitae nunc fermentum suscipit. Suspendisse finibus risus at sem pretium ullamcorper. Donec rutrum nulla nec massa tristique, porttitor gravida risus feugiat. Ut aliquam turpis nisi." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews/22" + } + }, + { + "type": "product-reviews", + "id": "23", + "attributes": { + "rating": 4, + "nickname": "Maggie", + "summary": "Aliquam erat volutpat", + "description": "Morbi vitae ultricies libero. Aenean id lectus a elit sollicitudin commodo. Donec mattis libero sem, eu convallis nulla rhoncus ac. Nam tincidunt volutpat sem, eu congue augue cursus at. Mauris augue lorem, lobortis eget varius at, iaculis ac velit. Sed vulputate rutrum lorem, ut rhoncus dolor commodo ac. Aenean sed varius massa. Quisque tristique orci nec blandit fermentum. Sed non vestibulum ante, vitae tincidunt odio. Integer quis elit eros. Phasellus tempor dolor lectus, et egestas magna convallis quis. Ut sed odio nulla. Suspendisse quis laoreet nulla. Integer quis justo at velit euismod imperdiet. Ut orci dui, placerat ut ex ac, lobortis ullamcorper dui. Etiam euismod risus hendrerit laoreet auctor." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews/23" + } + }, + { + "type": "product-reviews", + "id": "25", + "attributes": { + "rating": 3, + "nickname": "Spencor", + "summary": "Curabitur ultricies, sapien quis placerat lacinia", + "description": "Etiam venenatis sit amet lorem eget tristique. Donec rutrum massa nec commodo cursus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse scelerisque scelerisque augue eget condimentum. Quisque quis arcu consequat, lacinia nulla tempor, venenatis ante. In ullamcorper, orci sit amet tempus tincidunt, massa augue molestie enim, in finibus metus odio at purus. Mauris ut semper sem, a ornare sapien. Fusce eget facilisis felis. Integer imperdiet massa a tortor varius, tincidunt laoreet ipsum viverra." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews/25" + } + }, + { + "type": "product-reviews", + "id": "26", + "attributes": { + "rating": 5, + "nickname": "Spencor", + "summary": "Cras porttitor", + "description": "Cras porttitor, odio vel ultricies commodo, erat turpis pulvinar turpis, id faucibus dolor odio a tellus. Mauris et nibh tempus, convallis ipsum luctus, mollis risus. Donec molestie orci ante, id tristique diam interdum eget. Praesent erat neque, sollicitudin sit amet pellentesque eget, gravida in lectus. Donec ultrices, nisl in laoreet ultrices, nunc enim lacinia felis, ac convallis tortor ligula non eros. Morbi semper ipsum non elit mollis, non commodo arcu porta. Mauris tincidunt purus rutrum erat ornare, varius egestas eros eleifend." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews/26" + } + } + ], + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews?page[offset]=0&page[limit]=5", + "last": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews?page[offset]=0&page[limit]=5", + "first": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews?page[offset]=0&page[limit]=5" + } +} +``` + + +{% endinfo_block %} + +#### Enable query expanders +Activate the following plugins: + +| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | +| --- | --- | --- | --- | +| FilterByIdProductReviewQueryExpanderPlugin | | None | Spryker\Client\ProductReviewSearch\Plugin\Search | + +**src/Pyz/Client/ProductReview/ProductReviewDependencyProvider.php** + +```php + + */ + protected function getProductReviewsQueryExpanderPlugins(): array + { + $productReviewQueryExpanderPlugins = parent::getProductReviewsQueryExpanderPlugins(); + $productReviewQueryExpanderPlugins[] = new FilterByIdProductReviewQueryExpanderPlugin(); + + return $productReviewQueryExpanderPlugins; + } +} +``` + +{% info_block warningBox "Verification" %} + +Make sure that the following endpoint is available: +`https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}/product-reviews/{% raw %}{{{% endraw %}review_id{% raw %}}}{% endraw %}` + +
+Example + +```json +{ + "data": { + "type": "product-reviews", + "id": "21", + "attributes": { + "rating": 4, + "nickname": "Spencor", + "summary": "Donec vestibulum lectus ligula", + "description": "Donec vestibulum lectus ligula, non aliquet neque vulputate vel. Integer neque massa, ornare sit amet felis vitae, pretium feugiat magna. Suspendisse mollis rutrum ante, vitae gravida ipsum commodo quis. Donec eleifend orci sit amet nisi suscipit pulvinar. Nullam ullamcorper dui lorem, nec vehicula justo accumsan id. Sed venenatis magna at posuere maximus. Sed in mauris mauris. Curabitur quam ex, vulputate ac dignissim ac, auctor eget lorem. Cras vestibulum ex quis interdum tristique." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139/product-reviews/21" + } + } +} +``` +
+ +{% endinfo_block %} + +#### Enable relationships + +Activate the following plugins: + +| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | +| --- | --- | --- | --- | +| ProductReviewsRelationshipByProductAbstractSkuPlugin | Adds product-reviews relationship by abstract product sku. | None |\Spryker\Glue\ProductReviewsRestApi\Plugin\GlueApplication | +| ProductReviewsRelationshipByProductConcreteSkuPlugin | Adds product-reviews relationship by concrete product sku. | None | \Spryker\Glue\ProductReviewsRestApi\Plugin\GlueApplication | +| ProductReviewsAbstractProductsResourceExpanderPlugin | Expands abstract-products resource with reviews data. | None | Spryker\Glue\ProductReviewsRestApi\Plugin\ProductsRestApi | +| ProductReviewsConcreteProductsResourceExpanderPlugin | Expands concrete-products resource with reviews data. | None | Spryker\Glue\ProductReviewsRestApi\Plugin\ProductsRestApi | + +**src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php** + +```php +addRelationship( + ProductsRestApiConfig::RESOURCE_ABSTRACT_PRODUCTS, + new ProductReviewsRelationshipByProductAbstractSkuPlugin() + ); + $resourceRelationshipCollection->addRelationship( + ProductsRestApiConfig::RESOURCE_CONCRETE_PRODUCTS, + new ProductReviewsRelationshipByProductConcreteSkuPlugin() + ); + + return $resourceRelationshipCollection; + } +} +``` + +**src/Pyz/Glue/ProductsRestApi/ProductsRestApiDependencyProvider.php** + +```php + +Example + +```json +{ + "data": { + "type": "abstract-products", + "id": "139", + "attributes": { + "sku": "139", + "averageRating": 4, + "reviewCount": 5, + "name": "Asus Transformer Book T200TA", + "description": "As light as you like Transformer Book T200 is sleek, slim and oh so light—just 26mm tall and 1.5kg docked. And when need to travel even lighter, detach the 11.6-inch tablet for 11.95mm slenderness and a mere 750g weight! With up to 10.4 hours of battery life that lasts all day long, you’re free to work or play from dawn to dusk. And ASUS Instant On technology ensures that Transformer Book T200 is always responsive and ready for action! Experience outstanding performance from the latest Intel® quad-core processor. You’ll multitask seamlessly and get more done in less time. Transformer Book T200 also delivers exceptional graphics performance—with Intel HD graphics that are up to 30% faster than ever before! Transformer Book T200 is equipped with USB 3.0 connectivity for data transfers that never leave you waiting. Just attach your USB 3.0 devices to enjoy speeds that are up to 10X faster than USB 2.0!", + "attributes": { + "product_type": "Hybrid (2-in-1)", + "form_factor": "clamshell", + "processor_cache_type": "2", + "processor_frequency": "1.59 GHz", + "brand": "Asus", + "color": "Black" + }, + "superAttributesDefinition": [ + "form_factor", + "processor_frequency", + "color" + ], + "superAttributes": [], + "attributeMap": { + "product_concrete_ids": [ + "139_24699831" + ], + "super_attributes": [], + "attribute_variants": [] + }, + "metaTitle": "Asus Transformer Book T200TA", + "metaKeywords": "Asus,Entertainment Electronics", + "metaDescription": "As light as you like Transformer Book T200 is sleek, slim and oh so light—just 26mm tall and 1.5kg docked. And when need to travel even lighter, detach t", + "attributeNames": { + "product_type": "Product type", + "form_factor": "Form factor", + "processor_cache_type": "Processor cache", + "processor_frequency": "Processor frequency", + "brand": "Brand", + "color": "Color" + }, + "url": "/en/asus-transformer-book-t200ta-139" + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/abstract-products/139?include=product-reviews" + }, + "relationships": { + "product-reviews": { + "data": [ + { + "type": "product-reviews", + "id": "21" + }, + { + "type": "product-reviews", + "id": "22" + }, + { + "type": "product-reviews", + "id": "23" + }, + { + "type": "product-reviews", + "id": "25" + }, + { + "type": "product-reviews", + "id": "26" + } + ] + } + } + }, + "included": [ + { + "type": "product-reviews", + "id": "21", + "attributes": { + "rating": 4, + "nickname": "Spencor", + "summary": "Donec vestibulum lectus ligula", + "description": "Donec vestibulum lectus ligula, non aliquet neque vulputate vel. Integer neque massa, ornare sit amet felis vitae, pretium feugiat magna. Suspendisse mollis rutrum ante, vitae gravida ipsum commodo quis. Donec eleifend orci sit amet nisi suscipit pulvinar. Nullam ullamcorper dui lorem, nec vehicula justo accumsan id. Sed venenatis magna at posuere maximus. Sed in mauris mauris. Curabitur quam ex, vulputate ac dignissim ac, auctor eget lorem. Cras vestibulum ex quis interdum tristique." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/21" + } + }, + { + "type": "product-reviews", + "id": "22", + "attributes": { + "rating": 4, + "nickname": "Maria", + "summary": "Curabitur varius, dui ac vulputate ullamcorper", + "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vel mauris consequat, dictum metus id, facilisis quam. Vestibulum imperdiet aliquam interdum. Pellentesque tempus at neque sed laoreet. Nam elementum vitae nunc fermentum suscipit. Suspendisse finibus risus at sem pretium ullamcorper. Donec rutrum nulla nec massa tristique, porttitor gravida risus feugiat. Ut aliquam turpis nisi." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/22" + } + }, + { + "type": "product-reviews", + "id": "23", + "attributes": { + "rating": 4, + "nickname": "Maggie", + "summary": "Aliquam erat volutpat", + "description": "Morbi vitae ultricies libero. Aenean id lectus a elit sollicitudin commodo. Donec mattis libero sem, eu convallis nulla rhoncus ac. Nam tincidunt volutpat sem, eu congue augue cursus at. Mauris augue lorem, lobortis eget varius at, iaculis ac velit. Sed vulputate rutrum lorem, ut rhoncus dolor commodo ac. Aenean sed varius massa. Quisque tristique orci nec blandit fermentum. Sed non vestibulum ante, vitae tincidunt odio. Integer quis elit eros. Phasellus tempor dolor lectus, et egestas magna convallis quis. Ut sed odio nulla. Suspendisse quis laoreet nulla. Integer quis justo at velit euismod imperdiet. Ut orci dui, placerat ut ex ac, lobortis ullamcorper dui. Etiam euismod risus hendrerit laoreet auctor." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/23" + } + }, + { + "type": "product-reviews", + "id": "25", + "attributes": { + "rating": 3, + "nickname": "Spencor", + "summary": "Curabitur ultricies, sapien quis placerat lacinia", + "description": "Etiam venenatis sit amet lorem eget tristique. Donec rutrum massa nec commodo cursus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse scelerisque scelerisque augue eget condimentum. Quisque quis arcu consequat, lacinia nulla tempor, venenatis ante. In ullamcorper, orci sit amet tempus tincidunt, massa augue molestie enim, in finibus metus odio at purus. Mauris ut semper sem, a ornare sapien. Fusce eget facilisis felis. Integer imperdiet massa a tortor varius, tincidunt laoreet ipsum viverra." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/25" + } + }, + { + "type": "product-reviews", + "id": "26", + "attributes": { + "rating": 5, + "nickname": "Spencor", + "summary": "Cras porttitor", + "description": "Cras porttitor, odio vel ultricies commodo, erat turpis pulvinar turpis, id faucibus dolor odio a tellus. Mauris et nibh tempus, convallis ipsum luctus, mollis risus. Donec molestie orci ante, id tristique diam interdum eget. Praesent erat neque, sollicitudin sit amet pellentesque eget, gravida in lectus. Donec ultrices, nisl in laoreet ultrices, nunc enim lacinia felis, ac convallis tortor ligula non eros. Morbi semper ipsum non elit mollis, non commodo arcu porta. Mauris tincidunt purus rutrum erat ornare, varius egestas eros eleifend." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/26" + } + } + ] +} +``` + + +{% endinfo_block %} + +{% info_block warningBox "Verification" %} + +Make a request to `https://glue.mysprykershop.com/concrete-products/{% raw %}{{{% endraw %}concrete_sku{% raw %}}}{% endraw %}?include=product-reviews`. + +Make sure that the response contains product-reviews as a relationship and product-reviews data included. + +
+Example + +```json +{ + "data": { + "type": "concrete-products", + "id": "139_24699831", + "attributes": { + "sku": "139_24699831", + "isDiscontinued": false, + "discontinuedNote": null, + "averageRating": 4, + "reviewCount": 5, + "name": "Asus Transformer Book T200TA", + "description": "As light as you like Transformer Book T200 is sleek, slim and oh so light—just 26mm tall and 1.5kg docked. And when need to travel even lighter, detach the 11.6-inch tablet for 11.95mm slenderness and a mere 750g weight! With up to 10.4 hours of battery life that lasts all day long, you’re free to work or play from dawn to dusk. And ASUS Instant On technology ensures that Transformer Book T200 is always responsive and ready for action! Experience outstanding performance from the latest Intel® quad-core processor. You’ll multitask seamlessly and get more done in less time. Transformer Book T200 also delivers exceptional graphics performance—with Intel HD graphics that are up to 30% faster than ever before! Transformer Book T200 is equipped with USB 3.0 connectivity for data transfers that never leave you waiting. Just attach your USB 3.0 devices to enjoy speeds that are up to 10X faster than USB 2.0!", + "attributes": { + "product_type": "Hybrid (2-in-1)", + "form_factor": "clamshell", + "processor_cache_type": "2", + "processor_frequency": "1.59 GHz", + "brand": "Asus", + "color": "Black" + }, + "superAttributesDefinition": [ + "form_factor", + "processor_frequency", + "color" + ], + "metaTitle": "Asus Transformer Book T200TA", + "metaKeywords": "Asus,Entertainment Electronics", + "metaDescription": "As light as you like Transformer Book T200 is sleek, slim and oh so light—just 26mm tall and 1.5kg docked. And when need to travel even lighter, detach t", + "attributeNames": { + "product_type": "Product type", + "form_factor": "Form factor", + "processor_cache_type": "Processor cache", + "processor_frequency": "Processor frequency", + "brand": "Brand", + "color": "Color" + } + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/concrete-products/139_24699831?include=product-reviews" + }, + "relationships": { + "product-reviews": { + "data": [ + { + "type": "product-reviews", + "id": "21" + }, + { + "type": "product-reviews", + "id": "22" + }, + { + "type": "product-reviews", + "id": "23" + }, + { + "type": "product-reviews", + "id": "25" + }, + { + "type": "product-reviews", + "id": "26" + } + ] + } + } + }, + "included": [ + { + "type": "product-reviews", + "id": "21", + "attributes": { + "rating": 4, + "nickname": "Spencor", + "summary": "Donec vestibulum lectus ligula", + "description": "Donec vestibulum lectus ligula, non aliquet neque vulputate vel. Integer neque massa, ornare sit amet felis vitae, pretium feugiat magna. Suspendisse mollis rutrum ante, vitae gravida ipsum commodo quis. Donec eleifend orci sit amet nisi suscipit pulvinar. Nullam ullamcorper dui lorem, nec vehicula justo accumsan id. Sed venenatis magna at posuere maximus. Sed in mauris mauris. Curabitur quam ex, vulputate ac dignissim ac, auctor eget lorem. Cras vestibulum ex quis interdum tristique." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/21" + } + }, + { + "type": "product-reviews", + "id": "22", + "attributes": { + "rating": 4, + "nickname": "Maria", + "summary": "Curabitur varius, dui ac vulputate ullamcorper", + "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vel mauris consequat, dictum metus id, facilisis quam. Vestibulum imperdiet aliquam interdum. Pellentesque tempus at neque sed laoreet. Nam elementum vitae nunc fermentum suscipit. Suspendisse finibus risus at sem pretium ullamcorper. Donec rutrum nulla nec massa tristique, porttitor gravida risus feugiat. Ut aliquam turpis nisi." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/22" + } + }, + { + "type": "product-reviews", + "id": "23", + "attributes": { + "rating": 4, + "nickname": "Maggie", + "summary": "Aliquam erat volutpat", + "description": "Morbi vitae ultricies libero. Aenean id lectus a elit sollicitudin commodo. Donec mattis libero sem, eu convallis nulla rhoncus ac. Nam tincidunt volutpat sem, eu congue augue cursus at. Mauris augue lorem, lobortis eget varius at, iaculis ac velit. Sed vulputate rutrum lorem, ut rhoncus dolor commodo ac. Aenean sed varius massa. Quisque tristique orci nec blandit fermentum. Sed non vestibulum ante, vitae tincidunt odio. Integer quis elit eros. Phasellus tempor dolor lectus, et egestas magna convallis quis. Ut sed odio nulla. Suspendisse quis laoreet nulla. Integer quis justo at velit euismod imperdiet. Ut orci dui, placerat ut ex ac, lobortis ullamcorper dui. Etiam euismod risus hendrerit laoreet auctor." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/23" + } + }, + { + "type": "product-reviews", + "id": "25", + "attributes": { + "rating": 3, + "nickname": "Spencor", + "summary": "Curabitur ultricies, sapien quis placerat lacinia", + "description": "Etiam venenatis sit amet lorem eget tristique. Donec rutrum massa nec commodo cursus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse scelerisque scelerisque augue eget condimentum. Quisque quis arcu consequat, lacinia nulla tempor, venenatis ante. In ullamcorper, orci sit amet tempus tincidunt, massa augue molestie enim, in finibus metus odio at purus. Mauris ut semper sem, a ornare sapien. Fusce eget facilisis felis. Integer imperdiet massa a tortor varius, tincidunt laoreet ipsum viverra." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/25" + } + }, + { + "type": "product-reviews", + "id": "26", + "attributes": { + "rating": 5, + "nickname": "Spencor", + "summary": "Cras porttitor", + "description": "Cras porttitor, odio vel ultricies commodo, erat turpis pulvinar turpis, id faucibus dolor odio a tellus. Mauris et nibh tempus, convallis ipsum luctus, mollis risus. Donec molestie orci ante, id tristique diam interdum eget. Praesent erat neque, sollicitudin sit amet pellentesque eget, gravida in lectus. Donec ultrices, nisl in laoreet ultrices, nunc enim lacinia felis, ac convallis tortor ligula non eros. Morbi semper ipsum non elit mollis, non commodo arcu porta. Mauris tincidunt purus rutrum erat ornare, varius egestas eros eleifend." + }, + "links": { + "self": "http://glue.de.suite-nonsplit.local/product-reviews/26" + } + } + ] +} +``` +
+ +{% endinfo_block %} + + + From c4f26a74f2a811fc9f5d46c005087027a2e7d843 Mon Sep 17 00:00:00 2001 From: Ievgen Malykhin Date: Tue, 18 Jul 2023 13:06:22 +0300 Subject: [PATCH 2/8] CC-16486: Adjust ig after CR --- ...product-rating-and-reviews-feature-integration.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md index 17c8c4cee7f..790eb5423cf 100644 --- a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md +++ b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md @@ -28,7 +28,7 @@ To start feature integration, overview and install the necessary features: Run the following command to install the required modules: ```bash -composer require spryker/product-reviews-rest-api:"^1.0.0" --update-with-dependencies +composer require spryker/product-reviews-rest-api:"^1.1.0" --update-with-dependencies ``` {% info_block warningBox "Verification" %} @@ -53,10 +53,12 @@ console transfer:generate Make sure that the following changes have been applied in the transfer objects: -| TRANSFER | TYPE | EVENT | PATH | -| --- | --- | --- | --- | -| RestProductReviewsAttributesTransfer | class | created |src/Generated/Shared/Transfer/RestProductReviewsAttributesTransfer | -| BulkProductReviewSearchRequestTransfer | class | created |src/Generated/Shared/Transfer/BulkProductReviewSearchRequestTransfer| +| TRANSFER | TYPE | EVENT | PATH | +|----------------------------------------| --- | --- |----------------------------------------------------------------------| +| RestProductReviewsAttributesTransfer | class | created | src/Generated/Shared/Transfer/RestProductReviewsAttributesTransfer | +| BulkProductReviewSearchRequestTransfer | class | created | src/Generated/Shared/Transfer/BulkProductReviewSearchRequestTransfer | +| ProductReviewTransfer | class | created | src/Generated/Shared/Transfer/ProductReviewTransfer | +| StoreTransfer | class | created | src/Generated/Shared/Transfer/StoreTransfer | {% endinfo_block %} From 97b91c5f1e4a5abdeee7aa0431af4f523078c2ed Mon Sep 17 00:00:00 2001 From: Ievgen Malykhin Date: Tue, 18 Jul 2023 13:08:22 +0300 Subject: [PATCH 3/8] CC-16486: Adjust ig after CR --- ...-rating-and-reviews-feature-integration.md | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md index 790eb5423cf..7b852699eed 100644 --- a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md +++ b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md @@ -212,37 +212,6 @@ Make sure that the following endpoint is available: {% endinfo_block %} -#### Enable query expanders -Activate the following plugins: - -| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | -| --- | --- | --- | --- | -| FilterByIdProductReviewQueryExpanderPlugin | | None | Spryker\Client\ProductReviewSearch\Plugin\Search | - -**src/Pyz/Client/ProductReview/ProductReviewDependencyProvider.php** - -```php - - */ - protected function getProductReviewsQueryExpanderPlugins(): array - { - $productReviewQueryExpanderPlugins = parent::getProductReviewsQueryExpanderPlugins(); - $productReviewQueryExpanderPlugins[] = new FilterByIdProductReviewQueryExpanderPlugin(); - - return $productReviewQueryExpanderPlugins; - } -} -``` - {% info_block warningBox "Verification" %} Make sure that the following endpoint is available: From e1b7e532ed4d9f46f7b310b56b00a16de5e02cfa Mon Sep 17 00:00:00 2001 From: Ievgen Malykhin Date: Tue, 18 Jul 2023 13:09:23 +0300 Subject: [PATCH 4/8] CC-16486: Remove redundant transfers --- .../glue-api-product-rating-and-reviews-feature-integration.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md index 7b852699eed..ef843dbb003 100644 --- a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md +++ b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md @@ -57,7 +57,6 @@ Make sure that the following changes have been applied in the transfer objects: |----------------------------------------| --- | --- |----------------------------------------------------------------------| | RestProductReviewsAttributesTransfer | class | created | src/Generated/Shared/Transfer/RestProductReviewsAttributesTransfer | | BulkProductReviewSearchRequestTransfer | class | created | src/Generated/Shared/Transfer/BulkProductReviewSearchRequestTransfer | -| ProductReviewTransfer | class | created | src/Generated/Shared/Transfer/ProductReviewTransfer | | StoreTransfer | class | created | src/Generated/Shared/Transfer/StoreTransfer | {% endinfo_block %} From 05fed09fa811e556c89e7617ff2a787bb9c38573 Mon Sep 17 00:00:00 2001 From: Vadym Sachenko Date: Tue, 18 Jul 2023 13:48:33 +0300 Subject: [PATCH 5/8] Apply suggestions from code review --- ...oduct-rating-and-reviews-feature-integration.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md index ef843dbb003..3823ccca8ce 100644 --- a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md +++ b/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md @@ -25,7 +25,6 @@ To start feature integration, overview and install the necessary features: ### 1) Install the required modules using Composer -Run the following command to install the required modules: ```bash composer require spryker/product-reviews-rest-api:"^1.1.0" --update-with-dependencies @@ -42,7 +41,7 @@ Make sure that the following module was installed: ### 2) Set up database schema and transfer objects -Run the following command to generate transfer changes: +Generate transfer changes: ```bash console transfer:generate @@ -59,9 +58,6 @@ Make sure that the following changes have been applied in the transfer objects: | BulkProductReviewSearchRequestTransfer | class | created | src/Generated/Shared/Transfer/BulkProductReviewSearchRequestTransfer | | StoreTransfer | class | created | src/Generated/Shared/Transfer/StoreTransfer | -{% endinfo_block %} - -{% info_block warningBox "Verification" %} Make sure that `SpyProductAbstractStorage` and `SpyProductConcreteStorage` are extended by synchronization behavior with these methods: @@ -76,7 +72,7 @@ Make sure that `SpyProductAbstractStorage` and `SpyProductConcreteStorage` are e #### Reload data to storage -Run the following commands to reload abstract and product data to storage. +Reload abstract and product data to storage. ```bash console event:trigger -r product_abstract @@ -209,9 +205,6 @@ Make sure that the following endpoint is available: ``` -{% endinfo_block %} - -{% info_block warningBox "Verification" %} Make sure that the following endpoint is available: `https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}/product-reviews/{% raw %}{{{% endraw %}review_id{% raw %}}}{% endraw %}` @@ -480,9 +473,6 @@ Make sure that `averageRating` and `reviewCount` attributes are present in concr ``` -{% endinfo_block %} - -{% info_block warningBox "Verification" %} Make a request to `https://glue.mysprykershop.com/concrete-products/{% raw %}{{{% endraw %}concrete_sku{% raw %}}}{% endraw %}?include=product-reviews`. From c01ed5c38330a1baa0317333e80b9bf92d806dc1 Mon Sep 17 00:00:00 2001 From: Ievgen Malykhin Date: Tue, 18 Jul 2023 14:42:44 +0300 Subject: [PATCH 6/8] CC-16486: Move product rating and review ig to the pbc --- ...stall-the-product-rating-and-reviews-feature.md | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) rename docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md => _includes/pbc/all/install-features/202304.0/install-the-product-rating-and-reviews-feature.md (97%) diff --git a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md b/_includes/pbc/all/install-features/202304.0/install-the-product-rating-and-reviews-feature.md similarity index 97% rename from docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md rename to _includes/pbc/all/install-features/202304.0/install-the-product-rating-and-reviews-feature.md index 3823ccca8ce..5c51442ccc7 100644 --- a/docs/scos/dev/feature-integration-guides/202304.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.md +++ b/_includes/pbc/all/install-features/202304.0/install-the-product-rating-and-reviews-feature.md @@ -1,16 +1,4 @@ ---- -title: Glue API - Product rating & reviews feature integration -description: This guide contains step-by-step instructions on integrating Product Rating & Reviews API feature into a Spryker-based project. -last_updated: Jul 17, 2023 -template: feature-integration-guide-template -originalLink: https://documentation.spryker.com/2021080/docs/glue-api-product-rating-reviews-feature-integration -originalArticleId: 6634ada1-2f5a-454b-a5b3-9319b7e90cbf -redirect_from: - - /2021080/docs/glue-api-product-rating-reviews-feature-integration - - /2021080/docs/en/glue-api-product-rating-reviews-feature-integration - - /docs/glue-api-product-rating-reviews-feature-integration - - /docs/en/glue-api-product-rating-reviews-feature-integration ---- + ## Install feature API From 7fde2809264741cd4064cae32a8526391615333d Mon Sep 17 00:00:00 2001 From: Ievgen Malykhin Date: Tue, 18 Jul 2023 16:14:35 +0300 Subject: [PATCH 7/8] CC-16486: Adjust IG after a discussion with a tw --- ...he-product-rating-and-reviews-glue-api.md} | 0 ...the-product-rating-and-reviews-glue-api.md | 29 +++++++++++++++++++ 2 files changed, 29 insertions(+) rename _includes/pbc/all/install-features/202304.0/{install-the-product-rating-and-reviews-feature.md => install-glue-api/install-the-product-rating-and-reviews-glue-api.md} (100%) create mode 100644 docs/pbc/all/ratings-reviews/202304.0/install-and-upgrade/install-the-product-rating-and-reviews-glue-api.md diff --git a/_includes/pbc/all/install-features/202304.0/install-the-product-rating-and-reviews-feature.md b/_includes/pbc/all/install-features/202304.0/install-glue-api/install-the-product-rating-and-reviews-glue-api.md similarity index 100% rename from _includes/pbc/all/install-features/202304.0/install-the-product-rating-and-reviews-feature.md rename to _includes/pbc/all/install-features/202304.0/install-glue-api/install-the-product-rating-and-reviews-glue-api.md diff --git a/docs/pbc/all/ratings-reviews/202304.0/install-and-upgrade/install-the-product-rating-and-reviews-glue-api.md b/docs/pbc/all/ratings-reviews/202304.0/install-and-upgrade/install-the-product-rating-and-reviews-glue-api.md new file mode 100644 index 00000000000..6264ca7bd7d --- /dev/null +++ b/docs/pbc/all/ratings-reviews/202304.0/install-and-upgrade/install-the-product-rating-and-reviews-glue-api.md @@ -0,0 +1,29 @@ +--- +title: Install the Product Rating and Reviews Glue API +description: This guide contains step-by-step instructions on integrating Product Rating & Reviews API feature into a Spryker-based project. +last_updated: Jul 18, 2023 +template: feature-integration-guide-template +originalLink: https://documentation.spryker.com/2021080/docs/glue-api-product-rating-reviews-feature-integration +originalArticleId: 6634ada1-2f5a-454b-a5b3-9319b7e90cbf +redirect_from: + - /2021080/docs/glue-api-product-rating-reviews-feature-integration + - /2021080/docs/en/glue-api-product-rating-reviews-feature-integration + - /docs/glue-api-product-rating-reviews-feature-integration + - /docs/en/glue-api-product-rating-reviews-feature-integration + - /docs/scos/dev/feature-integration-guides/201811.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.html + - /docs/scos/dev/feature-integration-guides/201903.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.html + - /docs/scos/dev/feature-integration-guides/201907.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.html + - /docs/scos/dev/feature-integration-guides/202212.0/glue-api/glue-api-product-rating-and-reviews-feature-integration.html + +related: + - title: Product Rating and Reviews feature integration + link: docs/scos/dev/feature-integration-guides/page.version/product-rating-and-reviews-feature-integration.html + - title: Product Rating and Reviews feature walkthrough + link: docs/scos/dev/feature-walkthroughs/page.version/product-rating-reviews-feature-walkthrough.html + - title: Retrieving abstract products + link: docs/pbc/all/product-information-management/page.version/base-shop/manage-using-glue-api/abstract-products/glue-api-retrieve-abstract-products.html + - title: Retrieving concrete products + link: docs/pbc/all/product-information-management/page.version/base-shop/manage-using-glue-api/concrete-products/glue-api-retrieve-concrete-products.html +--- + +{% include pbc/all/install-features/202304.0/install-glue-api/install-the-product-rating-and-reviews-glue-api.md %} From f630d6ce7e54debccce4ff0fb46ce5234387ba3d Mon Sep 17 00:00:00 2001 From: Vadym Sachenko Date: Wed, 19 Jul 2023 14:12:26 +0300 Subject: [PATCH 8/8] Update install-the-product-rating-and-reviews-glue-api.md --- ...the-product-rating-and-reviews-glue-api.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/_includes/pbc/all/install-features/202304.0/install-glue-api/install-the-product-rating-and-reviews-glue-api.md b/_includes/pbc/all/install-features/202304.0/install-glue-api/install-the-product-rating-and-reviews-glue-api.md index 5c51442ccc7..a46bd7b851d 100644 --- a/_includes/pbc/all/install-features/202304.0/install-glue-api/install-the-product-rating-and-reviews-glue-api.md +++ b/_includes/pbc/all/install-features/202304.0/install-glue-api/install-the-product-rating-and-reviews-glue-api.md @@ -1,25 +1,29 @@ -## Install feature API +This document describes how to integrate the [Product Raiting and Reviews](/docs/pbc/all/ratings-reviews/{{page.version}}/ratings-and-reviews.html) Glue API feature into a Spryker project. + +## Install feature core + +Follow the steps below to install the Product Raiting and Review Glue API feature core. + ### Prerequisites -To start feature integration, overview and install the necessary features: +To start feature integration, integrate the required features and Glue APIs: | NAME | VERSION | INTEGRATION GUIDE | | --- | --- | --- | -| Spryker Core | {{page.version}} | [Feature API](/docs/scos/dev/feature-integration-guides/{{page.version}}/glue-api/glue-api-spryker-core-feature-integration.html) | -| Product Rating & Reviews | {{page.version}} | | +| Spryker Core Glue API | {{page.version}} | [Install the Spryker Core Glue API](/docs/scos/dev/feature-integration-guides/{{page.version}}/glue-api/glue-api-spryker-core-feature-integration.html) | +| Product Rating & Reviews | {{page.version}} | [Install the Product Rating and Reviews feature](/docs/pbc/all/ratings-reviews/{{page.version}}/install-and-upgrade/install-the-product-rating-and-reviews-feature.html) | ### 1) Install the required modules using Composer - ```bash composer require spryker/product-reviews-rest-api:"^1.1.0" --update-with-dependencies ``` {% info_block warningBox "Verification" %} -Make sure that the following module was installed: +Make sure that the following module has been installed: | MODULE | EXPECTED DIRECTORY | | --- | --- | @@ -56,9 +60,7 @@ Make sure that `SpyProductAbstractStorage` and `SpyProductConcreteStorage` are e {% endinfo_block %} -### 3) Set up behavior - -#### Reload data to storage +### 3) Reload data to storage Reload abstract and product data to storage. @@ -75,7 +77,7 @@ Make sure that there is data in Redis with keys: {% endinfo_block %} -#### Enable resources +### 4) Enable resources Activate the following plugins: @@ -109,10 +111,10 @@ class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependency {% info_block warningBox "Verification" %} -Make sure that the following endpoint is available: -`https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}/product-reviews` +Make sure that the following endpoints are available: +* `https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}/product-reviews` -
+
Example ```json @@ -193,11 +195,9 @@ Make sure that the following endpoint is available: ```
+* `https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}/product-reviews/{% raw %}{{{% endraw %}review_id{% raw %}}}{% endraw %}` -Make sure that the following endpoint is available: -`https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}/product-reviews/{% raw %}{{{% endraw %}review_id{% raw %}}}{% endraw %}` - -
+
Example ```json @@ -221,7 +221,7 @@ Make sure that the following endpoint is available: {% endinfo_block %} -#### Enable relationships +### 5) Enable relationships Activate the following plugins: @@ -306,13 +306,13 @@ class ProductsRestApiDependencyProvider extends SprykerProductsRestApiDependency {% info_block warningBox "Verification" %} -Make a request to `https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}?include=product-reviews`. +1. Make a request to `https://glue.mysprykershop.com/abstract-products/{% raw %}{{{% endraw %}abstract_sku{% raw %}}}{% endraw %}?include=product-reviews`. -Make sure that the response contains product-reviews as a relationship and product-reviews data included. +2. Make sure that the response contains `product-reviews` as a relationship and `product-reviews` data included. -Make sure that `averageRating` and `reviewCount` attributes are present in concrete-products and abstract-products resources attributes section. +3. Make sure that `averageRating` and `reviewCount` attributes are present in concrete-products and abstract-products resources attributes section. -
+
Example ```json @@ -462,11 +462,11 @@ Make sure that `averageRating` and `reviewCount` attributes are present in concr
-Make a request to `https://glue.mysprykershop.com/concrete-products/{% raw %}{{{% endraw %}concrete_sku{% raw %}}}{% endraw %}?include=product-reviews`. +4. Make a request to `https://glue.mysprykershop.com/concrete-products/{% raw %}{{{% endraw %}concrete_sku{% raw %}}}{% endraw %}?include=product-reviews`. -Make sure that the response contains product-reviews as a relationship and product-reviews data included. +5. Make sure that the response contains `product-reviews` as a relationship and `product-reviews` data included. -
+
Example ```json