From ca1650d8d9068294ac30396c60608153047e0cbd Mon Sep 17 00:00:00 2001 From: Kirill Sukhorukov Date: Mon, 8 Jul 2024 12:06:58 +0300 Subject: [PATCH] Add filter by ProductGroups and sort by popular for ProductProperties --- .../Store/ProductPropertiesFilterType.php | 8 +++++ .../Store/ProductPropertiesRequest.php | 8 +++++ .../Request/Store/ProductPropertiesSort.php | 31 +++++++++++++++++++ tests/src/ResourceGroup/StoreTest.php | 5 +++ 4 files changed, 52 insertions(+) create mode 100644 src/Model/Request/Store/ProductPropertiesSort.php diff --git a/src/Model/Filter/Store/ProductPropertiesFilterType.php b/src/Model/Filter/Store/ProductPropertiesFilterType.php index 8842689..febb284 100644 --- a/src/Model/Filter/Store/ProductPropertiesFilterType.php +++ b/src/Model/Filter/Store/ProductPropertiesFilterType.php @@ -66,4 +66,12 @@ class ProductPropertiesFilterType * @Form\SerializedName("catalogs") */ public $catalogs; + + /** + * @var int[] + * + * @Form\Type("int[]") + * @Form\SerializedName("groups") + */ + public $groups; } diff --git a/src/Model/Request/Store/ProductPropertiesRequest.php b/src/Model/Request/Store/ProductPropertiesRequest.php index 07c4502..a331f36 100644 --- a/src/Model/Request/Store/ProductPropertiesRequest.php +++ b/src/Model/Request/Store/ProductPropertiesRequest.php @@ -23,6 +23,14 @@ class ProductPropertiesRequest implements RequestInterface { use PageLimitTrait; + /** + * @var ProductPropertiesSort + * + * @Form\Type("ProductPropertiesSort") + * @Form\SerializedName("sort") + */ + public $sort; + /** * @var \RetailCrm\Api\Model\Filter\Store\ProductPropertiesFilterType * diff --git a/src/Model/Request/Store/ProductPropertiesSort.php b/src/Model/Request/Store/ProductPropertiesSort.php new file mode 100644 index 0000000..78d9efb --- /dev/null +++ b/src/Model/Request/Store/ProductPropertiesSort.php @@ -0,0 +1,31 @@ +sort = new ProductPropertiesSort(); + $request->sort->offersCount = 'desc'; + $request->filter = new ProductPropertiesFilterType(); $request->filter->sites = ['moysklad', 'aliexpress']; $request->filter->visible = NumericBoolean::TRUE; $request->filter->variative = NumericBoolean::TRUE; + $request->filter->groups = [3676, 3679, 3680, 3724]; $mock = static::createApiMockBuilder('store/products/properties'); $mock->matchMethod(RequestMethod::GET)