Search code examples
magentomagento-soap-api

Magento API V2 catalogProductList Filter by status


i am trying to get a list of "enabled" products through Magento SOAP API V2.
For this i have built a filter like the following. But unfortunately am always retrieving all products, regardless of status.

function GetProductList(sessionID: string; Store_View_ID: integer): catalogProductListResponseParam;
var
  mycatalogProductListRequestParam: catalogProductListRequestParam;  
  my_ae: associativeEntity;  
  my_complex_filter_array: complexFilterarray;  
  my_complex_filter: complexFilter;  
  my_filter: filters;  


begin  
  my_filter := filters.Create;  
  SetLength(my_complex_filter_array, 1);  

  my_ae := associativeEntity.Create;  
  my_ae.key := '=';  
  my_ae.value := '1';  
  my_complex_filter := complexFilter.Create;  
  my_complex_filter.key := 'status';  
  my_complex_filter.value := my_ae;  
  my_complex_filter_array[0] := my_complex_filter;  
  my_complex_filter := nil;  
  my_ae := nil;  
  my_filter.complex_filter := my_complex_filter_array;  


  mycatalogProductListRequestParam := catalogProductListRequestParam.Create;  
  mycatalogProductListRequestParam.sessionId := sessionID;  
  mycatalogProductListRequestParam.store := IntToStr(Store_View_ID);  
  mycatalogProductListRequestParam.filters := my_filter;  
  result := mage.catalogProductList(mycatalogProductListRequestParam);  
  my_filter := nil;  
  mycatalogProductListRequestParam := nil;  
end;  

It seems, that i can only filter on attributes, that are part of the return data.
Does anybody know how to get just a list of enabled products ?

Holger


Solution

  • I found out, why its not working. Magento cant apply the filter in this call if you specify the "store". If you skip submitting the storeview_id, then the result is filtered by products with status "1".