Erik Borg
Erik Borg

Reputation: 86

C# - Magento: filter products by category_ids

I'm working with Magento api v2 in .net and I'm trying to get a list of products from a given category ID. I've gotten as far as to setup a complex filter. However, I don't know what the value of my associativeEntity should be. (category_ids is a string array)

Does anyone have an idea what the value should be? The code snippet of my filter is posted below.

        filters f = new filters();
        f.complex_filter = new complexFilter[]
        {
            new complexFilter()
            {
                key = "category_ids",
                value = new associativeEntity
                {
                    key = "in",
                    value = " "
                }
            }
        };

        catalogProductEntity[] result;

        result = this.client.catalogProductList(this.sessionId, f, "default");

Upvotes: 2

Views: 2156

Answers (1)

Erik Borg
Erik Borg

Reputation: 86

Found out how to do it without using the complex filter. (and still do the filtering server side)

There is a method called: catalogCategoryAssignedProducts(string session_id, int category_id)

This method returns an array of products of the given category id. The returned array is of type: catalogAssignedProduct

Upvotes: 1

Related Questions