set the default parameters for data filtering in jqadm

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
margeslt
Posts: 6
Joined: 18 Aug 2018, 17:18

set the default parameters for data filtering in jqadm

Post by margeslt » 18 Aug 2018, 18:42

How can I set the default parameters for data filtering in jqadm for product?

[img]https://a.radikal.ru/a17/1808/e1/52a1e2a00ef8.png
[/img]

margeslt
Posts: 6
Joined: 18 Aug 2018, 17:18

Re: set the default parameters for data filtering in jqadm

Post by margeslt » 20 Aug 2018, 12:40

I find solution to my problem:

Code: Select all

 
$params = $this->storeSearchParams( $view->param(), 'product' );


 /* Check or set default value for filter product.status*/
$filterKeys = $view->param('filter/key', []);

$searchKey = array_search('product.status', $filterKeys);
$filterVal = $view->param('filter/val', []);
if(!isset($filterVal[$searchKey]) || empty($filterVal[$searchKey])){
  $defaultFilter = array(
                    'filter' => array(
                        'key' => array( 2 => 'product.status' ),
                        'op' => array( 2 => '==' ),
                        'val' => array(2 => 1 ),
                     ));
 $params = $this->storeSearchParams( $defaultFilter  , 'product' );
}

But maybe there is another way to solve the problem, more correct?

Post Reply