oxcom / magento2-top-products
这是一个扩展 Magento2 API 以获取顶级产品列表的模块。
v1.1.0
2021-01-11 11:27 UTC
Requires
- php: >=5.6
- magento/framework: 100.0.*|100.1.*|101.0.*|102.0.*|103.0.*
- magento/module-backend: 100.0.*|100.1.*|100.2.*|101.0.*|102.0.*|103.0.*
- magento/module-config: 100.0.*|100.1.*|101.0.*|101.1.*|101.2.*
- magento/module-directory: 100.0.*|100.1.*|100.2.*|100.3.*|100.4.*
- magento/module-store: 100.0.*|100.1.*|100.2.*|101.0.*|101.1.*
Requires (Dev)
- magento/zendframework1: 1.12.*|1.13.*|1.14.*
- phpunit/phpunit: 5.3.5|^7.5.20|^9.3.8
- squizlabs/php_codesniffer: ^3.5.8
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 - 通过周期进行筛选。此选项仅适用于 selling
或 free
类型。可能的值包括
- 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
错误和问题
请,如果您发现错误或某些东西不能正常工作,请联系我并告诉我哪里出了问题。在您的请求中提供如何重现错误的示例或任何修复建议的想法都是很好的。我会尽快处理。