wildlily980 Posted June 16, 2012 Share Posted June 16, 2012 For example,I want insert a product by php is there an existing api function to do this? insert_product(title,des,price...) Or I have to code this function myself? I have searched for this for days,it seems prestashop has no api,has it? Link to comment Share on other sites More sharing options...
Dh42 Posted June 16, 2012 Share Posted June 16, 2012 There are actually several ways to do it. You can import it through the back office using a csv, you can use the restful api or you can use php/sql. The sql is pretty straight forward one you have looked at the developers guide. http://doc.prestashop.com/display/PS14/Developer+Guide 1 Link to comment Share on other sites More sharing options...
wildlily980 Posted June 16, 2012 Author Share Posted June 16, 2012 There are actually several ways to do it. You can import it through the back office using a csv, you can use the restful api or you can use php/sql. The sql is pretty straight forward one you have looked at the developers guide. http://doc.prestasho...Developer+Guide Thank you DesignHaus42 I'm trying the webservice,but it always responses "other error" error,do you have any opinions? Link to comment Share on other sites More sharing options...
Dh42 Posted June 16, 2012 Share Posted June 16, 2012 ok, stupid low level guess; do you have it turned on? Link to comment Share on other sites More sharing options...
wildlily980 Posted June 16, 2012 Author Share Posted June 16, 2012 ok, stupid low level guess; do you have it turned on? Yes,I followed the instruction step by step, generated .htaccess,robots.txt and generated the account,and modified the example codes. I'm using http://localhost/prestashop/ as the store url,is this the problem? ###########one part of codes ########### define('DEBUG', true); // Debug mode define('PS_SHOP_PATH', 'http://127.0.0.1/prestashop/'); // Root path of your PrestaShop store define('PS_WS_AUTH_KEY', 'M657YWAAN8VOCP04DU69YPTO49L5RDUT'); // Auth key (Get it in your Back Office) require_once('./PSWebServiceLibrary.php'); Link to comment Share on other sites More sharing options...
wildlily980 Posted June 16, 2012 Author Share Posted June 16, 2012 (edited) And I got debug information from living site: HTTP REQUEST HEADER GET //api/customers HTTP/1.1 Authorization: Basic UjdUUkhEUTA1NDZXSEJPQzZWWVIyUjhXWFFKNkRCOTI6 Host: ***.*** Accept: */* HTTP RESPONSE HEADER HTTP/1.1 301 Moved Permanently Date: Sat, 16 Jun 2012 10:06:16 GMT Server: Apache/2.2.6 mod_auth_kerb/5.3 PHP/5.2.17 mod_fcgid/2.3.6 X-Powered-By: PHP/5.2.17 Cache-Control: no-cache Set-Cookie: 8812c36aa5ae336c2a77bf63211d899a=vnmKBzWh19Hj4XxOMVakR3sweYCKKONKXysU7yzh6h%2B%2FjCQjys1qZYvkJG7iQE3dM0vtXiTtqXfZ7dyoeGZPvA%3D%3D000061; expires=Fri, 06-Jul-2012 10:06:19 GMT; path=/; domain=***; httponly Set-Cookie: 8812c36aa5ae336c2a77bf63211d899a=vnmKBzWh19Hj4XxOMVakR3sweYCKKONKXysU7yzh6h9T%2FlI%2F2l%2B%2FF2klHvFPstbsUJW8waHr74Y4vaRpY8saK0LCsJFCrj0fv4U9Ha5RAQE%3D000075; expires=Fri, 06-Jul-2012 10:06:19 GMT; path=/; domain=***.***; httponly Location: http://***.com/404.php Content-Length: 0 Connection: close Content-Type: text/html; charset=utf-8 RETURN HTTP BODY Other error Customers List Edited June 16, 2012 by wildlily980 (see edit history) Link to comment Share on other sites More sharing options...
wildlily980 Posted June 16, 2012 Author Share Posted June 16, 2012 I can browse the api directly http://localhost/prestashop/api/categories It returns data correctly. Link to comment Share on other sites More sharing options...
Recommended Posts