Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value array might need to be inside of an array #9

Open
TipPro opened this issue May 4, 2023 · 0 comments
Open

Value array might need to be inside of an array #9

TipPro opened this issue May 4, 2023 · 0 comments

Comments

@TipPro
Copy link

TipPro commented May 4, 2023

/* You can also just supply a custom array of list filters you wish to apply */
$request->setFilters([
[
'name' => 'search',
'value' => [
'field' => 'code',
'operator' => 'EQ',
'value' => 'Foo'
]
],
[
'name' => 'search_AND',
'value' => [
'field' => 'price',
'operator' => 'GT',
'value' => 9.99
]
]
]);

I needed to filter orders based on a custom field so I used this example. I could not get it to work until I put the value array inside of an array. My assumption may be wrong, but my code below only worked when I added the array.

$request->setFilters([
            [
                'name' => 'search',
                'value' => [
                    [
                        'field' => 'CustomField_Values:customfields:' . OrderCustomFields::PENDING_CANCEL_CODE,
                        'operator' => 'EQ',
                        'value' => true
                    ]
                ]
            ]
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant