I cannot find any documentation (other than the WSDL itself) that provides a working example of how to filter a SOAP API_v2 catalogProductList
.
I have a list of skus and I want to filter the list with nin
(not in) so that the response gives me all products other than what I have in my skus.
$skus = array('1','2','3');
$filter = array(
'sku' => array('nin' => $skus)
)
$productList = $client->catalogProductList($session, $filter);
// Returns all products in the store instead of filtered list.
Zend_Debug::dump($productList);
I have also see the $filter
being built with complex_filters
that uses a different array structure, but I don't understand what the difference is.
How do I simply filter an API product list using the nin
method?
EDIT
Trying with complex_filters
, using 'eq' works, but not 'nin':
// this returns a single product with sku 12345
$filter = array(
'complex_filter' => array(
array('key' => 'sku', 'value' => array('key' => 'eq', 'value' => '12345'))
)
);
// This results in an error - "Notice: Array to string conversion in ..."
$filter = array(
'complex_filter' => array(
array('key' => 'sku', 'value' => array('key' => 'nin', 'value' => array('12345', '67890'))
)
);