Totti Posted February 19, 2015 Share Posted February 19, 2015 $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $opt['price[prezzo][use_tax]']= '0'; $xmlProducts = $webService->get($opt); Hello, I would use this feature on the webservice but the price I always returns 0, so the formula is right to create it ? Link to comment Share on other sites More sharing options...
swina Posted February 19, 2015 Share Posted February 19, 2015 (edited) Hi, you are looking for a product price so you have to query first the products webservice //create new webservice $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); //define resource access, returned fields and filters $opt = array ( 'resource' => 'products' , 'display' => '[id,name,price,id_tax_rules_group] ); //you can add a line filter above on product id (remember to add comma in the line before) /*'filter[id]' => '[your product id]'*/ // //call webservice $xml = $webService->get($opt); //get the elements from children of products $prods = $xml->products->children(); //get your output foreach ( $prods as $item ){ $prodName = $item->xpath('name/language[@id=1]') //if your language is 1 echo (string)$item->id.' > '.$prodName.' > price is '.(string)$item->price; } I suggest you to enable debug ( define(DEBUG,true) ) in order to check server response. You can check all the fields of products with following command: $xml = $webService->get(array('url' => 'your_prestashop_url/api/products?schema=synopsis')); //or $xml = $webService->get(array('url' => 'your_prestashop_url/api/products?schema=blank')); To get the field list of products: //change your prestashop url in the following line $xml = $webService->get(array('url' => 'your_presta_shop_url/api/products?schema=blank')); $resources = $xml->children()->children(); echo '<table>'; foreach ($resources as $key => $resource) { echo '<tr><td>' . $key . '</td></tr>'; } echo '</table>'; I hope this will help you. Have fun ! Edited February 19, 2015 by swina (see edit history) Link to comment Share on other sites More sharing options...
Totti Posted February 20, 2015 Author Share Posted February 20, 2015 Thanks for everything, but one to which I referred is how to use this: Here Link to comment Share on other sites More sharing options...
swina Posted February 20, 2015 Share Posted February 20, 2015 Hi, I don't understand what you need the webservices for. I mean if you explain me what are your needs I can try to help you better. Using webservices you can get or even create/update/delete data in ps database outside from prestashop core. I am using webservices for a web app in order to create orders out of webstore. Have a good day Link to comment Share on other sites More sharing options...
Totti Posted February 20, 2015 Author Share Posted February 20, 2015 but one to which I referred is how to use this: http://doc.prestashop.com/display/PS15/Chapter+10+-+Price+management Link to comment Share on other sites More sharing options...
Totti Posted February 21, 2015 Author Share Posted February 21, 2015 $opt['price[prezzo][use_tax]']= '0'; is correct as syntax ? Link to comment Share on other sites More sharing options...
Totti Posted February 25, 2015 Author Share Posted February 25, 2015 Help me please ! Link to comment Share on other sites More sharing options...
Totti Posted March 11, 2015 Author Share Posted March 11, 2015 Any news or tips ? Link to comment Share on other sites More sharing options...
Totti Posted March 17, 2015 Author Share Posted March 17, 2015 Up please ! 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