1
0
mirror of synced 2024-11-21 21:06:07 +03:00

Support for filtering product properties by groups and sorting by usage in offers

This commit is contained in:
Pavel 2024-08-06 12:38:45 +03:00 committed by GitHub
commit 5b04bd9d8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 52 additions and 0 deletions

View File

@ -66,4 +66,12 @@ class ProductPropertiesFilterType
* @Form\SerializedName("catalogs")
*/
public $catalogs;
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("groups")
*/
public $groups;
}

View File

@ -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
*

View File

@ -0,0 +1,31 @@
<?php
/**
* PHP version 7.3
*
* @category ProductPropertiesRequest
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Request\Store;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
use RetailCrm\Api\Model\Request\Traits\PageLimitTrait;
/**
* Class ProductPropertiesSort
*
* @category ProductPropertiesRequest
* @package RetailCrm\Api\Model\Request\Store
*/
class ProductPropertiesSort implements RequestInterface
{
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("offersCount")
*/
public $offersCount;
}

View File

@ -33,6 +33,7 @@ use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesSort;
use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductsRequest;
use RetailCrm\TestUtils\Factory\TestClientFactory;
@ -616,10 +617,14 @@ EOF;
EOF;
$request = new ProductPropertiesRequest();
$request->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)