amaragna Posted January 8, 2016 Share Posted January 8, 2016 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? Example. 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 More sharing options...
amaragna Posted January 9, 2016 Author Share Posted January 9, 2016 (edited) 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. unset($resource->manufacturer_name); unset($resource->quantity) Cheers, Angelo Maragna Edited January 9, 2016 by amaragna (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now