oxcom / magento2-top-products

这是一个扩展 Magento2 API 以获取顶级产品列表的模块。

安装: 357

依赖: 0

建议: 0

安全: 0

星标: 7

关注者: 4

分支: 5

开放问题: 0

类型:magento2-module

v1.1.0 2021-01-11 11:27 UTC

This package is auto-updated.

Last update: 2024-09-11 19:06:17 UTC


README

这是一个扩展 Magento2 API 以通过以下过滤器获取顶级产品列表的模块。

  • 顶级热销产品
  • 顶级免费产品
  • 顶级评价产品

顶级热销和免费产品是从 Magento2 报告中获取的。

顶级评价产品是从评价模块中获取的,结果基于汇总数据。

安装

$ composer require oxcom/magento2-top-products
$ bin/magento module:enable OxCom_MagentoTopProducts
$ bin/magento setup:upgrade
$ bin/magento setup:di:compile

API 请求

GET /V1/products/top/{type} - 通过类型获取顶级产品列表。其中 type 可以是

  • selling - 顶级热销产品
  • free - 顶级免费产品
  • rated - 顶级评价产品
搜索条件参数

pageSize - 每页大小

currentPage - 当前页码

ratingCode - 通过评价类型进行筛选。此选项仅适用于 rated 类型。可能的值可以在 rating 表中找到。

period - 通过周期进行筛选。此选项仅适用于 sellingfree 类型。可能的值包括

  • yearly - 年度报告(默认值)
  • monthly - 月度报告
  • daily - 日度报告

filter_groups - 作为产品搜索条件,此过滤器将允许您使用更多要求处理产品集合。

搜索条件示例

通过以下方式筛选顶级热销产品

  • period: daily
  • price > 10
  • visibility = 4
  • pageSize = 10
  • currentPage = 2
$ curl -X GET \
  'https://example.com/rest/all/V1/products/top/selling?searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=visibility&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=4&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bcondition_type%5D=eq&searchCriteria%5BpageSize%5D=10&searchCriteria%5BcurrentPage%5D=2&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bfield%5D=price&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bvalue%5D=10&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bcondition_type%5D=gt&searchCriteria%5Bperiod%5D=daily' \
  -H 'authorization: Bearer {api-token}' \
  -H 'cache-control: no-cache'

通过以下方式筛选顶级评价产品

  • ratingCode: Rating
  • status = 2
  • visibility = 4
  • pageSize = 10
  • currentPage = 2
$ curl -X GET \
  'https://example.com/rest/all/V1/products/top/rated?searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=visibility&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=4&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bcondition_type%5D=eq&searchCriteria%5BpageSize%5D=10&searchCriteria%5BcurrentPage%5D=2&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bfield%5D=status&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bvalue%5D=1&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B1%5D%5Bcondition_type%5D=eq&searchCriteria%5BratingCode%5D=Rating' \
  -H 'authorization: Bearer {api-token}' \
  -H 'cache-control: no-cache'

依赖关系

此模块使用以下模块的现有功能

  • magento/module-catalog
  • magento/module-review
  • magento/module-sales

错误和问题

请,如果您发现错误或某些东西不能正常工作,请联系我并告诉我哪里出了问题。在您的请求中提供如何重现错误的示例或任何修复建议的想法都是很好的。我会尽快处理。