Jump to content

[Webservice] How to get products with two categories associated?


Tienda77
 Share

Recommended Posts

Hello everybody and thanks for reading this.

 

We have a working prestashop store with products associated to categories following two trees:

 

- Models                         - Type of product

   - model A        and        - type A

   - model B                      - type B

 

A product can belong to model A and type B at the same time (and it will).

 

In order to advertise our products in other webs, we want to access webservice with a given model and type and obtain the products that are included in both categories. We have successfully got the products when only one of the two given filters are present, by using

anyshop.com/api/products/?display=[name]&filter[id_category_default]=[22]

and/or

 

$opt = array(
   'resource' => 'products',
   'display'  => '[id,name]',
   'filter[id_category_default]' => '[22]'
);
// Call
$xml = $webService->get($opt);

But we don't know how to include the second filter in the query, as the second category is inside "associations" block, like in the following product:

<associations>
   <categories nodeType="category" api="categories">
      <category xlink:href="anyshop.com/api/categories/22">
         <id>
            <![CDATA[ 22 ]]>
         </id>
      </category>
      <category xlink:href="anyshop.com/api/categories/36">
         <id>
            <![CDATA[ 36 ]]>
         </id>
      </category>
   </categories>
...
</associations>

Can anybody help?

 

Thanks a lot in advance

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More