landofcoder/module-product-reviews-graphql
Composer 安装命令:
composer require landofcoder/module-product-reviews-graphql
包简介
Magento 2 Advanced Product Reviews GraphQl extension
README 文档
README
landofcoder/module-product-reviews-graphql
Main Functionalities
magento 2 product reviews graphql extension
Installation
* = in production please use the --keep-generated option
Type 1: Zip file
- Unzip the zip file in
app/code/Lof - Enable the module by running
php bin/magento module:enable Lof_ProductReviewsGraphQl - Apply database updates by running
php bin/magento setup:upgrade* - Flush the cache by running
php bin/magento cache:flush
Type 2: Composer
- Make the module available in a composer repository for example:
- private repository
repo.magento.com - public repository
packagist.org - public github repository as vcs
- private repository
- Add the composer repository to the configuration by running
composer config repositories.repo.magento.com composer https://repo.magento.com/ - Install the module composer by running
composer require landofcoder/module-product-reviews-graphql - enable the module by running
php bin/magento module:enable Lof_ProductReviewsGraphQl - apply database updates by running
php bin/magento setup:upgrade* - Flush the cache by running
php bin/magento cache:flush
TODO
Queries
- Query get product advanced reviews
- $urlKey : String - product url key
- $search : String - filter by keyword
- $pageSize : Int = 20 - page size
- $currentPage : Int = 1 - current page
- $sortBy : ReviewSortingType = default - enum: default, helpful, rating, latest, oldest, recommended, verified
query {
products(filter: { url_key: { eq: $urlKey } }) {
items {
id
uid
sku
advreview (
search: $search
pageSize: $pageSize
currentPage: $currentPage
sortBy: $sortBy
) {
__typename
totalRecords
ratingSummary
ratingSummaryValue
recomendedPercent
totalRecordsFiltered
detailedSummary {
__typename
one
two
three
four
five
}
items {
__typename
review_id
created_at
answer
verified_buyer
is_recommended
detail_id
title
detail
nickname
like_about
not_like_about
guest_email
plus_review
minus_review
report_abuse
rating_votes {
__typename
vote_id
option_id
rating_id
review_id
percent
value
rating_code
}
images {
__typename
full_path
resized_path
}
comments {
__typename
id
review_id
status
message
nickname
email
created_at
updated_at
}
}
}
}
}
}
Example:
query {
products(filter: { url_key: { eq: "pp-009238562599" } }) {
items {
id
uid
advreview (
search: ""
pageSize: 10
currentPage: 1
sortBy: helpful
) {
__typename
totalRecords
ratingSummary
ratingSummaryValue
recomendedPercent
totalRecordsFiltered
detailedSummary {
__typename
one
two
three
four
five
}
items {
__typename
review_id
created_at
answer
verified_buyer
is_recommended
detail_id
title
detail
nickname
like_about
not_like_about
guest_email
plus_review
minus_review
report_abuse
rating_votes {
__typename
vote_id
option_id
rating_id
review_id
percent
value
rating_code
}
images {
__typename
full_path
resized_path
}
comments {
__typename
id
review_id
status
message
nickname
email
created_at
updated_at
}
}
}
}
}
}
- Query review comments of a review
query {
comments (
review_id: Int!
filter: ReviewCommentFilterInput
pageSize: Int = 5
currentPage: Int = 1
sort: ReviewCommentSortInput
) {
items {
__typename
id
review_id
status
message
nickname
email
parent_id
created_at
updated_at
}
total_count
page_info {
page_size
current_page
total_pages
}
}
}
- Mutation submit like a review
mutation {
likeReview (review_id : Int!)
}
- Mutation submit unlike a review
mutation {
unlikeReview (review_id : Int!)
}
- Mutation submit report a review
mutation {
reportReview (review_id : Int!)
}
- Mutation submit product review with extra information
mutation {
createProductAdvReview (
input: {
sku: String!
nickname: String!
summary: String!
text: String!
ratings: [ProductAdvReviewRatingInput!]!
email: String
advantages: String
disadvantages: String
images: [ReviewGalleryImageInput]
}
) {
review {
review_id
created_at
answer
verified_buyer
is_recommended
detail_id
title
detail
nickname
like_about
not_like_about
guest_email
plus_review
minus_review
report_abuse
rating_votes {
__typename
vote_id
option_id
rating_id
review_id
percent
value
rating_code
}
images {
__typename
full_path
resized_path
}
comments {
__typename
id
review_id
status
message
nickname
email
created_at
updated_at
}
}
}
}
- ProductAdvReviewRatingInput:
input ProductAdvReviewRatingInput {
rating_id: Int
rating_name: String!
value: Int!
}
rating_name: A Rating Name: It is rating_code in table rating. Example Default rating_name: Quality, Value, Price, Rating value: A Rating number, from 1 to 5.
- ReviewGalleryImageInput:
input ReviewGalleryImageInput {
src: String
}
- Mutation post review comment
mutation {
createComment (
input : {
review_id: Int!
title: String
message: String!
nickname: String
email: String
parent_id: Int
website: String
}
) {
comment {
id
review_id
status
message
nickname
email
created_at
updated_at
}
}
}
Example:
mutation {
createComment (
input: {
review_id: 348,
title: "Comment Title Graphql",
message: "New message for review from Graphql",
nickname: "Test User",
email: "testuser@gmail.com"
}
) {
comment {
id
review_id
status
message
nickname
email
created_at
updated_at
}
}
}
- Get logged in customer reviews
Query:
{
customer {
advreviews(
filter: {
}
pageSize: 5
currentPage: 1
) {
items {
review_id
entity_pk_value
created_at
answer
verified_buyer
is_recommended
detail_id
title
detail
nickname
like_about
not_like_about
guest_email
plus_review
minus_review
report_abuse
rating_votes {
__typename
vote_id
option_id
rating_id
review_id
percent
value
rating_code
}
images {
__typename
full_path
resized_path
}
comments {
__typename
id
review_id
status
message
nickname
email
created_at
updated_at
}
}
page_info {
page_size
current_page
total_pages
}
total_count
}
}
}
Filter fields:
review_id
created_at
title
detail
nickname
entity_pk_value
Sort fields:
review_id
created_at
title
detail
nickname
entity_pk_value
landofcoder/module-product-reviews-graphql 适用场景与选型建议
landofcoder/module-product-reviews-graphql 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.17k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 landofcoder/module-product-reviews-graphql 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 landofcoder/module-product-reviews-graphql 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 5.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2022-02-21