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

Add filter by ProductGroups and sort by popular for ProductProperties

This commit is contained in:
Kirill Sukhorukov 2024-07-08 12:06:58 +03:00
parent 8b677de616
commit ca1650d8d9
4 changed files with 52 additions and 0 deletions

View File

@ -66,4 +66,12 @@ class ProductPropertiesFilterType
* @Form\SerializedName("catalogs") * @Form\SerializedName("catalogs")
*/ */
public $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; use PageLimitTrait;
/**
* @var ProductPropertiesSort
*
* @Form\Type("ProductPropertiesSort")
* @Form\SerializedName("sort")
*/
public $sort;
/** /**
* @var \RetailCrm\Api\Model\Filter\Store\ProductPropertiesFilterType * @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\ProductGroupsEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsRequest; use RetailCrm\Api\Model\Request\Store\ProductGroupsRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesRequest; 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\ProductsBatchCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductsRequest; use RetailCrm\Api\Model\Request\Store\ProductsRequest;
use RetailCrm\TestUtils\Factory\TestClientFactory; use RetailCrm\TestUtils\Factory\TestClientFactory;
@ -616,10 +617,14 @@ EOF;
EOF; EOF;
$request = new ProductPropertiesRequest(); $request = new ProductPropertiesRequest();
$request->sort = new ProductPropertiesSort();
$request->sort->offersCount = 'desc';
$request->filter = new ProductPropertiesFilterType(); $request->filter = new ProductPropertiesFilterType();
$request->filter->sites = ['moysklad', 'aliexpress']; $request->filter->sites = ['moysklad', 'aliexpress'];
$request->filter->visible = NumericBoolean::TRUE; $request->filter->visible = NumericBoolean::TRUE;
$request->filter->variative = NumericBoolean::TRUE; $request->filter->variative = NumericBoolean::TRUE;
$request->filter->groups = [3676, 3679, 3680, 3724];
$mock = static::createApiMockBuilder('store/products/properties'); $mock = static::createApiMockBuilder('store/products/properties');
$mock->matchMethod(RequestMethod::GET) $mock->matchMethod(RequestMethod::GET)