Jump to content

[Webservice] Display Filter Not Working


Recommended Posts

Hallo everyone.

I'm using webservice and facing this problem.

I can't display categories field using the display filter.


Is there a way to do that?





Suppose $id contains an existing product id.

Suppose $webService is a correct instance of a working PrestaShopWebservice class.

This code returns Bad Request because of the ending "categories". Without, it works well.

$opt = [
  'resource' => 'products',
  //'display' => 'full',
  'display' => '[id_shop_default,reference,name,description,price,weight,categories]',
  'filter[id]' => $id,

$xml = $webService->get( $opt );

Thank you




Link to comment
Share on other sites

Out of now, turns out I haven't yet found a way to display a limited set of fields.


On the other side, I found another way to accomplish my task.




On the $xml result you will have a "products" tag, containing a list of "product" tags.


Hopefully, if you manage to fetch at least one record, this code 

$product = $xml->products->product[0]; // SimpleXMLElement

you can use unset to remove the fields you won't need.



Angelo Maragna

Edited by amaragna (see edit history)
Link to comment
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
  • Create New...